< All posts

Talk to AB PowerFlex AC Drives from Linux or Windows

Instead of using a proprietary PLC controller (such as the AB Micrologix), there is an alternative and much easier way to talk to your Allen-Bradley PowerFlex AC drives. Rockwell Automation offers a number of interface modules, but it’s easy to get confused (20-COMM-E works with 700 but not with the 400 family) and they are often not exactly available at your neighbourhood electronics store.

Luckily, the PowerFlex drives also support RS485 via a RJ45 jack and the Modbus RTU protocol. This way, I am able to speak to our PowerFlex 400 and PowerFlex 4 inverters via simple 2 wire serial cables from a Linux server (which controls and monitors a couple of other related parameters in our systems, such as temperature and power distribution). This came in very handy, when I saw an opportuntity for great energy savings at Christmas, due to very low (for Hong Kong at least) ambient temperatures.

For this task, I am using the freely available Modpoll utility, which works on Windows XP, 2000, NT, 98, Linux kernel 2.6 or 2.4, QNX Neutrino 6 (x86) and Solaris (SPARC). I’ve also tested this successfully on Windows 7, so if this is what you are after, read on.

Here is what you will need:

  • Allen-Bradley PowerFlex AC Drive with RS485
  • Serial cable (a spare LAN cable will do)
  • USB to RS485 Interface
  • Optional 100-150 Ohm Resistor
  • Modpoll Modbus Master Simulator

And here is a broad overview of the steps involved to get this working:

Serial Adapter Installation on your computer. In order to make this a bit easier on you, I suggest you test this with an inexpensive USB to serial adapter and an alternative serial device, and not with the PowerFlex itself. For instance, I first use a simple USB to Serial adapter on my Windows notebook to talk to a KVM unit or other serial device. This rules out any system misconfiguration before moving on to the next step. Only when I understand that communication is working properly, I start wiring up and configuring the PowerFlex drives. This is especially helpful if you are working on “hot” AC drives and you can’t afford to shut them down.

Create PowerFlex serial cable. Network wiring consists of a shielded 2-conductor cable that is daisy-chained from node to node. Check your PowerFlex user guide for info on the correct pins. You’ll find this under the subheading “RS485 Network Wiring” In Appendix E in the PowerFlex 400 manual. It’s pins 4 and 5 on the RJ45 connector. Make sure they end up on the right pins on your USB serial adapter (TxRxD+ and TxRxD-, pin 3 and 4 on my Sub-D 9 pin serial adapter). Do not connect any of the other wires because they contain power and are used for other peripherals.  My system work without the resistor and I use shielded twisted pair LAN cables (When I moved from unshielded cat 5E cables to shielded my retry rate definitely went down). Your mileage may vary. Make sure you ground I/O terminal pin 20 as outlined in I/O block terminal diagram. Ground the shielding of your cable only on one side.

Prepare the PowerFlex for RS485.  Here are a few parameters that you will have to set on the PowerFlex 400 (check user manual for what corresponds to your model):

  • C102-C104 [Comm] Set baud rate, parity, stop bit etc.
  • C105 [Comm Loss Action] we set this to 3 (Continue Last) in case something goes wrong
  • P036 [Start Source] Set to 5 (Comm Port) (requires stopping drive!)
  • P038 [Speed Reference] Set to 5 (Comm Port)
  • C107 Optionally you can set this to 1 (RAM only) if you do a lot writes and want to avoid damaging your non-volatile storage

Start talking Modbus. Here are a couple of Modbus RTU commands you can use to test your connection. You can find a list of supported function codes and register addresses in Appendix E of the PowerFlex user manual. Node address in the following examples is set to 101. Check the command line help of modbus.

Move RS485 to Ethernet. Optionally, if your PowerFlex is far away from your server/computer, you can move the serial communication to a serial Ethernet server (Moxa 5150 and 5150A work fine with Linux (including Ubuntu 12.04) and Windows boxes).

Read Logic Status Data:

$ ./modpoll -1 -0 -a 101 -r 8448 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00

Read Output Frequency:

$ ./modpoll -1 -0 -a 101 -r 8451 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00

You can also read and write to drive parameters, where decimal 1 as address equals B001 and decimal 39 is P039 etc:

Output Frequency:

$ ./modpoll -1 -0 -a 101 -r 1 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00

Output Current:

$ ./modpoll -1 -0 -a 101 -r 3 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00

Output Voltage:

$ ./modpoll -1 -0 -a 101 -r 4 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00

And finally:

Write Output Frequency:

$ ./modpoll -1 -0 -a 101 -r 8193 -d 8 -p none -s 1 -b 9600 -m rtu /dev/ttyr00 400


The last command above sets the frequency to 40.0Hz on a PowerFlex 400.

Happy energy saving.