This application about how to communication between Allen-Bradley PLC and Arduino using DF1 Protocol.
Data from arduino send to Allen-Bradley PLC and data from Allen-Bradley PLC send to arduino.
Data from Analog input (0 - 5V or 0 - 32767) of Arduino send to N7:1 of Allen-Bradley PLC.
Data from N7:0 of Allen-Bradley PLC send to Analog Output of Arduino (0 - 5V).
I use Allen Bradley MicroLogix 1000 PLC and DF1 setting with baud rate 9600.
Check out my video demonstration:
Only Folder : DF1
Data from arduino send to Allen-Bradley PLC and data from Allen-Bradley PLC send to arduino.
Data from Analog input (0 - 5V or 0 - 32767) of Arduino send to N7:1 of Allen-Bradley PLC.
Data from N7:0 of Allen-Bradley PLC send to Analog Output of Arduino (0 - 5V).
I use Allen Bradley MicroLogix 1000 PLC and DF1 setting with baud rate 9600.
Check out my video demonstration:
Allen-Bradley DF1 communication between Micrologix 1000 and Arduino
Hardware requirements:
- Allen-Bradley PLC with DF1 Protocol Support, I use Micrologix 1000
- RS-232 PLC Cable for Allen Bradley Micrologix 1000/1100/1200/1500
- Arduino UNO
- TTL to RS232 Module : If TTL to RS232 FEMALE connector then use DB9 Male crossover cable
- For testing (optional): 2 push button, 1 potentiometer and voltmeter/multi tester
Hardware Connections
Software requirements:
- Arduino Software : I use HOURLY BUILDS version 1.6.6 https://www.arduino.cc/en/Main/Software
- Arduino library : click here
Only Folder : DF1
Project File
- for Upload to Arduino : click here
- for Download to Allen Bradley MicroLogix 1000 PLC : click here
DF1 Setting of Allen Bradley MicroLogix 1000 PLC
I use RSLogix Micro Starter Lite Software for MicroLogix 1000 programming and DF1 Setting, as shown below:- Double Click Channel Configuration
- Check list Primary Protocol to DF1
- Select Baud to 9600
- Type Node Address with 1
- Check list Full Duplex
- Click OK
Arduino Code of Allen-Bradley DF1 Protocol
#include <DF1.h> #define DF1destination 1 #define DF1baud 9600 #define DF1format SERIAL_8N1 #define DF1timeout 1000 enum { DF1PACKET1, DF1PACKET2, DF1TOTAL_NO_OF_PACKETS }; DF1Packet DF1packets[DF1TOTAL_NO_OF_PACKETS]; DF1packetPointer DF1packet1 = &DF1packets[DF1PACKET1]; DF1packetPointer DF1packet2 = &DF1packets[DF1PACKET2]; unsigned int DF1readRegs[1]; unsigned int DF1writeRegs[1]; #define AnalogOutputPin 9 void setup() { DF1_construct(DF1packet1, DF1destination, DF1_READ_N7, 0, 1, DF1readRegs); DF1_construct(DF1packet2, DF1destination, DF1_WRITE_N7, 1, 1, DF1writeRegs); DF1_configure(&Serial, DF1baud, DF1format, DF1timeout, DF1packets, DF1TOTAL_NO_OF_PACKETS); } void loop() { DF1_update(); //wrire N7:1 int sensorValue = analogRead(A0); int outputValue = map(sensorValue, 0, 1023, 0, 32767); DF1writeRegs[0] = outputValue; //Read N7:0 unsigned int N7_0 = DF1readRegs[0]; N7_0 = map(N7_0, 0, 32000, 0, 255); analogWrite(AnalogOutputPin, N7_0); }
Labels:
Allen Bradley PLC
Allen-Bradley
Allen-Bradley DF1 Protocol
Allen-Bradley MicroLogix
Arduino
PLC
PLC and Arduino
PLC Application
Allen Bradley PLC
Allen-Bradley
Allen-Bradley DF1 Protocol
Allen-Bradley MicroLogix
Arduino
PLC
PLC and Arduino
PLC Application