[Home]VFD Modbus

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Search:

VFD and Modbus

So far, there are two options for using a Modbus VFD interface. One option is to create a HAL component as a driver. This would present the VFD's I/O as halpins. modbus.c and modbus.h are used to support the driver. Another option is to use Classic Ladder which has Modbus built in.

Below are links to some example configurations using VFD's with Modbus:

VF-S11

http://www.toshiba.com/ind/product_display.jsp?id1=7&id2=19
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ContributedComponents#Toshiba_VF_S11_VFD_driver_vfs11_vfd

GS2

http://www.automationdirect.com/adc/Overview/Catalog/Drives/GS2_%28115_-z-_230_-z-_460_-z-_575_VAC_V-z-Hz_Control%29
http://www.linuxcnc.org/docview/html/drivers_GS2.html
http://git.linuxcnc.org/gitweb?p=emc2.git;a=blob;f=src/hal/user_comps/gs2_vfd.c;h=17ed97b78e681c673ab768eb2e0e62bb0b7daf73;hb=e0fbe2669c1bc7b320b738f72ee15abe868aa5a9

Altivar

http://products.schneider-electric.us/products-services/products/ac-drives-and-soft-starts/
http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/altivar-vfd-comp

SJ200

http://www.hitachi-america.us/products/business/inverters/products/ac_variable_speed_drives/sj200/
http://www.wallacecompany.com/machine_shop/EMC2/sj200rtu-ft/
http://www.wallacecompany.com/machine_shop/EMC2/sj200rtu/

MVX9000

http://www.eaton.com/Electrical/USA/ProductsandServices/AutomationandControl/AdjustableFrequencyDrives/MVX/index.htm
http://www.wallacecompany.com/machine_shop/EMC2/mvx9000/

Hardware Overview

Typically a VFD with a Modbus option will offer a half-duplex RS-485 port for use with a single twisted wire pair cable. The port may use an RJ11 or RJ45 connector, so a telephone or network cable may be used. On the PC end, the cable connects to an RS-485 to RS-232 adapter on a serial port. Most half-duplex adapters should work if the RS-232 RTS signal is used to control the send/receive mode of the adapter. The adapter I've used cost just under $5 and is powered by the serial port pins. For long cable runs, an adapter with external power connection may be better.

Driver Method

The software consists of an HAL user component and libmodbus. libmodbus contains the functions needed talk to a serial port, convert serial data into Modbus packets and control the communication. The HAL component provides an interface between LinuxCNC and libmodbus. On the linuxcnc side, it creates HAL input or output pins for sending or receiving VFD control signals. On the VFD side, using libmodbus, it controls the serial port connection. In between, the HAL pin data is converted from or to VFD usable form, such as converting the HAL pin, motion.spindle-speed-out from a float to an unsigned integer then scale from RPM to frequency. Being a user component, it runs as a user process in Linux and not RTAI. Some functions of the component may run only once, such as initializing and reading VFD configuration data. During normal operation, a loop regularly reads the VFD pins, processes the new data, then sends new data out to the VFD. Typically the loop can run up to ten times a second, depending on the serial port Baud rate and the amount of data to send and receive.

Because each VFD maker implements Modbus differently, a custom HAL component will most likely be needed for each VFD model. Typical VFD HAL components will not be .comp files, which can be compiled and documented with the comp utility, but a C file needing its own Makefile and manual documentation. For compiling the C file, the emc2-dev (or linuxcnc-dev) package will need to be installed. This should be available using Synaptic. A Makefile can be copied from an existing sample and modified to use the new component name. The mobus.c and modbus.h files may be copied from existing examples, but it may be better to download the latest libmodbus package from the libmodbus website:
http://packages.ubuntu.com/search?keywords=libmodbus
http://libmodbus.org

Roughly, the procedure might be...
Create a directory under "/home/my_home/emc2" such as "/home/my_home/emc2/my_vfd"
Copy into "my_vfd" a sample vfd.c, modbus.c, modbus.h, and Makefile
Edit my_vfd-x.c and Makefile
Run "cp my_vfd-x my_vfd.c", "make", "sudo make install"
Copy sample linuxcnc config files in "/home/my_home/emc2/configs/myCNC/"
Edit the .hal file in "...myCNC/myCNC.hal" to "loadusr my_vfd ..." and connect HAL pins
Invoke emc2 and enjoy

Notes on using vfs11_vfd.c as the base for a new Modbus device C component -> New file from vfs11.

Classic Ladder Method

I know nothing about CL. If you know how to use Classic Ladder with a VFD using Modbus, now is your chance to become famous.

(Draft 2011/03/01 Kirk Wallace)


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited July 7, 2012 1:07 pm by Archivist (diff)Published under a Creative Commons License