Today, I’d share with you how to connect Arduino with PLC S7-300 via Ethernet. From Internet, I also studied some libraries that can handle this communication, such as:
I selected “settimino” library to test communication between Arduino & PLC because of its pro & easy to understand. To get this test, you need to have certain knowledge of PLC Siemens and also have to spend quite money of course....
Cautions:
Do not connect Arduino with Ethernet shield to factory industrial Ethernet network & apply this test. It can cause serious consequences.
With project's VIDEO below, NODEMCU + MPU6050 is communicated with PLC via WIFI to control Speed/ Direction of DC motor.
Dave Nardella - Italian - is the author of two great libraries of interfaces between ARM Linux / MIPS microprocessors and PLC Siemens S7 ™:
http://settimino.sourceforge.net/
About PLC, you can refer to the Siemens official website:
Bill Of Material is as below:
Important note about Ethernet Shield: The resistor value in the red rectangle should be 49R9 or 510 (about 50 ~ 51 ohm), with some Ethernet Shields, this value is 511 (510 ohm). I have a problem with the 511 resistor so I cannot connect to the PLC & finally have to buy another one with R510, then, the connection is successful.
I tested PLC & Arduino communications with 2 options:
Hardware configuration - ARDUINO UNO R3 equipped with ARDUINO Ethernet Shield R3
Hardware configuration explanation:
Hardware config in SIMATIC MANAGER
Actual hardware demo kit:
With above configuration, two controllers can exchange data with each other easily, for example:
1. SETTIMINO LIBRARY
You can download the link at: Settimino Library, which includes: library, detailed instructions for using settiminno library and sample programs.
In the manual, please note the terms "Big-Endian" and "Little-Endian" to describe differences in reading and writing data between ARDUINO ™ (Little -Endian) and PLC Siemens S7 ™ ( Big -Endian).
2. PLC PROGRAM
I used STEP 7 Professional 2010 V5.5 to configure hardware & write program for PLC. If you are an automatic engineer, you will be very knowledgeable about it...
You can also use the SIMATIC WinCC as an HMI / SCADA system to control Siemens S7 ™ PLCs or ARDUINO ™.
Settimino can directly access the Siemens PLCs with built-in Ethernet moldule (such as CPU 315-2PN/DP, CPU412-2PN/DP, CPU414-3PN/DP ...) or via a separated Ethernet card (like CP343 for CPU S7-300), or CP443 for CPU S7-400). I was tested in the case of S7-300 CPU + CP343.
3. ARDUINO PROGRAM
3.1. Arduino read DB values from PLC - “DBGetDemo”
Detail you can see at:
3.2. Write to PLC’s Data Block at Security Level 3
Program Overview:
Detail you can check at:
Hardware diagram:
Actual system picture:
Wireless router is located inside my home with distance about 15m and it is not shown on the picture.
NodeMCU intergate MPU6050 as picture:
Hardware configuration explanation:
PLC program control DC motor:
I used ULN2803 to convert the voltage level. Each ULN2803 contain eight darling-ton transistors, it means we can convert 8 signals by using one ULN2803. Circuit diagram as follow:
Picture of Converter Board
PLEASE VOTE FOR ME ... so that I have more motivation to do more useful projects!!!