View Full Version : Huanyang VFD control plugin for Mach3, USB RS-485

26-03-2013, 10:15 AM

I reciently picked up one of those Chinese 6040 routers you see on eBay. Worked right out of the box, very pleased! But didn't like the manual control of the spindle... Eventually, I found this gem:

mach3-plugin-for-huanyang-vfd/ (http://royaumedeole.fr/informatique/plugin-mach3-pour-vfdhuanyang/mach3-plugin-for-huanyang-vfd/)

I got a cheap RS-232 to RS-485 converter (about £3 from ebay) and wired it up with an old cut up usb cable (connected the shield only at the converter end. Installed the plugin and it worked! I can set the spindle speed in Mach3 and get a readout of what the actual speed is. The instructions on website are excelent, so I won't bother re-writing them here.

As I understand it, I can also add a custom readout to the Mach3 screen to show the current current being drawn by the spindle.

One gotch to look out for: Make sure the the Huanyang VFD's interface board board has the transevier populated. U4 I think. Mine did, so I was in luck and didn't have to solder one on.

Hope this helps someone out there.


Lee Roberts
26-03-2013, 08:24 PM
Thanks for posting this Jay, made it a sticky thread :).

Anyone looking for the USB RS485 485 converter / adapter here is a link to the best price i could find: USB-to-RS485-485-Converter-Adapter-ch340T-chip-Support-32-64-XP-Win7-Vista (http://www.ebay.co.uk/itm/USB-to-RS485-485-Converter-Adapter-ch340T-chip-Support-32-64-XP-Win7-Vista-/360615203160?pt=LH_DefaultDomain_0&hash=item53f6575158)

I'v also attached the plugin along with the usb driver.

Below is the plugin in action:



16-04-2013, 06:20 PM
Did you have any problems setting this up at all Jay?? Just tried it myself as I wanted to have spindle speed controlled by mach3, downloaded everything OK installed OK set up the plug in OK & got the message that it had been successfully configured but when I start mach3 things seem to start ok, machine moves, spindle starts & everything looks great but then I get an estop & it all stops.
Thought it might be a problem with one part of the gcode but it does it in a different place everytime so no consistency other than it bringing up the estop.

16-04-2013, 06:50 PM
Just to let you know i have one of these working on linux....still trying to get thinks working in linuxcnc though :-(

16-04-2013, 07:12 PM
This is brilliant guys, never even knew you could do that, I've ordered my usb to rs485 from the link Lee posted, now I play the waiting game...

16-04-2013, 07:18 PM
I've obviously done something wrong, just can't seem to find out what lol.
Other thing is that having set it all up I have closed mach3 down & re opened it a few times & each time I get the same wizard screen up asking me if I want to configure the plugin. If I accept I get the screen up for setting the com port & other bits. When I click ok I get a massage saying can't read value but if I click ok again I get the successfully installed message.

16-04-2013, 10:49 PM
Hmmm... I used an RS-232 to RS-485 converter, not a USB one. Wonder it this could make a difference? Will think about it.

Are you able to enter a target rate into Mach3 and then hit F5 and get the spindle to start and reach that rate?

17-04-2013, 01:27 AM
I've read about people having problems with usb to serial converters because of the 2 different chip sets used the FTDI chipset is suppose to be the one to use & that is what I have on another computerused, it is also set up as a virtual serial port & has never given me any problems.
Set this one up just the same way.

After starting mach3 & getting a couple of error messages I get the successfully installed message & can reset the stop button that flashes when mach3 opens.
Now if I just try to start the spindle there is a click & the estop starts flashing, tried reducing the speed but same thing just keeps happening.
If I load some gcode & start mach3 then the spindle starts, the machine moves to the correct starting position & then starts to cut the job, it then seems to just stop for no reason, the estop will be flashing & I need to reset it again. Doesn't happen on the same line of code everytime but it is always an estop condition, can't see anything on the diagnostic screen but then again I wouldn't know what I was looking for anyway lol.

17-04-2013, 08:10 AM

Because it works a little bit, it sounds like a noise issue on the signal lines. Usually RS-485 is quite immune to noise.

I used one of these from eBay:
RS-232 to RS-485 Adapter Interface Converter | eBay (http://www.ebay.co.uk/itm/RS-232-to-RS-485-Adapter-Interface-Converter-/200911189320?pt=UK_Computing_ComputerComponents_In terfaceCards&hash=item2ec73d7548)

I wired it with a shielded twisted pair cable, connecting the shield to earth ONLY at the PC's side.

Can you supply details on how your inverter is wired and connected to the computer?


17-04-2013, 10:22 AM
It's connected using one of these that I actually bought for something else a while ago Jay.

USB to RS485 Adapter Dongle Converter FTDI Chipset - EPOS, CCTV, Industrial | eBay (http://www.ebay.co.uk/itm/130875645398?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649)

Cable was a length of 0.5 CY cable that I had left over from wiring up the drivers. Shield wasn't run to ground at either end so will try running it to ground at computer end when I go up the unit today.

I just used bit's that I already had but if they are not suitable then I will happily go out & buy the right bits if it means it will work. The motherboard has a serial connection on it already so wouldn't be a problem to use that although it does drive my plotter at the moment.

18-04-2013, 01:00 AM
Had another look at the machine today, no warnings on start up now but still bringing up estop. I'm wondering if it could be some sort of interference as the indicated spindle speed in mach3 was all over the place but the spindle seemed to be running fairly consistently when running before stopping when the estop came up.
If it is interference then what can I do to fix the problem??

Spindle will now start some of the time & runs for a period of time, never more than a minute or 2 though & most of the time nowhere near that long.

John S
18-04-2013, 01:11 AM
Go Config > General config and in top right change the top debounce setting to 2000 then try that if it still barfs out go 4000
Don't worry about the high numbers they are in microseconds.
It makes it take longer before it polls for a fault.

18-04-2013, 07:44 AM
If it is interference then what can I do to fix the problem??

You could try:
1) make sure the shield of the RS485 cable is actually earthed by the checking the continuity of it to the PCs chassis
2) Ensure that the RS485 cable is not run near sources of interference, like the spindle cable. Especially avoid running the RS485 cable parallel to any other of these cables.
3) try a lower baud rate
4) reposition the USB to RS485 converter

Hope this helps! To suggest more, a photo or more detailed description of your wiring would be useful.


19-04-2013, 07:34 PM
Just a quick update on this as I have gone over everything again & also tried the converter that Jay had bought & uses.
Had all sorts of different messages depending if it was via the serial to 485 connection or the usb connection.
it will run run on the plugin on this thread but stops at some stage. On the original mach3 plug in that is available via the mach forum it starts the spindle, cuts the job, returns to zero but does not stop the spindle.
Actually got some work to do that I get paid for just now so this is going to have to wait. Just as well I haven't been asked for any work that I would need to use the router for lol.

10-05-2013, 08:09 PM
Hi Guys,

The first post about this plugin intrigued me so I ordered the usb to rs-485 converter and waited 2 weeks for it to come... I've finally got around to testing the setup today and I'm experiencing a similar problem to Martin. I've installed the usb to rs-485 converter and that seems to be ok. The plugin config screen is working and states that communication with the vfd has been established and pulls the max spindle speed and frequency to display them in the splash screen, so I can be sure that a connection has been made. I then try and fire the spindle up and I get a click from the vfd then mach3 is put into emergency stop situation. I've tried running from an M03 command via the MDI screen and the same happens. I've not tested with any gcode because I don't have any that I know works (not finished my machine build yet).

I have tried with the spindle wired to the vfd and without. I've tried with an old serial cable with the shield grounded to my pc case. I'll maybe try and find a bit of twisted pair cable like Jay said, see if thats any different. As for the parameters, I've done exactly as the ones provided by the guy who compiled the plugin. Oh, and I've also tried with the baud rate reduced to 4800...

Any other pointers would be helpful as I'm starting to wonder how reliable this method is going to be if its that sensitive to noise...

10-05-2013, 08:30 PM
Im not sure why its not working, sorry. However, The comments from the author might help.


I just read them over again and remembered this setting that needed to be changed:

"In Mach3 under Ports & Pins -> Spindle Setup ensure Disable Spindle Relays is unchecked under « Relay Control »Restart Mach3."

If that doesn't help, the author of the plug in might be able to assist. Once it works, it really is great. Good luck!


10-05-2013, 09:28 PM
Hi Jay,

Thanks for your fast reply! I've actually had a bit of a breakthrough... I think a combination of things were holding me back, but the noticeable one was to do with the monitoring section of the plugin configuration screen. The author of the page you provided the link to suggested that you could monitor a certain status from the vfd, have it displayed in a dro and set and estop threshold of a given unit. Following his advice I set a value for the estop threshold for one of the drop down options and forgot about it, it wasn't until I checked every single option that I found my mistake.

The vfd now tries to run without the spindle connected. However, when I did connect the spindle the vfd throws a fault of open connection and forces an estop condition, which is actually damn clever :) I think perhaps a connection has come loose on the crappy chinese spindle plug / socket. More investigation is required, but I'm chuffed that the plugin is working enough for me to get this far. Hopefully it'll play ball when I put it through more testing soon

Thanks for your help!

15-05-2013, 07:03 PM
Had another look at the weekend & still have a problem with the plugin tripping mach3 as soon as I try to start the spindle.
The other plugin that is on the mach3 forum is a bit strange as well. If I start mach3 from scratch & press the spindle start there is a click & the button flashes yellow but the spindle doesn't start. If I load some gcode & run it the spindle starts, runs & stops as it should. If I then try pressing the spindle start button again the spindle starts & I can also change the speed, pressing the button again stops the spindle as it should, can do that all day long until I shut mach3 down. When I start it up again we are back to not being able to start the spindle until I have run some code.
Not really a problem as it seems to work ok when cutting anything but just seems a bit strange.

15-05-2013, 07:28 PM
Hi Martin,

Please forgive my ignorance, but have you set a target spindle speed in the dro before pressing the spindle start button? I was playing around with it for a good hour before I realised I hadn't set a speed, lol! That and what really made a difference was to reset the vfd to factory settings then enter all your parameters fresh, I think there is a certain order it likes it to be done in, I found some instructions that said that and it worked for me anyway. I was ready to throw the damn thing out of the window before I managed to get it going, then its the best thing ever :) Just in case you are experiencing any problems with interference, I used an old serial cable that was shielded, just used 2 cores and grounded the shield to my pc case. Worked very well for testing purposes. My machine isn't to a stage where I can tests its reliability for cutting yet though.

I wish you the best of luck with getting it fully working.

15-05-2013, 08:00 PM
Sure it must be down to something I have done or haven't done lol but at the moment it's finding the time to sit down & work through problems. Machine works fine with the other plugin for cutting so there is no immediate rush. Think I will take your advice at some point though & start from scratch again, will reset the VFD to factory settings so I know where I am going & re enter all the values I need to change. Don't think it's an interference problem as the VFD must be communicating with the other plugin. Did originally use a bit of cy cable to connect but replaced that with a bit of shielded twisted pair after reading Jays comments.