Tuesday, January 8, 2008

PWM to Analog Update

After getting tired of trying to 'fine-tune' Mach3 to get it to control my spindle speed correctly, I gave up. I had some scrap populated boards on hand and I saw nice optocouplers on them (CNX82A). A quick check on the 'net shows that it should be fast enough for my use. I modified the original schematic to drive the output with 2 gates and reduced the RC resistor to half of the original value giving me a longer time constant. I guess, with original values, the VFD was draining my RC tank faster than it was charged.

Hooked it up to the parallel port and VFD and, guess what, it worked. With additional 20 minutes of fine tuning values in the VFD (max operating frequency & min output frequency), it worked flawlessly now. The VFD is now perfectly tracking Mach3 speed request (accuracy to about 0.1Hz!). The PWM frequency in Mach3 could be reduced from 200Hz previously to only 50Hz now. With current setting, my spindle speed control has a resolution of about 50rpm...

The new schematic below...

1 comment:

Luke said...

Hi,

Can you explain more about how this circuit works? In particular I don't really understand what the NAND gates are doing...

I've tried building this and it works, but the voltage output only swings from 1V-9.5V. Does the PWM frequency matter?

Thanks,
Luke