Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

instructables

Profibus-DP Communication Between Arduino and PLC

by tuenhidiy

Today, I would like to share how an Arduino communicates with PLC via Pro bus-DP connection. With this result, we
can carry out some projects with the combination of PLC and Arduino plus its extension shields at low cost, for
examples:

Control and data acquisition to / from PLC with BLYNK on smart phone via Arduino Mega + Ethernet
Shield + RS485 module. Normally, in order to connect Industrial Ethernet, the Siemens PLC must
have built-in communication module, such as 6ES7315-2EH14-0AB0 ..., or be equipped with a
separated communication module, like CP343, CP443.... With video below, Arduino will take over the
roles of Ethernet connection and exchange data with PLC through Pro bus protocol.

//www.yout ube.com/embed/iVDJNI1NFIQ

Turn sensors such as PIR Motion Sensor, SRF05 Ultrasonic Distance Sensor, MPU6050 Accelerometer
and Gyroscope Sensors.... into Pro bus devices that can be connected to industrial automation
system. Video below shows that PLC can read value of ultrasonic distance sensor to switch on/o 24V
relays.

//www.yout ube.com/embed/ldc0fT3E-TY

D.I.Y a HMI touchscreen to control /monitor PLC system through Touch Screen TFT LCD Module. As
video below, 3.2 inches touchscreen LCD can communicate with PLC via Pro bus and control 4 x 24V
relays as well as display temperature value collected from PLC.

//www.yout ube.com/embed/mXwYgITPQlM

In terms of cost, with some testings above, we will save a lot of money because the price of industrial
communication module or industrial touchscreen HMI are very expensive. In addition, we can extend Input and
Output of PLC through Pro bus - DP interface. It means that Arduino can works similar to Siemens DP/DP Coupler

Profibus-DP Communication Between Arduino and PLC: Page 1


Module to connect two Pro bus - DP networks together. And this DP/DP Coupler’s price is also very expensive. We
can refer to their prices as follows:

Communication Module CP343-1 Lean.

HMI Siemens TOUCH PANEL TP177B.

Siemens DP/DP Coupler Module.

I hope this project will inspire you, especially the students who don't have much money, to come up with ideas for
combining electronic and automation elds together, with low price.

Profibus-DP Communication Between Arduino and PLC: Page 2


Step 1: B.O.M

Main parts for this project:

Siemens CPU314C-2DP or other Siemens CPU with Pro bus port.

Arduino Mega 2560.

Arduino Ethernet Shield.

Module RS-485.

TFT LCD TouchScreen 3.2".

Shield LCD 3.2" Arduino Mega 2560.

Some 24V relays, pro bus cable, pro bus connectors....

Step 2: PREPARATION BEFORE STARTING THIS PROJECT

I. S O FT WARES:

SIMATIC STEP 7 V5.6/ SIMATIC STEP 7 V5.6 PROFESSIONAL.

Arduino IDE.

Profibus-DP Communication Between Arduino and PLC: Page 3


Blynk on smartphone.

Arduino library for TFT LCD includes: UTFT, URTouch, UTFT_Buttons

II. REFERENCE M ANUALS:

Arduino's UART, Timer.

PLC Siemens S7-300.

Pro bus manuals:

§ . https://www.felser.ch/pro bus-manual/index.html

§ . https://www.pro bus.com/

Learn about * .GSD le to con gure Arduino into Siemens PLC hardware system.

Step 3: PROFIBUS–DP

I. PRO FIBUS - DP: The GSD le is an electronic device datasheet or


device database le that identi es the Pro bus device.
Pro bus was created in 1989 by the German All Pro bus devices (class 1 masters and slaves) have
government in cooperation with several their own GSD les. GSD stands for "G e ne ra l
manufacturers of automation equipment. It is a St a t io n De s cript io n ". It is an ASCII text le that
messaging format speci cally designed for high- contains device-speci c data, such as, vendor
speed serial I/O in factory and building automation identi cation information, supported baud rates,
applications. It is an open standard and is recognized supported message length, number of input/output
as the fastest Fieldbus in operation today. data, meaning of diagnostic messages, timing
information, plus options and features supported,
The PROFIBUS DP network is based on an RS485 data formats, and available I/O signals.
physical layer and the European standard EN-50170.
The DP su x refers to “De ce nt ra liz e d Pe riphe ry ”, In order to commercialize Pro bus devices, the
which is used to describe distributed I/O devices manufacturers of automation devices have to registry
connected via a fast serial data link with a central the Ident Numbers for each device and it is also
controller. contained in this *.GSD le. You can check at:
https://www.pro bus.com/products/ident-numbers/
For more details about Pro bus, you need to read the
this documentation from Max Felser. And refer to the *.GSD le of Siemens DP / DP coupler
module at this address.
II. GS D FILE:

Profibus-DP Communication Between Arduino and PLC: Page 4


Step 4: SCHEMATICS

Arduino Mega 2560 can communicate with PLC S7-300 by RS-485 (M AX4 8 5 ) module through Pro bus protocol as
schematic below:

Here below are some schematics that I have tried for this project:

1. S che m a t ic 1 - PLC re a d Ult ra s o nic D is t a nce S e ns o r v ia Arduino M e g a 256 0 + RS4 8 5 M o dule .

Profibus-DP Communication Between Arduino and PLC: Page 5


2. S che m a t ic 2 - Sm a rt pho ne Bly nk PLC v ia Arduino M e g a 256 0 + Et he rne t Shie ld + RS4 8 5
M o dule .

Profibus-DP Communication Between Arduino and PLC: Page 6


Step 5: CIRCUIT ASSEMBLY

This assembly work is for schematic 2 in previous step - Smartphone Blynk PLC via Arduino Mega 2560 + Ethernet
Shield + RS485 Module.

Soldering adapter shield for Arduino Mega 2560 includes Ethernet Shield and RS-485 Module.

Installation Ethernet Shield and RS-485 Module on Adapter Shield. Plugging this Adapter Shield on
top of Arduino Mega 2560.

Profibus-DP Communication Between Arduino and PLC: Page 7


Wiring PLC's outputs to 4x24V relays.

Profibus-DP Communication Between Arduino and PLC: Page 8


Connecting Pro bus cable from PLC to Arduino. Take note about t he GND of two systems, they
must be connected together.

Profibus-DP Communication Between Arduino and PLC: Page 9


Step 6: HARDWARE CONFIGURATION

In Simatic Step 7 program (HW CONFIG), we have to install *.GSD le and update your Hardware
Catalog using the menu command "O pt io ns - - > Upda t e ca t a lo g ".

Profibus-DP Communication Between Arduino and PLC: Page 10


Hardware con guration

§ . With Arduino M e g a 256 0 - 16 M Hz , Pro bus works well at baudrate 4 5. 4 5 Kbps .

§ . De ne the num be r o f by t e s t ra ns m it t e d a nd re ce iv e d over the Pro bus connection.

Profibus-DP Communication Between Arduino and PLC: Page 11


Step 7: PROGRAMING

I. PLC PRO GRAM .

Profibus-DP Communication Between Arduino and PLC: Page 12


II. ARDUINO PRO GRAM .

Profibus-DP Communication Between Arduino and PLC: Page 13


III. BLYNK HM I S CREEN.

Profibus-DP Communication Between Arduino and PLC: Page 14


Blynk code is as follows:

void myTimerEvent()

{
Blynk.virtualWrite(V8, temperature);
}

BLYNK_WRITE(0)
{
if (param.asInt())
{
Control_State[0]=1;
}
else
{
Control_State[0]=0;
}
}

BLYNK_WRITE(1)
{
if (param.asInt())
{
Control_State[1]=1;
}
else

Profibus-DP Communication Between Arduino and PLC: Page 15


{
Control_State[1]=0;
}
}

BLYNK_WRITE(2)
{
if (param.asInt())
{
Control_State[2]=1;
}
else
{
Control_State[2]=0;
}
}

BLYNK_WRITE(3)
{
if (param.asInt())
{
Control_State[3]=1;
}
else
{
Control_State[3]=0;
}
}

BLYNK_WRITE(4)
{
if (param.asInt())
{
Control_State[4]=1;
}
else
{
Control_State[4]=0;
}
}

BLYNK_WRITE(5)
{
if (param.asInt())
{
Control_State[5]=1;
}
else
{
Control_State[5]=0;
}
}

BLYNK_WRITE(6)
{
if (param.asInt())
{
Control_State[6]=1;
}
else
{
Control_State[6]=0;
}
}

BLYNK_WRITE(7)
{
if (param.asInt())
{
Control_State[7]=1;
}
else
{
Control_State[7]=0;
}
}
Profibus-DP Communication Between Arduino and PLC: Page 16
}

NO T ES :Description below shows how the project works:

PUS H BUT T O NS CO M M ANDS O N BLYNK :

§ . I create on the Blynk app a panel with 8 push buttons V0 ~ V7.

§ . When push buttons are touched, the button statuses (ON / OFF) will be written to the Arduino Mega 2560 via
Ethernet Shield and be stored in transmitted bu er.

§ . Arduino Mega 2560 will transmit these button statuses to PLC S7-300 via Pro bus communication (RS-485
module). At PLC side, as hardware con guration in previous step, button statuses will be received at PLC's input I0.0
~ I0.7.

§ . PLC's output Q124.0 ~ Q124.7 will switch ON or switch OFF 24V relays according to the status of I0.0 ~ I0.7.

CO LLEC T AND DIS PL AY T EM PERAT URE DATA RECEIVED FRO M PLC US ING BLYNK

Since I do not have temperature sensors like Thermocouples, PT-100..., I have simulated the temperature data
acquisition from the PLC by sending back status values of push buttons received from Blynk. Temperature value is
sent at PLC's output PQB0 (Q0.0 ~ Q0.7) via Pro bus protocol.

Step 8: PICTURES

The images above are results of 3 experiments that I have done for this project, including:

PLC read Ultrasonic Distance Sensor SRF05 via Arduino Mega 2560 + RS485 Module.

D.I.Y a HMI touchscreen to control /monitor PLC system via Arduino Mega 2560 + 3.2" Touch Screen
TFT LCD + RS485 module.

Control and data acquisition to / from PLC with BLYNK on smart phone via Arduino Mega + Ethernet
Shield + RS485 module.

Profibus-DP Communication Between Arduino and PLC: Page 17


Profibus-DP Communication Between Arduino and PLC: Page 18
Step 9: FINISH

As information from PROFIBUS & PROFINET Industrial Internet of Things (IIoT) eld by an Arduino.
International (PI) - a large automation community, it And once the Arduino can communicate with the PLC/
has about 1,700 manufacturer members and over 60 industrial automation system via Pro bus - DP, we can
million PROFIBUS nodes installed worldwide. do lots of cool things.

This is just an initial primitive experiment, but it’s THANK FOR YOUR WATCHING !!!
great if we can implement a PROFIBUS network in an
the code is not clear ,can you attach it ?

How do i get the arduino .GSD file

Profibus-DP Communication Between Arduino and PLC: Page 19

You might also like