VFD control with Arduino using RS485 link
Variable Frequency Drives (VFD) allow the control of spindles so speed can accurately be controlled and a detailed acceleration profile for the spindle and reverse rotation can all be handled. In essence a VFD is an three phase inverter for three-phase AC motor.
I am using a popular (I mean cheap) Chinese VFD and though the reference manual is not great, I could see there is a built-in RS-485 port. I usually control the start, stop and speed selection using the keyboard on the unit but I thought it will be more useful if I could control everything from the same Arduino is doing our CNC table control.
Some cheap RS-485 off eBay and some lines of code later, I can start, stop and change the speed from an Arduino. What a cool thing to have!
I am using a popular (I mean cheap) Chinese VFD and though the reference manual is not great, I could see there is a built-in RS-485 port. I usually control the start, stop and speed selection using the keyboard on the unit but I thought it will be more useful if I could control everything from the same Arduino is doing our CNC table control.
Some cheap RS-485 off eBay and some lines of code later, I can start, stop and change the speed from an Arduino. What a cool thing to have!
Some configuration of your VFD are needed before you can use it like that. You need to set PD163=1 (I am using address 1 in the code). PD=164=1 (for setting serial to 9600bps) and PD165=0 (for using ASCII and 8N1 character format). On top of that, you need to set PD001=2 (for commands being provided through the communications port).
Please note that doing that may interfere with your existing controls using external terminals, so be careful as that might make your emergency or external stop buttons to stop working. The built-in stop button still will stop the spindle but you need to power-cycle the VFD for accepting new start commands over the serial port.
Comments
https://drive.google.com/file/d/0BxBSPbIgJc5LQ3VQQUR3dzVIUE0/view?usp=sharing
And Soft for pc:
https://drive.google.com/file/d/0BxBSPbIgJc5LNnlIWmV4UndpU2s/view?usp=sharing
Thank You!
What a difference: your VFD manual is actually written in English (not badly translated into English as mine) and it definitely can be done. My suggestion is for you to use ASCII mode.
While it is not complicated, it may take a few attempts to get it right and for that it is very handy to have the real device at hand.
The most challenging part is LRC calculation but the manual has it covered too.
You just have to set your serial to 9600 bps and send a string like this example ":010321020002D7" (please note this is not starting the VFD but reading a value).
Serial.begin(9600, SERIAL_7N1 ); in setup()
i tryed to start motor and failed alot with your code in arduino uno...
01H: comunication adress
06H: write single register. mean write in memory to adress?
2000H: memory adress
10B: start motor, but why 10B what that mean?
how looks start command ? ":xx...xx" ????
someone told me to convert 2000H to DEC... i tryed but nothing happened.
What brand of VFD are you talking about?
What brand of VFD are you talking about?
More information on the motor:
Model 5KH46JR15S
HP 0.5
RPM 1725/1140
Volts 115V
Cycle 60 Hz Cycle
Current 7.9A/7.2A
PF 85%
is it possible to use marlin (arduino mega 2560+ramps) directly to start and stop the spindle. i have this model
http://www.prom-electric.ru/data/uploads/manuals/sunfar_e300_manual_en.pdf.pdf
(i think marlin-ramps-lcd is the perfect combination to have a controler without computer needed)
thanks
fabrice
thanks
I want to find in your code, where you type the address of the vfd to add another address or addresses of other VFDs. I appreciate your help.
regards
I bought a 2.2kw Huanyang inverter but I seem to be having a lot of trouble getting it working. I cobbled up an Arduino based interface for my mill (does a lot more than sending commands to the VFD) but I can't seem to get this working. I can set the frequency (PD003) programmatically but I can't get it to start at all. I used your code as a baseline and mine is very similar, but I can't get it to start AND I don't seem to be getting any response back from the VFD (should I? manual is horrible). I send :01020303177070 to set it to 60Hz and that seems to work (I can set it to anything). Then I send it :01030101FA to start the thing (FWD) but nothing happens. Is there some magic setting that I'm missing?
A warm morning and merry Christmas. I am facing problem to interface my Delta VFD-M with Arduino. I am using RS232 to RS485 converter module to interface with the device. I tried a lot and googled with around all the libraries available.
Data sheet for the VFD can be downloaded from
http://www.delta.com.tw/product/em/drive/ac_motor/download/manual/VFD_M_EN_20100514.pdf
My efforts went in vain, please help me out with this issue.
My control requirements:
Control:
1. Frequency:
2. Start / Stop:
3. Forward / Reverse
Read:
1. 16 Registers data starting from 2000H
Email: dhrubajyoti2009@gmail.com
The manual link is
here
Thanks for all the content. But what do I need to send to the VfD for guest engine to run backwards? To start, ":01030101" will be sent to stop ":01030108", for 30Hz will ": 010203030BB837\r\n", but what does the code for "reverse " look like?
Many greetings, Michael
char* sp_start =":01030101"; // CW
char* sp_start_rev=":01030111"; // CCW
Best regards,
Michael
Can I please have the circuit diagram you used to connect arduino to a VFD. I am using an Arduino mega and a SD100-01D543 VFD.
Further this VFD also has a built in RS485, Do I need an external RS485 regardless ?
Here is the manual of VFD that I am using
http://www.holip.com/upload/file/2017/09/133R0309%20HLP-SD100%20Series%20English%20Operating%20Manual%20V2017-01(20170828).pdf
A warm morning and merry Christmas. I am facing problem to interface my Delta VFD-E with Arduino. I am using RS232 to RS485 converter module to interface with the device. I tried a lot and googled with around all the libraries available.
Data sheet for the VFD-E can be downloaded from
https://www.google.com/url?sa=t&source=web&rct=j&url=http://www.delta.com.tw/product/em/drive/ac_motor/download/manual/VFD-EL_manual_en.pdf&ved=2ahUKEwiWnY_6177bAhWDcRQKHXPIDVUQFjABegQIBxAB&usg=AOvVaw1kb6dOEmX9CKTTs5oNvaEd
My efforts went in vain, please help me out with this issue.
My control requirements:
Control:
1. Frequency:
2. Start / Stop:
3. Forward / Reverse
Read:
1. 16 Registers data starting from 2000H
Email: samerhaleem2@gmail.com
first of all, could I have your email?
1. this is your code that you used, right? (https://pastebin.com/QpmDDHsD)
2. In which part did you enter the SERIAL_8N1?
3. How did you get these numbers? I mean these:
":010203030BB837\r\n" ----> for speed
":01040300" ----> for read_speed
":010203030BB8" ----> for change_speed
":01030108" ----> for stop
":01030101" ----> for start
I explain start's code and please check I'm right:
: -> 3AH
01 -> Address of vfd
03 -> write control data
01 -> I don't know
01 -> I don't know
4. what is the "V" in the "void setSpeed(int v)"?
5. Thanks a lot if you give a brief explanation about these codes:
n[9]=toHexa((v/256)>>4);
n[10]=toHexa((v/256)&0xf);
n[11]=toHexa((v&0xff)>>4);
n[12]=toHexa((v&0xff)&0xf);
thank you & best regards
Testing video: https://youtu.be/Ap4cbzAT04w (sorry, it is in Russian).
And the code: https://pastebin.com/UE3vDgUA
Very satisfied with result. And not without your help!
I am asking for the Arduino-GRBL connection diagram with arduino-RS-485 and VFD-inverter
i wanna ask, my VFD didn't have the RS- and RS+ for the RS-485 cable, but they have A and B sockets for RS-485, is it okay to connect without knowing the + and - ? Thanks.
Yes A/B or +/- are the same thing but there is not a common agreement https://en.wikipedia.org/wiki/RS-485
But, if you have a different VFD model/brand it is very likely my code will not work as it needs to be customized for each unit.
In general, what kind of variable needs to be change in order to make it work?
and when the RS-485 are connected to VFD, is it need to connect to the motor? just to tell if it really can control the VFD or not?
https://pastebin.com/QpmDDHsD
If you are still around.
I'm trying to use your code but get the messages below when I "verify" the code.
I have tried a few things but am pretty new to Arduino. Any help would be much appreciated.
BTW I think you may have left out PD002=2 in your instructions, but as I haven't got it running yet I cant be sure.
C:\Users\user\Documents\Arduino\test.ino:13:18: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char* read_speed=":01040300";
^
C:\Users\user\Documents\Arduino\test.ino:14:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char* change_speed=":010203030BB8";
^
C:\Users\user\Documents\Arduino\test.ino:15:12: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char* stop=":01030108";
^
C:\Users\user\Documents\Arduino\test.ino:16:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char* start=":01030101";
Maybe its something I have done, maybe its my RS485 board, I'm just using normal wire but over about 2m. I will try a few more things.
Thank you for your time.
Modbus is most likely the best but it is also more complex.