Saturday, 13 May 2017

Mach3 and UCCNC spindle control with RS485 - Episodes 147 & 148

2 videos this week  covering how to install an RS485 adapter to your PC and tehn control your spindle. I split it into 2 seperate videos so that viewers can watch the relevant version without the distraction of irrelevant information relating to another control system. It should make viewing easier.
Whether you are intersted in Mach3 or UCCNC just watch the appropiate video for your control software. Even if you don't run these control systems watching will give an insight into what RS485 is and how it is used.





MACH3 - episode 147



The plugin used is available from this website.
http://royaumedeole.fr/informatique/plugin-mach3-pour-vfdhuanyang/mach3-plugin-for-huanyang-vfd/

It has most of the information required to make the plug in work but please watch the video to the end as there is an extra step I did to make the plugin work which is not mentioned in the documentation. Without it the plugin won't work.

This is quite an old plugin and it should be very stable.



 Click to play Video





 UCCNC - episode 148

 The plugin for UCCNC has been under development for a little while but the latest version was released only a few days ago. A big thank you to Dan911 for all the hard work he has put into developing this plugin and also the help he gave me in tracking down a problem with the adapter I had. (more on that below)
The development thread for the plugin can be seen here.
http://www.cnczone.com/forums/uccnc-control-software/321354-huanyang-vfd-macro-plugin.html

The actual plugin I used in this video, HY10, is located here
http://www.cnczone.com/forums/uccnc-control-software/321354-huanyang-vfd-macro-plugin-7.html#post2043538 

Subscribe to the development thread for new plugin versions as they are released.

Current UCCNC Plugin


The plugin file contains a text document giving instruction on changes you needed to make to the VFD configuration as well as UCCNC.

 Click to play video




Wiring Diagram

The wiring for this couldn't be simpler
It requires only 2 wires and these need to be a twisted pair. Feel free to use a screened cable but make sure there are 2 wires in the cable and use them for communication. Ground the shield at the VFD end only and do not connect the other end of the shield.

Click to enlargen


VFD Programming

For both Mach3 and UCCNC the VFD programming was the same.
Here are the settings I changed. It is not complete programming for the VFD but simply the changes needed to bring it under RS485 control. It assumes an already working spindle

PD001          2           Enable RS485
PD002          2           Enable RS485
PD004          400       Spindle frequency from spindle name plate
PD023          1           Disable reverse rotation of spindle
PD163          1           VFD Address
PD164          1           Baudrate 9600
PD165          3           8bit, No parity, 1 Stopbit,  RTU


RS485 adapters

I had a bit of trouble with the first adapter I purchased with it failing to change the speed of the VFD intermittently and seemed to run slow on startup with the UCCNC plugin.

When i got the new one I opened up both RS485 adapters and I noticed 2 things about the first adapter I have purchased.
1st the metal case of the USB plug was not soldered to the circuit board. Not a problem as far as the operation of the adapter goes but mechanically it will cause premature failure of the device as it puts strain on the USB connectors pins. It also gives a clue as to the quality of the build.
2nd I noticed that the USB to serial IC is unlabeled and it is not because the name has been scratched off as is sometimes done to hide a critical IC's identity.
I suspect it is a copy of the Prolific 2303 chip and was not working correctly with the drivers.
The utility on the prolific website identified it as a PL 2303 series chip so maybe it is genuine but I find it hard to believe they wouldn't put their name on it. This IC is also a well known target of counterfiet though the Prolific drivers aren't meant to work with it at all.

The FDTI chipset maker is also a target for chipset copying and thier latest drivers won't work with a counterfiet chipset.


The Prolific Adapter
 




The CH340 adapter is a better build quality and the USB to serial IC is labelled
           




Both use the Max485 line driver IC for output to the VFD which converts RS232 to RS485.


I don't know if the adapter is counterfiet,faulty or something else but it may be safer to use an adapter with a CH340 chipset as these don't seem to be copied by anyone and so the drivers should work with the plugins. The prolific and Ch340 adapters look the same and cost the same so its a toss up which one to get. The Le royaume d'éole plugin documentation uses the prolific version of the adapter so either should work ok.

   Download Adapter Drivers

If you are looking for an adapter try the link below. By purchasing a product using the link provided, you help support my channel. The link will take you to search results for the RS485 adapters and you can select the type you want to use.



 You are not restricted to the type or style of adapter shown here but if you are in anyway unsure of what to buy then get one that the same as shown it the video. at about $2 to $3 delivered you can't go far wrong though it is an inconvenience having to wait for it to be delivered. 









40 comments:

  1. Peter,
    would you post the list that you were working from? i bought one of these a year ago, but couldn't get it to work.
    Thanks
    Ray

    ReplyDelete
    Replies
    1. Hi Ray
      I have updated the page and added the wiring diagram and the setting changes needed to the VFD.

      Delete
  2. Dear Peter,
    1st, thansk for all this, great info as I'm on the lookou to swap my PC7518 to a Huanyang VFD W-3 or 4Kw spindle !
    Anyway, I'm writting to you as it seem you link to buy this "better" The CH340 adapter is not leeding me to it ?!?
    It's leeding to Ebay for zillion other "cheepo" type !
    May I ask where you bought your or a link.....fo I may to help support my channel.
    Cheers, Robert

    ReplyDelete
    Replies
    1. Hi Robert,
      I ended up buying mine from a New Zealand based auction site like Ebay because I wanted to get on with the job It has the CH340G chipset in it and I suspect that the seller bought them off Ebay in the first place for resale in this country.
      Pretty much all the adapters should work but the closest I found is the one below which uses the same CH340G chipset but is lightly different circuit board. It might be a more updated circuit.
      They are all cheap adapters at less than $2USD delivered.

      Cheers
      Peter

      https://www.ebay.com/itm/CH340G-Chip-USB-to-RS485-485-Converter-Adapter-For-Win7-Linux-XP-Vista-top-M94/351494358967?epid=1845944673&hash=item51d6b247b7:g:dCUAAOSwpDdVTtMT

      Delete
    2. Dear Peter,
      thanks for your time to this reply, much appreciated !
      Keep on....smiling ;0) !
      Cheers, Robert

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. the cable for the adapter RS485 must be parallel normal or twisted.
    Thanks you-

    ReplyDelete
  5. Do you think this same setup can be used on ShopBot spindle controllers? I'm needing to replace my USB RS485, the current model is over $100 on Amazon, seems this might offer a more affordable solution.

    ReplyDelete
    Replies
    1. Hi Joel,
      I'm not familiar with the Shopbot so can't really say.
      What I do know is that RS485 is a protocol standard so to output should be the same on any device. There are 2 types of the adapter. One has 4 wires and the other has 2 wires like I used. Assuming you are using either Mach3 or UCCNC then they don't care what adapter you use so long as they can can find it. More than that I can't really say. I am curious what a $100 USB Rs485 adapter looks like. Do you have a link? You might not be able to post it here so you can email me cncnutz65@gmail.com
      Cheers
      Peter

      Delete
    2. Hi Peter,
      Thanks for the response. The spindle I have is a 1.7kw Yaskawa Drive spindle. The USB-rs485 device that came with the machine is a Delta - IFD6500 USB/RS-485 Communication Converter. I think my device works but my 2-conductor shielded wire is missing and i can't determine which pins are used on the RJ45 jack that goes into the IFD6500.

      Delete
    3. https://www.amazon.com/gp/product/B01LWQI058/ref=ox_sc_sfl_title_3?ie=UTF8&psc=1&smid=ARJVYBXI8H8Y7

      Delete
  6. Hello could you help me please i want to get this to control my 3020T cnc spindle speed with mach3 , im clueless with electronics .Where would i connect the 2 wires on in my control box .Ive added a video of my control box on youtube below.

    https://www.youtube.com/watch?v=QmMOmhNNGQI&t=142s

    ReplyDelete
  7. Hello i left that comment above , connecting the usb rs485 to my control box.Can i just follow the speed dial knob wires and disconnect those and add the usb wires to where they were .Would make it simple for me .Look forward to your reply as this would really help me .thanks

    ReplyDelete
  8. Hi,
    I have watch the video and finally found the spindle controller which is the top power supply unit in your box if i am not mistaken. This unit is not a VFD and this viseo only covers the Huanyang VFD units. The spindle on your machine, I am guessing because you didn't show it, is a DC motor with a collet adapter on it. Similar to the spindle the Jerry used here https://www.youtube.com/watch?v=Dt_bgzU-9sI
    This type of motor cannot be connected to an RS485 adapter.
    For this type of setup you need to use PWM (Pulse Width Modulation)to control speed and a relay to turn it on and off. It doesn't look like your breakout board has provision for either of these so you will need to add your own. Unfortunately I cannot offer you more help than this as I am not familiar with your machine or its control system. If you are not confident with electronics and do not understand exactly what you are doing then it would be wise to avoid an upgrade of this nature until you find someone local who can help you with this.
    The closest video to what you want to do that I have is this one
    https://www.youtube.com/watch?v=Xd3K47Iuwv8&feature=youtu.be
    Other than the programming in Mach3 nothing else will apply to your setup thought the principle is the same. You Spindle has no programming unlike the VFD unit i have.
    Sorry that I can't help any more than this.
    Cheers
    Peter

    ReplyDelete
    Replies
    1. Thank you so much , i was thinking this also .Its just basic .But its fine for me as first machine .Do you know that dial back box you showed in that video you recommended , whats that black box which shows the spindle rpm ( sorry im new ) .Also would love to know how much you would charge to build this whole box so i can connect to my spindle , as in the future i would be buying a bigger spindle.thanks for all you help to

      Delete
    2. The box that has the spindle speed showing on it is a VFD drive and will not work with your spindle. The VDF drive is for 3 phase motors while your spindle is a DC motor. You buy the VFD and spindle as a matching set. Unless you are upgrading your machine to something bigger I seriously doubt that the machine could handle a full sized spindle which will be much larger and 3 to 4 times heavier than what you currently have. I'm not trying to discourage you and the best way to learn is to do. I encourage you to persue your upgrade with the help of someone local especially the spindle on / off which would be the easiest to do and the most useful.
      The problem is I am not in a position to assist with your desired upgrade. A pity really because I think I would enjoy doing it as a hands on project if you lived locally just for the fun of it. Trying to do this remotely would be a disaster.
      As for building an entire control system, I do not do that so can't give you a price.
      Best of luck
      Cheers
      Peter

      Delete
    3. Okay thanks again . Just one last question , am i right in thinking this cnc on ebay below with both usb and parallel port connection.Uses the parallel port for the x y z axis and the usb connection is just the RS485 added to control the spindle on off speed. thanks

      https://www.ebay.co.uk/itm/USB-CNC-ROUTER-ENGRAVER-ENGRAVING-CUTTER-3-AXIS-3040T-MILLING-230W-3D-CUTTER/192034334404?hash=item2cb62366c4:g:hXQAAOSwsXFZNkfF

      Delete
  9. No
    The USB port is a replacement for the Parallel port but it may not work with Mach3. You would need to check with the supplier if the USB port will work with Mach3 and if there is a USB driver for it. It is definately not for RS485 as that is used for VFD drives with 3 phase spindles. The Mach3 RS485 driver I show in the video will only work with a specific range of Huanyang VFD drives which uses a non standard version of communication. The spindle on the machine on Ebay is the same as yours and is a simple DC motor. I watched a quite few videos of people with the 3040 machine and they all manually turn on and adjust the speed so it doesn't look like it is automatic. You will need to ask the seller the capabilities of the machine and its control software but my opinion is that it will be manual like your current machine.

    That said it mentions "Control unit:triaxial one-piece drive + ring variable power + PWM speed"
    in the specs but I suspect it simply means it uses PWM to control speed and it is done via the speed knob on the front of the unit like your current one. I also suspect that the word
    triaxial in the description is made up by Google Translate. What a Ring Variable Pawer Supply is is nyones guess.

    It also mentions "Acceptable software:only CNCUSB"
    From what I can tell CNCUSB is a software controller package like Mach3 only more basic so maybe it needs to use this software with the USB port. Again you will need to ask the seller.
    https://www.youtube.com/watch?v=EuBt6FOlfmk shows the CNCUSB software.

    The problem with Spec's written in Chinglish is they can mean almost anything. The 6040 machine is very common and it looks like there are many versions of the machine and control box so what you get is anyones guess.

    I really believe this to be a larger version of what you already have with all manual control.
    That is my best guess as far as this machine goes.

    Cheers
    Peter


    If you would like to support my channel please consider using the affiliate link below to enter Ebay when you make a purchase. I will receive a small commission on any purchase you make at no cost to you. The link simply takes you to the main Ebay page from where you can browse and any purchase as normal.
    http://ebay.to/2HllO3g


    ReplyDelete
  10. Sorry to be a pain , ive found another says it has a vfd . Do you know if that would work with the USB RS485 , using your video as a guide to connect the 2 wires and setting up with mach3 .thanks sorry about this

    https://www.ebay.co.uk/itm/3-Axis-Desktop-CNC-Router-Engraver-Milling-Machine-Engraving-Drilling-6040-TOP/162520194666?epid=890290111&hash=item25d6f55e6a:g:ne0AAOSwi0xaNJXX

    ReplyDelete
    Replies
    1. Hi,
      The VFD shown in the Ebay link is a Huanyang VFD and will work with RS485 on Mach3. It is one of the VFD units I considered when I upgraded my machine but I dicided to go for a bigger spindle.

      The description mentions "(PWM stepless speed regulation)" so maybe it is already setup with speed control.

      It also mentions "3-axis control box with the power supply + spindle speed regulator" which would imply that speed regulation is built into the control box. Since the box has no speed knob on it I would assume they are using PWM to achieve this. With configuration changes to the VFD it could be made use RS485 as shown in my video though if it already has speed control I wouldn't bother changing it. For what it is worth I chose to use PWM on my machine rather than RS485 and it works just as well.

      I hope this helps
      Cheers
      Peter

      I didn't realize you lived in Europe when I mentioned the Affiliate link in my previous post so it probably wouldn't work for you as it is for the USA Ebay site. I live in New Zealand so I use the USA site. Here is one for Ebay UK if you wish to support my channel at no cost to yourself but no problem if you would rather not.
      http://ebay.to/2puagmY

      Delete
  11. Thanks for all you help you can delete chat if you like , as took up lot of room.Im moving house soon so after moved and when i buy bigger cnc i will help and donate to you on your link .And also if any issues will it be okay to donate also for help thanks bye

    ReplyDelete
    Replies
    1. I am always happy to help where i can and donation is not necessary though it is appreciated. The easiest way to contact me is through email using the contact form on the website.
      Hope the move goes well for you.
      Cheers
      Peter

      Delete
  12. Sorry to bother you again ive been doing a lot a research and found out that my cnc i have got from ebay link below

    https://www.ebay.co.uk/itm/3-AXIS-CNC-3020T-Router-Engraver-Engraving-Drilling-Milling-Machine-3D-CUTTER-DE/132518821283?hash=item1edabcbda3:g:a3sAAOSw-RhadSDa

    says it has '' PWM stepless speed regulation'' . All 3 axis work fine and i can switch on manually the spindle and turn manual the dial.I ve contacted the seller and they they the setting are correct but cannot get the PWM speed and on off in mach3 .Any idea would be grateful , or any idea to maybe manually find all the correct ports and pin .Because i just think the spindle settings are wrong.

    ReplyDelete
    Replies
    1. While I believe the spindle is PWM ontrolled as it is the only efficient way of regulating it's speed I don't think that the spindle is under the control of Mach3 or that there is any provision for it.
      Trace all the wires running from the spindle power supply to the board that connects to the Mach3 parallel port. I would expect 5 wires. 3 for the PWM control though it might be done with 2 at a pinch and 2 from the relay in the break out board to the Spindle ower supply.
      the spindle power supply / control will have the spindle wires going to it as well as the spindle on / off switch and the variable resistor for setting the speed on the front panel.
      you will need to photogragh it so I can see where the wires are going and email the photos to me. Email it to cncnutz65@gmail.com
      Cheers
      Peter

      Delete
  13. This comment has been removed by the author.

    ReplyDelete
  14. good morning:
    congratulations for the tutorial.
    I own a cnc 6040 of the Chinese ones for sale on ebay with nowforer inverter,
    I'd also like to run the mach3 spindle with rs 485 but I do not know where to put my hands in the inverter. Could it help me? the rs module with ch340 arduino is there or already at home.
    thank you

    ReplyDelete
  15. this is the manual of the inverter I have already looked inside and has the rs + and rs- attacks
    file: /// C: /Users/vitto_000/Downloads/NOWFOREVER%20MANUAL%20E-100.pdf

    ReplyDelete
    Replies
    1. Hi Franco

      The Manual you linked to is on your PC but assuming it is an E100 I downloaded the manual and on page 19 it says that modbus used +485 and -485 terminals
      The phot below shows the terminals are on the top row 6 & 7th from the left if yours is the same.

      https://www.cnczone.com/forums/attachment.php?attachmentid=227564&d=1394347077



      Check out the website below. It gives a detailed description of how to connect your E100 VFD to Mach3
      http://www.ubit-rc.de/en/modbus.php

      This is the best I can do to help as I do not have an E100.

      Cheers
      Peter

      Delete
  16. Peter
    I have the exact setup you have, except for the water cooled spindle.
    I just got it working with the rs485 usb adapter. It turns on and adjust speed fine.
    my problem is if I shut down mach3 I loode the speed settings & I have to go back into
    MDI and put in s10000 again. Any idead what I'm missing ?

    ReplyDelete
  17. Hi,
    The setup is behaving the same as mine. The first time you use the spindle after turning it off you have to give it a speed before it will work. The same happens when using PWM as well. This isn't a problem if you are runnig a Gcode file as it should have the S10000 in it but it is a pain if you are trying to do something manual.
    I did have a look to see if there was a solution but I haven't come up with one yet.
    It is probably a safety thing to stop the spindle starting when it is turned on.
    Cheers
    Peter

    ReplyDelete
  18. Hi Peter,

    I just got my spindle running on the RS485 adaptor and your video did the trick making it easy. Also, people who sell thus don’t give you the driver or tell you where to get it. Thanks for all your help. One issue I have is that I can only get 22,100 rpms out of me HY running it with the adapter. When I run just the VFD, I get the full 24,000 rpms. Any thoughts or suggestions on this?
    Marty

    ReplyDelete
  19. HI THANKS FOR THE VIDEO AND DRIVER LINKS.
    i DO HAVE AN ISSUE WHEN STARTING MACH3 AN ERROR SCREEN POPS UP DEFECTIVE VFD PLUGIN, BUT SPINDLE TURNS. THE ISSUE IS WHEN RUNNING IN MDI SCREEN WITH ARROW KEYS SPINDLE RUN AT VERIOUS SPEEDS. SO WHEN I START AT 10000 RPM AND GO UP FROM THERE IT WILL GO THROUGH 11000, 12000,AND SO ON BUT THEN WILL DROP RPMS BACK TO A LOWER RPM WHILE SILL PUSH UP ARROW.
    WHAT I AM TRYING TO SAY IS THE RPMS DO NOT GO UP SEQUENTIALLY. ANY IDEAS?

    ReplyDelete
  20. Hello All,

    On the website of the developer of the plugin he has some errors listed and i am reviving one, the error i get is (unable to read value) i have done what he describes to do and i continue to get the same error.


    I am using the HY VFD with a 2.2KW spindle.
    I have set all the vfd settings as directed.
    It is a working state prior to giving this set up a go.


    something i noticed is i purchused the CH340T chip and not the 340G.
    Will this cause communication issues? like the issue i am having.

    I purchased the CH340T adapter of amazon for $6.99 not ebay. link below. I figured the extra 4 bucks is worth not having to wait weeks on in.

    https://www.amazon.com/JBtek-Converter-Adapter-ch340T-Supported/dp/B00NKAJGZM/ref=sr_1_3?ie=UTF8&qid=1545578591&sr=8-3&keywords=JBtek+USB+to+RS485+Converter

    The one that comes from china and the one CNC NUTS is using is this G version not the T. I did a little digging and it appears the T version chip might be configured a little different so this is why i ask.

    My computer reads the chip just fine, it shows as COM4. But when i go to configure the plug in in mach it gives me the error unable to read values.


    One thing i do not currently have is the shielded twisted cable. Would this have effect on establishing communication between VFD and mach? I did use a drill and twisted two wires together, i am not sure if that qualifys as a twisted pair or not. I have shielded twisted pair wire on order.

    Any Help on this would be greatly appreciated

    ReplyDelete
    Replies
    1. Many people use the T version adapter so no problem there. Twisting the wire should be fine but shielded won't hurt. Have you tried spindle talker to test the adapter and VFD. That will test the setup and help diagnose the problem.

      https://youtu.be/6KRS7R8FeJ8

      Cheers
      Peter

      Delete
  21. Hello Peter
    Thank you for the thorough explanation on your video.
    I have a Huanyang VFD 1.5kw, did all settings as per your indications and works perfectly.
    Just wondering can I go lower than 6000 rpm on the min ???? How about 100 or 200??
    Thank you!

    ReplyDelete
  22. Hey there. I know your are using a HY Vfd but for my spindle I have a ENC Vfd which I believe is pretty much the same as the HY. Any ideas If this will work with it?

    ReplyDelete
    Replies
    1. The HY VFD does not use standard MODBUS protocol so the plugin will probably not work for your VFD unless they use the same flavour of MODBUS. That said the adpter costs about $2 on EBAY if your happy to wait, so what have you got to loose? There may also be other plugins that will support your VFD.
      Cheers
      Peter

      Delete
  23. Hello,
    Have you heard of this same set up but for mach4?
    Thanks for the info?

    ReplyDelete
  24. Hola tengo un vfd YL620-A quisiera saber si este complemento funciona para ese vfd.

    ReplyDelete