Huanyang VFD RS485 / Modbus

Page 1 of 7 1234 ... LastLast
Results 1 to 20 of 129

Thread: Huanyang VFD RS485 / Modbus

  1. #1
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default Huanyang VFD RS485 / Modbus

    I recently received my Huanyang VFD from linearmotionbearings2008 and was quite impressed with the quality of the drive compared to the first Xin Ye drive which went bang.

    I am trying to get the RS485 / Modbus communications going and up to now have not had a lot of success.

    VFD Settings:
    PD001 = 2 (run commands to comm port)
    PD002 = 2 (operating freq to comm port)
    PD163 = 1 (slave address 1)
    PD164 = 1 (baud rate to 9600 b/s)
    PD165 = 3 (8N1 for RTU mode)

    Hardware:
    USB to RS232 / RS485 converter

    The RS485 converter has four terminatls Vcc, GRD, A and B. I have connected the A and B terminals to RS-, RS+ respectively. I was not certain about the ground requirements and left this unconnected to start.

    My first attempt was to use Spindle Talker, which gave some run time errors even with the VB6 runtime libraries installed.

    I have Realterm Software with the additional spy functionality so was able to monitor the serial data on the port. Spindle Talker did not seem to send the full string, just the first three sets of data.

    So, I am now using Realterm and manually entering the command string.

    The comms seem to be working as I get a 00 response from the drive when sending data, and odd data when turning the drive on and off. However when I send a data string such as 01 02 03 00 0B B8 7F 0C I still get a 00 response??

    I'm hoping that someone who has got the comms working can double check my setting and maybe give me some pointers.

    Thanks in advance

    Scott

    Similar Threads:
    Last edited by scotta; 10-20-2009 at 08:07 PM.


  2. #2
    Member
    Join Date
    Dec 2004
    Location
    usa
    Posts
    1865
    Downloads
    0
    Uploads
    0

    Default

    It is possible that this drive is not fully Modbus compliant. Peter Homman is the guru of Modbus and may be able to help.
    Mike

    Warning: DIY CNC may cause extreme hair loss due to you pulling your hair out.


  3. #3
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0

    Default

    Modbus should only require 2 wires. You do need to make sure you have "+" and "-" connected properly on both sides. Unfortunately, without more documentation, it is impossible to determine whether "A" is "+" or not. Having the wires reversed will invert the data, and communication will not work. If you don't know for certain how "A" and "B" match with "+" and "-", you could reverse the wires and see if you get something more reasonable.

    I use the program Modscan to troubleshoot Modbus stuff. I think you can still download it here:

    http://www.win-tech.com/html/modbus.htm#MODSCAN

    It is an ancient program and the free version is time limited, but it will allow you to poll some registers and see if you are getting reasonable data.

    RTU is time sensitive, so you really can't type it in manually. Data packets can be variable length, so the protocol uses silence on the line to determine when a packet is complete. I'm not sure if you are typing things byte by byte in Realterm, but that won't work. Using something like Modscan will compile the packet with the proper CRC and timing and send it out on the line.



  4. #4
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Thanks for the relpys, I have confirmed that A and B go to RS- and RS+ as when swapped I get no response from the drive at all, all is silent.

    I'm using Realterm to send out the full data string (pre entered) and the data that I am sending is what is published in the manual and what others have been talking to the drive.

    Thanks for the link to the Modscan, I'll give it a go.

    Thanks

    Scott



  5. #5
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default Success!!!

    I have been banging my head against a brick wall with this for the last week or so, have done a lot of googling and learnt a hell of a lot about RS485 and modbus at the same time.

    And a big lesson learned - don't beleive everything you read! Make you own measurements and checks.

    Today was the turning point when I borrowed a USB osilloscope and actually started seeing the data transmission. And the simple solution - SWAP TWO WIRES!!!

    The labelling of the RS- and RS+ terminals on the drive and the A and B terminals on the USB converter are not as expected.

    Matching the potential of the terminals (relative to ground) was the key, ignoring the labelling. A [+5V] --> RS+ [+5V], B [0V] --> RS- [0V] and Ground -> ACM. The comms still work with the 120ohm termination resistor as well. And SpindleTalker also works as it is no longer receiving the 00 response (which was not coming out of the drive but the converter itself)

    Attached Thumbnails Attached Thumbnails Huanyang VFD RS485 / Modbus-huanyang-modbus-jpg  
    Last edited by scotta; 10-27-2009 at 03:44 AM. Reason: spelling


  6. #6
    Registered
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    267
    Downloads
    0
    Uploads
    0

    Default

    Scott are you going to be driving this from Mach3? Will you be able to drive it directly or require some layer of software in between?



  7. #7
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    I'm a linux guy, so will be using EMC2. This will be the next step but with the non-standard function codes of the VFD this will be a challenge...


    Scott



  8. #8
    Registered
    Join Date
    Jun 2005
    Location
    norway
    Posts
    55
    Downloads
    0
    Uploads
    0

    Default

    Scotta, any luck getting it to work?



  9. #9
    Registered
    Join Date
    Sep 2005
    Location
    nl
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default

    any news jet??



  10. #10
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    I think the Huanyang engineers were off drinking coffee when the Modbus standard was being handed around. Anyhow, I have been doing heaps of research on how to drive the VFD with EMC2.

    I started with ClassicLadder but due to the non standard function codes and data length descriptor this was going to be a lot of work. A big thanks to Jayson from the Mechmate forum who sent me his working ClassicLadder binary. My main problem with modifing the ClassicLadder was that if a compliant Modbus device was also to be used on the same system then the ClassicLadder modbus routines would be so twisted that it would make it unusable.

    The solution that I am now progressing is to make a user space hal component. This is slow progress as I work for myself and the day to day hum drum of making money to live gets in the way. To date I have a hal component that loads and exposes the VFD control and status registers as pins.

    As far as the modbus side goes, I started with the latest version libmodbus and attempted a hack, the only drama being is that libmodbus has been so well developed to be Modbus Standard compliant is that is is pretty locked up with only a few publically accessable routines to connect to.

    I went digging and found libmodbus version 0.0.1 and now have rewritten this to use the Huanyang structure, and am just getting into the debugging stage now.

    If there are any gurus out there that are exsperts in parsing xml config files in Linux, I am thinking of using a xml file to pass all the config data to the component rather that command line options. This will be more flexible and should allow any / all of the drive parameters to be configured during startup. A handy thing if the VFD is used to drive different motors on different machines, eg a router and a mill or lathe. At start up all of the motor parameters ( poles, frequency, base rpm etc could be configured by the serial connection). A little ambitious maybe.

    First to get things talking with EMC2.

    Scott



  11. #11
    Member
    Join Date
    Dec 2006
    Location
    Australia
    Posts
    106
    Downloads
    0
    Uploads
    0

    Default

    Hey Scott, maybe you should contact Jayson from the Mechmate forum. He has successfully got EMC2 to talk to his HuanyangVFD. See here
    For those using Mach3, i have written a plugin to talk to the Huanyang VFD. I will post it on the Mach3 forum and a few days. Its being beta tested at the moment.

    Cheers
    Matt



  12. #12
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Matt,

    Jayson was kind enough to give me his working ClassicLadder file but this is not the nicest way of getting things working as it nobbles the standard Modbus.

    The hal component I'm working on is kinda like a plug in for Mach (except that it needs to be complied as a kernal module). This will allow other standard modbus equipment to used the ClassicLadder interface.

    Going to be slow going as work is heating up with silly season.

    Scott



  13. #13
    Registered
    Join Date
    Dec 2009
    Location
    china
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default

    anyone bought USB to RS232 or RS485 converter from here before: http://www.shopsintech.com/index.php?cPath=3



  14. #14
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    ?????

    Very close now to posting the Huanyang VFD component for EMC. After re-writing libmodbus to suit the Huanyang protocol and writing the component it is all integrated and working with EMC with a usable pyvcp panel as well. Still testing at the moment as there are a few bugs and fully exposing the feedback to EMC, but the VFD is under control of S and M codes (finally!!) with speed feedback to EMC...

    Scott



  15. #15
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    A bit more work on the hy_vfd component and pyvcp today. Nearly got everything working the way I want. Scan rate is 2 seconds at the moment which is fine fow most things but now that I have the control register feedback it seems a little slow.

    Still need to sort out some Modbus comms errors I'm getting when writing to the control register (note the red led on the panel). When the drive is just ticking over the comms is ok. At least I know where to start looking ;-)

    If anyone is interested in doing some testing pls let me know and I'll post the work to date.



    Scott

    Attached Thumbnails Attached Thumbnails Huanyang VFD RS485 / Modbus-hy_vfd-emc-2-jpg   Huanyang VFD RS485 / Modbus-hy_vfd-emc-3-jpg   Huanyang VFD RS485 / Modbus-hy_vfd-emc-1-jpg  
    Last edited by scotta; 12-09-2009 at 05:29 PM. Reason: spelling


  16. #16
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    All of the "Drive Configuration" infomation is read off the VFD and is used to set the minimum and maximum rpm etc.

    The lower leds show the status of the bits in the CNST register. The Huanyang manual is not very explanitory but when you can see what the bits are doing it starts to make sense. These status bits will be useful for further logic in ClassicLadder.

    Just need to get the comms error sorted and then work on the command line options...

    Oh, and if anyone knows how to change the font colour in the pyvcp and how to get number widgets to justify properly then I can get the DRO to look a little better.

    Scott



  17. #17
    Member
    Join Date
    Apr 2008
    Location
    England
    Posts
    384
    Downloads
    0
    Uploads
    0

    Default

    Scott, that looks great. I'm thinking of doing something like this for Mach3 but the VFD's manual seems odd to me.

    It states as an example:
    "Write 30.00Hz to inverter of 01 (write to PD003)"
    Code:
    ADDR	FUNC	LEN	DATA		CRC
    01H	02H	03H	00H 0BH B8H	7FH 0CH
    I don't understand how the data "00H 0BH B8H" equates to putting "1" into "PD003" - Can you explain this please ?



  18. #18
    Registered
    Join Date
    Jun 2005
    Location
    norway
    Posts
    55
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by scotta View Post
    If anyone is interested in doing some testing pls let me know and I'll post the work to date.
    Scott
    Nice work Scotta!

    I would _really_ like to help you test the software, all hardware is in place.

    Best regards

    Henrik



  19. #19
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by yngndrw View Post
    Scott, that looks great. I'm thinking of doing something like this for Mach3 but the VFD's manual seems odd to me.

    It states as an example:
    "Write 30.00Hz to inverter of 01 (write to PD003)"
    Code:
    ADDR	FUNC	LEN	DATA		CRC
    01H	02H	03H	00H 0BH B8H	7FH 0CH
    I don't understand how the data "00H 0BH B8H" equates to putting "1" into "PD003" - Can you explain this please ?
    The manual that has been circulating in 99% the manual for another brand which I'm guessing uses the same control board and the Huanyang. Only the PD function code set is different. In the example in the manual the first data is 00H this should be 03H (PD003).

    I've figured out a few more things with the protocol since playing.

    When using funciton 03, the data is always 3 bytes (length 03H) and the data is brocken into 1 Byte for the Parameter and two bytes for the Data.

    Scott

    Oh, and I figured out the font colours. I now have a nice LED green color for the DRO....



  20. #20
    Member
    Join Date
    Apr 2008
    Location
    England
    Posts
    384
    Downloads
    0
    Uploads
    0

    Default

    Ah I see, thank you for your help.

    I wanted to use EMC but my hardware isn't compatible with the kernel versions that they use.

    If mine looks half as nice as yours does, I'll be happy.



Page 1 of 7 1234 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Huanyang VFD RS485 / Modbus

Huanyang VFD RS485 / Modbus