View Full Version : PWM Settings

14-02-2017, 03:17 AM
This is my first post on this forum, sorry if I知 in the wrong section

I have built a 3 axes 4 motors new cnc all in aluminum with a Chinese VFD (1.5kw, 13A, 400Hz, 120VAC input) and a Chinese water cooled spindle (800W, 400Hz, 24000RPM). I知 using Mach3 and the Gecko G540 controller. All my settings are for PWM.

All is working fine but the only problem I have is with the spindle calibration. I have checked the VFD and on local control when I press the RUN it goes up to 400Hz, 24000 RPM, and the voltage on the VR(+10V) terminal is 9.88v. On the G540 the voltage on terminals 7&8 varies depending on the speed I ask.

I input on Mach3 M3S6000 and the VFD shows 11300 RPM / 188Hz, the volts on G540 T7/T8 = 2.42v
I input M3S12000 and the VFD shows 15398 RPM / 256Hz, 4.81v.

I have been playing with all the Mach3 settings for about 2 weeks now with no success. I don稚 want the VFD to be exactly on but right now the difference is way out.

Perhaps someone on this forum knows what I知 missing


14-02-2017, 09:45 PM
I have sometimes wondered how these things work at all. The Gecko output is a PWM signal. That is, a series of pulses that are on for some percentage of the time and off for the rest. The idea is that the average is equivalent to the desired speed. 10% on-time give 1V average; 50% on-time gives 5V average, and so on. The Gecko also has an opto-isolated "analogue" (actually, pulsed digital) output, which is a good thing. I get the impression that a lot of North American users use DC motors and associated controllers. The Geckos are probably going to work fine with a DC motor controller as the motor will average out the pulses. However, the area of uncertainty is with a VFD. This has an analogue input that is going to turn the analogue input voltage into the equivalent frequency and hence motor speed. But the VFD isn't seeing a constant input voltage, slowly changing as speed required changes. What it does see is sometimes a "high" voltage pulse, sometime a "low" voltage, changing between the two at maybe 1KHz, but never a real analogue input. I don't know if there is any smoothing being done anywhere to effectively convert the PWM signal into an analogue voltage. I know that this does work for other combinations of hardware (my IP/M works fine with a typical Chinese VFD and plenty of people use this kind of setup) but given that the target market for Gecko is possibly not primarily focused on the VFD user but the DC or similar motor controller user, I wonder if there is some kind of incompatibility here. Could be easily fixed, I would suspect, with a suitable capacitor across the analogue output to smooth the output pulses. Unfortunately, measuring the "analogue" voltage with a digital meter is likely to be equally misleading as the meter's sampling circuit is also going to get confused (but might well see something different to the VFD). A traditional analogue meter would show a better approximation.

Personally, and if you don't have an oscilloscope to actually see what's happening, then I would stick a 10uF capacitor across the analogue output to smooth the pulse stream and see what happens. Can't believe that it would do any harm but might help.

Or maybe it's something else completely. A Google search suggests that this can be a problematic area with the Gecko, but they aren't widely used in the UK/Europe based on typical machine descriptions on this forum. I'm assuming that you are taking +10V from the VFD to the Gecko?

john swift
14-02-2017, 11:46 PM
I saved this G540 VFD circuit from CNCZONE


if you add a 10uF capacitor I 'd connect the output terminal to 2 diodes to prevent the output being taken below the ground or above +10V supply terminals



14-02-2017, 11:57 PM
If that's what's inside the G540, then clearly there is an appropriate low-pass filter that should take out the worst of the ripple and leave a reasonably clean analogue output. In that case, the 10uF capacitor is not needed. And the OP's problem lies elsewhere...

john swift
15-02-2017, 12:03 AM
I expect the G540 PWM circuit was designed replace the 5K potentiometer speed control for the original speed control boards as used in the machines like my old machine mart CL300M lathe

see this post



the G540's PWM circuit was posted in a reply by Geckodrive
(Marcus Freimanis I think )

15-02-2017, 05:32 AM
As I told you on the Mach3 forum, you have Mach3 and the G540 working correctly.
The problem is that your VFD is giving you the wrong frequency.
2.42Volts on the analog input should be roughly 100Hz (96.8).

15-02-2017, 03:56 PM
.... I'm assuming that you are taking +10V from the VFD to the Gecko?

Yes I take the +10V (9.88v in my case) to the Gecko

15-02-2017, 03:58 PM
if you add a 10uF capacitor I 'd connect the output terminal to 2 diodes to prevent the output being taken below the ground or above +10V supply terminals 20820 John

John there are 3 diodes on your schematic. Should I use 3?

15-02-2017, 04:05 PM
....The problem is that your VFD is giving you the wrong frequency.
2.42Volts on the analog input should be roughly 100Hz (96.8).

Just to clarify the 2.42v is from the G540 terminals T7/T8 (ACM or ground & Vout). The VFD sends to G540 throught terminal +10V and ACM 9.88v

15-02-2017, 04:28 PM
Right, but the 2.42V goes back to the VFD, correct? The VFD uses that to set the frequency, and should be setting it at 96Hz.

15-02-2017, 04:57 PM
Correct. BTW Gerry I was told on Mach3 there is the "Calibrate Spindle" on the Functions Config menu. Is this any good for me to calibrate my spindle?

15-02-2017, 05:18 PM
You need an encoder on the spindle to calibrate it.

What kind of VFD do you have? You may be able to adjust the frequency to the voltage so that you get the correct RPM.

15-02-2017, 05:30 PM
My VFD is a Chinese model HY01DS11B as per attached pictures (3PH 110Vac, 50Hz, 1.5KW, 13A, 0.50-400.00Hz). So you are saying the Calibrate Spindle on Mach3 will do nothing for me?


15-02-2017, 05:38 PM
Calibrate spindle will do nothing, and if you try it, it make it worse

15-02-2017, 06:24 PM
if you add a 10uF capacitor I 'd connect the output terminal to 2 diodes to prevent the output being taken below the ground or above +10V supply terminals John

Sorry for the mistake on my previous post John. I have these capacitors
0.47uF 400v, 100uF 25v, 0.047uF 100v. Would any of these be suitable?

15-02-2017, 06:31 PM
I also found these
10mF 50VMP, IEC NP 4.7MFD 50V, IEC NP 16MFD 50V

15-02-2017, 06:44 PM
No, the Gecko output is already filtered so you do not need capacitors of any value. Looks like the output voltage of the Gecko is about right anyway for the speeds demanded so looks more like a VFD issue. My HY VFD works fine with reasonable linearity so maybe there are some other parameters that can affect this?

15-02-2017, 06:48 PM
Thanks Neale, I will check my VFD parameters again


15-02-2017, 07:59 PM
Hey Neale, if you have Mach3 with your VFD can you tell me what parameters you have on the Motor Tuning page for the spindle? I have: Stepsper=1, Velocity=120, Accel=4, Steppulse=2. Dirpulse=2. Some say these settings have no effect on PWM and some say the same but suggesting the Accel/Velocity should be about in the middle of the scale for each

16-02-2017, 09:11 AM
As I understand it, the g540 is basically just a breakout board and four stepper drivers in a single box. Mach3 does all the real work. I am using a CS Labs CSMIO-IP/M where a lot of the processing is off-loaded from Mach3 to the motion controller. Things like spindle control are also handled partly by Mach3 and part by the IP/M which has its own configuration parameters so I'm not sure that any of my system's settings would be relevant and might be misleading. All I can say is that the IP/M and the HY inverter do seem to play well together but I did have to follow the various manuals very carefully to get it all set up. The only thing I forgot to do was change the motor pole parameter in the VFD as the front panel display currently reads half the demanded speed but that's a trivial problem. In your case, there is a non-linearity between input voltage to VFD and VFD speed/frequency which is more puzzling.

16-02-2017, 12:33 PM
Thanks for your time Neale, much appreciated