# Machsupport Forum

## Mach Discussion => General Mach Discussion => Topic started by: DeanR181 on September 22, 2016, 11:38:18 PM

Title: Mach3 Speed Setting Opposite
Post by: DeanR181 on September 22, 2016, 11:38:18 PM
Hi all,

This is my first time so please be gentle with me.

i have a problem which for the life of me I cannot figure out.

I have setup my Huanyang VDF for external 0 - 10V input and Mach3 and ESS

I am getting the spindle to adjust speed through the 0 - 10V however (this is the problem) if i input M3 S1000, the spindle will go to 22000 RPM. If I input M3 S24000, the spindle will reduce to 1000rpm.

It is back to front and I just cant work out how to fix it.

Hope someone can advise.

thanks
Fredrick
Title: Re: Mach3 Speed Setting Opposite
Post by: Davek0974 on September 23, 2016, 02:29:39 AM
Are the 0-10v lines from the VFD to the BOB the correct polarity from one end to the other?

You could also go into Motor Pulleys  and tick the "Reversed" box ;)
Title: Re: Mach3 Speed Setting Opposite
Post by: Highspeed1964 on September 23, 2016, 06:01:53 AM
I had this same issue when I was first setting up my spindle for Mach3 speed control (instead of panel control on the VFD).  I was running a PWM converter to run the 0-10V signal as my BOB did not have a 0-10V output directly.  I believe the BOBs that have that built in still work the same way so the following discussion will still apply.

Mach3 puts out pulses and these need to be converted to the analog voltage.  The way that is done is through PWM (Pulse Width Modulation).  How that works is that a digital signal is a series of pulses.  PWM changes the length of time a signal is High vs. how long it is low.  This is called duty cycle and a 50% duty cycle would have the highs and lows at an equal length.  A duty cycle of 20% would have the high on for 1/5 of the overall cycle time from one pulse to the next whereas 80% would have the pulse high for 4/5 of the overall time.  The PWM conversion circuitry basically "smooths out" these pulses to an average voltage level and that will be between 0 and 10V DC.  So a 20% duty cycle would result in a 2V DC output to the VFD.

HOWEVER, many of the BOB circuits utilize an active low signal so the logic gets reversed - 20% duty cycle results in a low pulse for 1/5 of the overall cycle time and so on.  To fix this, I had to set Mach3 to an active low setting on the step column for the spindle setting in port and pins; motors tab.  This essentially inverts the signal so that when it hits the PWM conversion circuitry the duty cycle is in the correct polarity.  (i.e. low duty cycle results in shorter positive pulses and vice-versa.)

So the first thing to try would be change the setting of your Spindle Step configuration in Ports and Pins configuration under the Motor Outputs tab.  If it has a green check, click it to change it to the red "X"; if it is a red "X" change it to a green check.  That should do the trick.

Stephen "Highspeed" Kruse
Title: Re: Mach3 Speed Setting Opposite
Post by: Davek0974 on September 23, 2016, 06:14:35 AM
Nice :)
Title: Re: Mach3 Speed Setting Opposite
Post by: DeanR181 on September 23, 2016, 05:05:56 PM
Thanks guys,  I tried the reverse pulley but this did not work.  Thanks also for the detailed explanation on how the PWM works.  This now makes sense to me.  Checking the active low as mentioned did the trick. Not sure why I missed this.
Title: Re: Mach3 Speed Setting Opposite
Post by: Highspeed1964 on September 23, 2016, 08:49:14 PM
That is awesome! Glad I could help. And it gave me a chance to share some knowledge as well. PWM is pretty cool stuff actually. It's used a lot in my other hobby - remote control helicopters. I was hoping it would make sense to you and it sounds like it does.

Enjoy making saw dust and I wish you much success.

Highspeed
Title: Re: Mach3 Speed Setting Opposite
Post by: Smartcore on November 17, 2019, 11:41:22 PM
I had this same issue when I was first setting up my spindle for Mach3 speed control (instead of panel control on the VFD).  I was running a PWM converter to run the 0-10V signal as my BOB did not have a 0-10V output directly.  I believe the BOBs that have that built in still work the same way so the following discussion will still apply.

Mach3 puts out pulses and these need to be converted to the analog voltage.  The way that is done is through PWM (Pulse Width Modulation).  How that works is that a digital signal is a series of pulses.  PWM changes the length of time a signal is High vs. how long it is low.  This is called duty cycle and a 50% duty cycle would have the highs and lows at an equal length.  A duty cycle of 20% would have the high on for 1/5 of the overall cycle time from one pulse to the next whereas 80% would have the pulse high for 4/5 of the overall time.  The PWM conversion circuitry basically "smooths out" these pulses to an average voltage level and that will be between 0 and 10V DC.  So a 20% duty cycle would result in a 2V DC output to the VFD.

HOWEVER, many of the BOB circuits utilize an active low signal so the logic gets reversed - 20% duty cycle results in a low pulse for 1/5 of the overall cycle time and so on.  To fix this, I had to set Mach3 to an active low setting on the step column for the spindle setting in port and pins; motors tab.  This essentially inverts the signal so that when it hits the PWM conversion circuitry the duty cycle is in the correct polarity.  (i.e. low duty cycle results in shorter positive pulses and vice-versa.)

So the first thing to try would be change the setting of your Spindle Step configuration in Ports and Pins configuration under the Motor Outputs tab.  If it has a green check, click it to change it to the red "X"; if it is a red "X" change it to a green check.  That should do the trick.

Stephen "Highspeed" Kruse

You sir I wish i could buy a beer for. I know its a dead topic but if you're still around. I screwed around getting no where for 7 hours today trying to get this to work with my setup.  One little checkmark..... anyways cheers!