Shapeoko PWM to analog for VFD

I found an interesting part on Amazon that lets you convert the pulse width modulation signal from the Shapeoko controller to an analog voltage. I bought one and attached the 0 to 10 V output to my Huanyang variable frequency drive (spindle). It works although the actual RPM is different than the RPM. I used the MDI feature on the Shapeoko to enter some RPM values and looked at the RPM reading on the Huanyang display. From what I have read on various forums, a difference is to be expected. Some people suggested adjusting the PWM to analog converter so that a middle value is correct (example tune the converter to make 12000 RPM on the money). I chose to make a table of input value versus actual in a spreadsheet and then used a table driven interpolation calculation to compute the value needed to get the desired RPM.

Since the latest version of Carbide Motion (v5) allows you to turn the spindle on and off automatically, I can now run a job more easily. The other nice feature is the support for the new bit setter allowing multiple bits to be used within a single gcode file.

Here is the PWM to analog part ($9.80 at time of this post):

Amazon link

For your reference, the following gcode commands are used to start and stop the spindle, where a 10,000 RPM value is given with the start command:

m3 s10000

m5

Please note that I used a 15 V power supply based upon some online advice in order to insure a full 0 to 10 V range on the output.

Later on I found a switching relay power strip at OpenBuilds for $28. Since it only needs a voltage of 3V or above to control the switching, I decided to try it with a PWM to analog converter and, sure enough, it worked! Now both my dust control vacuum and the spindle are stopped and started automatically! The $38 combined cost beats the heck out of the $120 Carbide 3D is charging for the same functionality.

OpenBuilds link

I used a separate converter for the dust control vacuum as I wanted to keep the VFD frequency tuning separate from what is needed to start/stop the vacuum.

Lem, can you tell us more about your spindle?
Water or air cooled, speed range, noise?
It’s a cool move to have done this.

Mark’s spindle was the first I remember done locally … so quiet!

That PWM-to-Analog converter sure is cheap.
Can a better version convey the proper RPM values?
The table you made is a solution but it’s just more cool to display correctly.

Love the automatic spindle/vacuum control!
That’s the IOT strip we use for auto shutoff of the Prusa.
When the detector senses smoke it goes high and the printer stops.

Very interesting hacks, Lem … thanks for sharing them.

I have an 800W Huanyang water-cooled spindle. I chose this one because of the following reasons: I wanted a known manufacturer, 65mm diameter (fits into standard Shapeoko router holder) and the weight is not too much for the standard Shapeoko Z-axis slider.

It is very quiet relative to a normal router.

Technically, you can run the PWM output directly into the VFD controller if you set up the controller to accept a 5V signal rather than 10. I liked using the converter because it has a potentiometer for adjusting the output voltage up and down. The RPM inaccuracy would also be there with the direct connection.

I don’t know if another converter would do better. It would depend on where the problem is. For instance, it could be the Shapeoko PWM output or it could be the VFD itself. You would probably need multiple adjustments on a converter in order to fully dial in the desired result.

It would be great if a means of calibrating the RPM result was built into GRBL and/or Carbide Motion. Another option would be to put a low-end Arduino board between the converter and the VFD. The program to read the analog input, modify it and output an adjusted analog value should be pretty simple to write. It would be possible to completely replace the converter with an Arduino, though that would be more work.

–Lem

1 Like

Price for the spindle and controller?

I had to look up what the VFD was and how the RPM was known by the VFD… So I searched for Huanyang and for one with a 800W 2400RPM spindle.

This kit is by RATTM but when I look at the UI of the VFD, it looks identical to the one shown for the Huanyang VFD… The whole kit is ~$200 plus shipping.

A Huanyang labeled VFD is showing as $113 and I’ve not yet found a Huangyang 800W 2400RPM spindle.

I was able to find an easy way to get the displayed RPM to be much closer to input RPM. I used a tip from the Carbide forum which suggested setting $31 to 3000 ($31 is the minimum RPM setting in GRBL). Now my displayed RPM is quite close to the requested RPM (close enough for gov’t work).

Here is the link to the forum topic:https://community.carbide3d.com/t/vfd-parameters-huanyang-model/15459

Gerald was nice enough to point out the particular posting.This link has lots of info on setting up a Huanyang VFD to work with a Shapeoko.

1 Like