Sunday, May 26, 2013

Connecting Huanyang HY01D523B VFD speed controller to Mach3

Huanyang HY01D523B VFD
Few months ago I purchased Huanyang HY01D523B VFD and 1.5 KW water cooled spindle motor from eBay for my CNC router.  Recently I completed mechanical part and started final part, electrical. First of all I googled on the how to control spindle from software. Luckily there is a way not only to turn spindle on/off from Mach3, but control RPM and read actual PRM count back. This part a bit tricky as Huanyang VFDs aren’t implementing standard ModBus protocol, but uses their own, so is not directly supported by Mach3. But I found special plug-in which solves this issue, and I’ll back to software part later.

Connecting power lines

HY01D523B VFD could be powered from single on three-phase 220V/50Hz. I use single-phase power line, so I connected phase wire to R terminal of VFD, and null line to T; PE goes to E terminal.
Spindle is three-phase, and is connected to U, V, W terminals. If your spindle runs in wrong direction, just swap any two wires of the motor. For details please refer to VFD manual.

Hardware interface

To connect VFD to PC, you will need RS-485 adapter. There is few approaches, you may connect it via your RS-232 port with special adapter or purchase FT232RL based USB adapter on eBay. I decided to make my own adapter
as boards from eBay tends to be bulky, which is not suitable for me as I wanted to embed it inside VFD. I designed adapter in EAGLE CAD and ordered manufacturing of 3 blank boards. You may find EAGLE files in my BitBucket repo here.
Next step was to select proper differential bus transceiver chip. As I found on forums, not all line drivers works well with VFD. There was recommendations on Maxim chips, but nearby electronic parts dealer does have Maxim chips in their catalogue. I decided to try ST ST485CDR and National DS36F95. As it turned out, warnings on forums were true, and only ST485CDR from two above is compatible with VFD.
Thanks @laen for the the great prototyping service, I have USB-RS485 converters now. #diy #cnc #modbus #pcb #electronics

Connecting RS-485 bus to VFD

RS-485 is differential bus, and twisted pair wire is recommended as carrier media. I use pair of solid-core wires from UTP (Ethernet) cable plus one wire for ground. Connector pin closest to termination solder jumper SJ1 on my board is line A, next is B and third contact if connected to the ground via 27 Ohm resistor. A line should be connected to RS+ contact on VFD, B line to RS- accordingly. On one forum I found recommendation to wrap ground wire from adapter around signal lines, far end should be NOT connected to anywhere inside VFD. I did it exactly this way but not sure this is really required. For connection with VFD termination is not required, so SJ1 should be unconnected.
I strongly recommend to use good quality USB cable with ferrite beads as setup will be used in high currents environment and could be influenced by EMI.

VFD setup

Seller from whom I purchased my VFD advised first of all reset to factory settings and then define running frequencies. For my water cooled setup I have used following settings, in exactly same order:
  1. PD013 = 8 (reset to factory settings)
  2. PD005 = 400 (max frequency 400Hz)
  3. PD004 = 400 (base frequency 400Hz)
  4. PD003 = 400 (main frequency 400Hz)
  5. PD001 = 2 (set communication port as source of run commands)
  6. PD002 = 2 (set communication port as source of operating frequency)
  7. PD163 = 1 (slave address 1)
  8. PD164 = 1 (baud rate 9600 bps)
  9. PD165 = 3 (8N1 for RTU mode)
  10. PD006 = 2.5 (intermediate frequency 2.5Hz // from here and on settings are specific to my 1.5 KW spindle; refer to documentation of your motor and VFD for correct setup; incorrect settings could damage your VFD and motor)
  11. PD008 = 220 (max voltage 220V)
  12. PD009 = 15 (intermediate voltage 15V)
  13. PD010 = 8 (min voltage 8V)
  14. PD011 = 120 (frequency lower limit 120Hz, to limit lower RPM settings)
  15. PD014 = 5.0 (acceleration time, 5 seconds)
  16. PD015 = 0.8 (deceleration time; any more trips the VFD)
  17. PD025 = 1 (starting mode: frequency track)
  18. PD142 = 7 (max current 7 A)
  19. PD143 = 2 (specific to my 1.5 KW spindle: number of poles - 2)
  20. PD144 = 3000 (specific to my 1.5 KW spindle: multiplied by PD010 = 3000 * 8 = 24,000 RPM))
I get my settings for the motor from here. For air cooled spindle motors lowest running speed should be limited according to specs to avoid overheating. Some details on this in forum post here.

Software

Before running Mach3, I used “spindle talker” software to test setup (backup copy here). You may need VB6 runtime to execute program. In application you should go to Configuration and configure your COM port, port speed (9600) and parity (n,8,1). Then save and in Basic section you should be able to run/stop/control speed of spindle.
For Mach3 you will need separate plug-in (backup copy here). There is manual inside archive, please refer to it for settings should be done. Remember to restart Mach3 after changing port settings.
For linux software and settings you may refer to here.

Water cooling control

VFD has build-in relay to control auxiliary devices. By default relay triggers when motor is powered up. FA & FC terminals are normally closed and FA & FB are normally open. I connected 12V water pump for through FA-FB pair and cooling fluid is going through spindle when it is running.

Resistive brake

To allow VFD brake spindle to stop it faster in case of emergency stop, I added 300W, 100Ohm resistor between P and Pr terminals of the VFD. For details please refer to VFD manual, section XI for details.

11 comments:

  1. About resisitive brake, do you've had to change the configuration of the VDF? I have seen in the manual: "30: Braking Resistor Act: When the inverter is in running and the DC voltage Reaches the braking voltage the contact will act." for parameters PD050 to PD053. What parameter should I change these four, all or just some of them? Is there any parameter to change over?
    I found this resistance of 100 Ohms 300W, what do you think about?
    http://es.aliexpress.com/item/300W-100-ohm-Aluminum-Housed-Wire-Wound-Braking-Resistor-5-10pcs-Customizable-desired-resistance-custom-resistors/1104474615.html

    Have you connected the resistance outside the VDF? Have you had any problems so far?

    ReplyDelete
    Replies
    1. The only thing you need is to connect resistor, and it will act as brake without changing any settings.
      Proper resistor nominal for your specific VFD model you can find in the manual on the last pages. Good source for cheap resistors is uxcell.com

      Delete
  2. Hi, do you still have the two leftover adapter boards? I would like to purchase one. Thanks.

    ReplyDelete
    Replies
    1. Hi, please drop me e-mail on drug123@gmail.com

      Delete
  3. Hi. I really enjoyed my brief visit on your site and I’ll be sure to be back for more.
    Can you please consider placing my website on your link list?

    Please email me back.

    Thanks!
    Kevin
    kevincollins1012 gmail.com

    ReplyDelete
  4. PROBLEM please help
    i have 1.5kw water cooled spindle, i use this settings for inverter, install all OK. Mach 3 start and stop spindle but problem is because my spindle not start sloow speed up.
    If I make tool in g code and put speed 15000 rpm. My spindle just start 15000 rpm Immediately, no slow speed up. This is unusable because may damage my spindle or inverter.

    ReplyDelete
    Replies
    1. Problem resolved, I setup starting mode PD025=1 but I use mach3 V2.63 and it not have frequency track. I now set PD025=0 and it working great

      Delete
    2. Yes, that's right, thank you for your comment, PD025 should be 0 in most cases.

      Delete
  5. Thanks for this, I found it very helpful when getting my own spindle up and running.

    I've written my own application for controlling the spindle and put it plus the source on GitHub. I've referenced this page as a great starter on configuring the VFD, I hope you don't mind. Drop me a note if you'd like it removed or modified in any way.

    https://github.com/GilchristT/SpindleTalker2/releases

    ReplyDelete