586,263 active members*
3,790 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > Phase Converters > Huanyang VFD RS485 / Modbus
Page 6 of 7 4567
Results 101 to 120 of 131
  1. #101
    Join Date
    May 2012
    Posts
    5
    Yeah sorry, I made a mistake in my original post the hall file is:-
    net hy-Temp <= spindle-vfd.Tmp => pyvcp.temp

    So the XML file is right, but thanks it did make me check it.

    I also added this to the Hal file:-
    net hy-ACV <= spindle-vfd.ACV => pyvcp.AC-V

    And this to the XML:-
    <label>
    <text>"AC - Volts "</text>
    </label>
    <tablesticky sticky="e" />
    <number>
    <halpin>"AC-V"</halpin>
    <format>"4.0f"</format>
    </number>
    <tablerow/>

    I get ACV data when the VFD runs (albeit in the thousands instead of the hundreds eg. 2100 ACV instead of 210.0 ACV), but that is something I can fix(I think).

  2. #102
    Join Date
    May 2012
    Posts
    5
    I also noticed my Lower Limit Frequency is showing 0 as well??

  3. #103
    Join Date
    Jun 2010
    Posts
    12

    Re: Huanyang VFD RS485 / Modbus

    Attached is my modified vfd driver. It supports turning on the vfd after starting linuxcnc, and it has quite a bit more stability in the communications. I doubt I'll be reving it anymore unless someone finds a bug.

  4. #104
    Join Date
    Sep 2008
    Posts
    22

    Re: Huanyang VFD RS485 / Modbus

    Quote Originally Posted by shadowbane View Post
    Attached is my modified vfd driver. It supports turning on the vfd after starting linuxcnc, and it has quite a bit more stability in the communications. I doubt I'll be reving it anymore unless someone finds a bug.
    Thanks a lot shadowbane, the code is very well documented and quite intuitive! I will need to modify it to support connecting to an RS485 to TCP adapter. Just one question, how did you arrive at this?

    Code:
    // control commands CNTR
    #define CONTROL_Run_Fwd		0x01
    #define CONTROL_Run_Rev		0x11
    #define CONTROL_Stop		0x08
    From the manual, the CONTROL_STOP is indeed the 4th bit and hence 0x08 makes sense, but the forward control bit is the 2nd bit, so isn't it suppose to be 0x02? Similary, Reverse 0x04? Am I missing something?

  5. #105
    Join Date
    Dec 2003
    Posts
    24221

    Re: Huanyang VFD RS485 / Modbus

    You will find that there a quite a few different combinations that will work for the same function, if you use a serial program to send a command string to the VFD, and control it directly, you can see the many variations that work.
    I use 02 t0 start, reverse 12 and 08 to stop.
    This is using the Mach plug in BTW.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  6. #106
    Join Date
    Jun 2010
    Posts
    12

    Re: Huanyang VFD RS485 / Modbus

    Actually the credit for the majority of the code goes to Scotta. I just modified it to do some additional retries and fixed a bug. So, to answer your question, I came up with those numbers by getting them from Scotta.

    I didn't question then since they worked for me. Sorry I couldn't be of more help.

  7. #107
    Join Date
    Sep 2008
    Posts
    22

    Re: Huanyang VFD RS485 / Modbus

    Today, I attempted connecting to the VFD using my slightly modified software. The only thing different is that I modified the connect routing to open a socket to the an RS485 to Ethernet adapter server. The adapter is configured to 9600, 8 bit data, 1 stop bit, no parity. I used the same adapter with another controller and I didn't face any issues, it is configured for 2-wire RS485, I connected the TX pin to RS+, and RX pin with RS-, and the ACM is connected to the signal ground on the adapter. I selected all the PIDXXXX as per the original post.

    However, I couldn't get any response back from the VFD at all. This was all done under Linux. Then I tried under Windows using Mach3, downloaded the Huanyang plugin, and used a port direction to map COM1 to the RS485 Adapter server, but still it cannot communicate. I suspect that the VFD does not work at all in RS485/Modbus, I bought it from Amazon from Sunwill, but upon receving the device, I was told that they sent me a unit with no support for RS485, and later they shipped me an IC to solder on to gain support for RS485/Modbus. I did that even though it was a bit tricky, but I might have screwed something up, or there might be another missing component I'm not aware about.

    At any rate, assuming the VFD supports RS485/Modbus, is there anything else to do? I even tried changing the adapter's parity to ODD since the manual says that the parity is odd, but that didn't do anything.

  8. #108
    Join Date
    Dec 2003
    Posts
    24221

    Re: Huanyang VFD RS485 / Modbus

    Apparently there were some Huanyang VFD's where the RS485 IC socket or location was not populated.
    I used a RS232 program with a convertor to test all the communication codes via a PC.
    The program is rs232Hexcom.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  9. #109
    Join Date
    May 2014
    Posts
    4

    Re: Huanyang VFD RS485 / Modbus

    Hello,

    I Use the Plugin all works can start stop the spindle.

    But when i use the command M3 S10000 the spindle grow up to 24000rpm not 10000 and the programm stops.

  10. #110
    Join Date
    Dec 2003
    Posts
    24221

    Re: Huanyang VFD RS485 / Modbus

    Which plugin are you using and is this under Mach?
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  11. #111
    Join Date
    Feb 2007
    Posts
    711

    Re: Huanyang VFD RS485 / Modbus

    boonkerz. You have 3 options.

    divide your spindle speed by 8 when setting up your cam file.
    set your spindle speed override to 12% (which is ~100/8)
    or edit the source as described below and recompile. I posted the modified binary somewhere in this thread before.

    Quote Originally Posted by alan_3301 View Post
    I think I figured it out. When scotta wrote this program, I guess he used the default for pd004 on his VFD/Spindle.

    In the file hy_vfd.c look for
    Code:
    hzcalc = *(haldata->base_freq) / *(haldata->rated_motor_rev);
    	freq =  abs((int)(*(haldata->speed_command)*hzcalc*100));
    base_freq is pd004 (default of 50)
    rated_motor_rev is pd144 (default of 1440)

    I am assuming when he set his VFD up, and wrote the program, that he set pd144 to 3000 like the rest of us using this spindle, but left pd004 at 50?
    this would set hzcalc to 0.01666667 When I set my pd004 at 400 as instructed by the consensus. it would set hzcalc 8 times more, to 0.13333333
    Which explains why my vfd tries to run at 8x the speed of my S command.
    So to fix I will change to

    Code:
    hzcalc = 50 / *(haldata->rated_motor_rev);
    	freq =  abs((int)(*(haldata->speed_command)*hzcalc*100));
    this should work for all cases. The definition of rated_motor_rev is the speed of the motor at 50hz, so this should be good for all.
    I will test it out this week and make sure it all works.

  12. #112
    Join Date
    May 2014
    Posts
    4

    Re: Huanyang VFD RS485 / Modbus

    Hi yea i have recompiled it with hzcalc = 50 ...
    Works

    but the spindle speeds up to 9999 and hangs on this speed, is it an rounding problem?

    PD144 is 3000 and PD004 is 50

  13. #113
    Join Date
    Feb 2007
    Posts
    711

    Re: Huanyang VFD RS485 / Modbus

    I don't think it's a problem, as long as it is close to the target speed.

  14. #114
    Join Date
    May 2014
    Posts
    4

    Re: Huanyang VFD RS485 / Modbus

    Yea but the Linux Testprogramm hangs on the M3 Command.

    i think linuxcnc wait for 10000rpm or?

  15. #115
    Join Date
    May 2014
    Posts
    4

    Re: Huanyang VFD RS485 / Modbus

    thas wired when i set M3 9999 it rotates with 9998

    PD144 = 3000
    PD004 = 400

    hzcalc = 50 / *(haldata->rated_motor_rev);

  16. #116
    Join Date
    Oct 2014
    Posts
    6

    Re: Huanyang VFD RS485 / Modbus

    Hello

    I am new to LinuxCNC and try to get the Spindle working over Modbus.
    The first thing was to copy the hal and gui file to my Config Dir and the hy_vfd binary from shadowbane to my usr/bin.
    Then the LinuxCNC comes with the Spindle Panel and i see some new things.
    The Modbus Indicator was red till i twist the RS+ and RS- Signal on the Inverter. I've found this with a LTC485 IC and a UART Analyzer on my Logic Analyzer (yes i do something electronic stuff ).
    Now the physical side looks fine... i see on my analyzer something like in the picture when LinuxCNC is in Idle Mode.Attachment 252854
    The Modbus Indicator in LinuxCNC is now green, but everything else stays on zero.

    Can you help me? How can i debug?
    I don't have MACH3 or a Windows Box.

    Greetings

    Edit: So, i've found out some more things... The Modbus Indicator is also green without powered on VFD. The Logfile in the picture above is also the same without active VFD on the modbus. This is very curious ^^

    Edit 2: I've found out that the RS485 converter has set the reciver always on. So the PC see his own message as the message from the VFD. Now i set the RS485 Converter to "TX on RTS and RX on /RTS".
    Now the VFD Response something, but there are also parity errors. With none parity it also not works. I think there is a timing Problem between switching with RTS so the transmitter on time from the Converter and from the VFD overlaps...

    I feel so lost... why is the digital control from this VFDs such a problem?!

  17. #117
    Join Date
    Feb 2007
    Posts
    711

    Re: Huanyang VFD RS485 / Modbus

    First thing to check is your pd001 and pd002 on the vfd, are they set to rs-485 control?
    secondly, look at the hal file when hy_vfd is loaded, do the parameters match the vfd communication parameters?
    I forget the pd numbers, but read through this thread or the manual to find them.

  18. #118
    Join Date
    Oct 2014
    Posts
    6

    Re: Huanyang VFD RS485 / Modbus

    Quote Originally Posted by alan_3301 View Post
    First thing to check is your pd001 and pd002 on the vfd, are they set to rs-485 control?
    secondly, look at the hal file when hy_vfd is loaded, do the parameters match the vfd communication parameters?
    I forget the pd numbers, but read through this thread or the manual to find them.
    Well, this is the first thing i have checked. Also the baud rates and the parity settings.... The parameters for hy_vfd in the hal file are also right.

  19. #119
    Join Date
    Oct 2014
    Posts
    6

    Re: Huanyang VFD RS485 / Modbus

    So,
    i've debuged all de day long and now i have found some mistakes...
    the wire MUST be terminated with 120 Ohm resistors... the Manual says there are no terminating resistors needed.
    then the RS485 Converter need a RTS Signal for switch from RX to TX.

    And this is my problem. When i configure it to RX always on, my PC recive everything is send and the answer from the VFD.
    This doesnt work with hy_vfd because the transmit string will be read as answer and so the module thinks this is from the VFD.
    When i configure the Converter to switch the Reciver with inverted RTS signal, so nothing comes back... Now i think about changing the source to flush the inputbuffer after sending...

    this "little" project is so frustrating... i hope i'll have some success with my plan

    EDIT:
    Now i know that my Linux Box don't switch the RTS Pin correctly... its all time on. I try to fix this problem in the source... i have the Hardware Flow Control enabled but RTS still always on.

  20. #120
    Join Date
    Oct 2014
    Posts
    6

    Re: Huanyang VFD RS485 / Modbus

    Hey Folks... i have it *yay*

    So: the problem was RTS. I now connected the RTS signal from the Converter to my TRX Signal and everything works fine I know this is not the finest solution but it works. (Same connection like CAN in automotive..., its RS485 Multimaster)

    Here some Linux Commands to test everything without the hy_vfd tool.
    Setting the Serial Port: stty -F /dev/ttyS0 19200 parenb -parodd cs8 crtscts -echo
    Recive on the Serial Port: cat /dev/ttyS0 | xxd -c 1
    Send to the Serial Port: echo -en '\x01\x04\x01\x00\x41\x89' > /dev/ttyS0

    Plese edit the Hexvalues to your special use. I have build a RS232 Loop Connector (Pin 2 + 3 on DB9 shorted). Next step was to loop after RS485 and so on. Its not very difficult but it can be a long way

    So thank you for your help. I hope i could help with the three commands i searched hours for.

    Greetings

Page 6 of 7 4567

Similar Threads

  1. Mach3+DZB200M + Modbus RS485 + brain
    By Ceyhun in forum Mach Software (ArtSoft software)
    Replies: 5
    Last Post: 10-30-2014, 12:42 PM
  2. Replies: 4
    Last Post: 01-27-2013, 06:49 PM
  3. RS485 for POWERMAX 65
    By FredCNC in forum Hypertherm Plasma
    Replies: 8
    Last Post: 08-24-2011, 02:46 AM
  4. Spindle vfd control via modbus & rs485?
    By Pplug in forum Techno CNC
    Replies: 0
    Last Post: 05-25-2011, 01:24 AM
  5. rs-232 and rs485 bus
    By eloid in forum Mach Software (ArtSoft software)
    Replies: 1
    Last Post: 03-13-2007, 04:39 AM

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
  •