Page 1 of 1

plc automation

Posted: Fri Apr 18, 2014 6:24 pm
by arulmcts
hai....
this is my first post in forum i thank you all.
i have to interface plc with pi for my project and also i have to transfer data from plc to pi and vice versa. is it possible if any one knows it means please help me.

Re: plc automation

Posted: Fri Apr 18, 2014 10:49 pm
by BMS Doug
arulmcts wrote:hai....
this is my first post in forum i thank you all.
i have to interface plc with pi for my project and also i have to transfer data from plc to pi and vice versa. is it possible if any one knows it means please help me.
More information required.

What PLC are you trying to interface with.

Re: plc automation

Posted: Sat Apr 19, 2014 6:30 am
by Paul Moir
Which PLC does matter a lot.

Libmodbus works pretty easily with PLCs that support MODBUS. If MODBUS is an option that's the way to go. Most PLCs have some proprietary or might-as-well-be-proprietary communication scheme, but many support the ancient MODBUS protocol. This is the real backwater of computers...

Re: plc automation

Posted: Sat Apr 19, 2014 3:59 pm
by arulmcts
am using siemens plc type: SIMATIC S7-1200.
do you have any tutorial... plase refer some link

Re: plc automation

Posted: Sat Apr 19, 2014 4:39 pm
by arulmcts
FRIENDS... am new to pi.. i need a block diagram that shows how to interface pi and plc using modbus. please help me.... refer some tutorial... :oops: :oops: :oops: :oops: :oops:

Re: plc automation

Posted: Sat Apr 19, 2014 5:12 pm
by BMS Doug
Hi arulmcts,

I found the s7 manual see page 163
7.10 7.10.1 7.10.2 Easy Book PtP, USS, and Modbus communication protocols Pointtopoint communication The CPU supports the following Point-to-Point communication (PtP) for character-based serial protocols: ● PtP (Page 164) ● USS (Page 165) ● Modbus (Page 167) PtP provides maximum freedom and flexibility, but requires extensive implementation in the user program. PtP enables a wide variety of possibilities: • The ability to send information directly to an external device such as a printer • The ability to receive information from other devices such as barcode readers, RFID readers, third-party camera or vision systems, and many other types of devices • The ability to exchange information, sending and receiving data, with other devices such as GPS devices, third-party camera or vision systems, radio modems, and many more This type of PtP communication is serial communication that uses standard UARTs to support a variety of baud rates and parity options. The RS232 and RS422/485 communication modules (CM 1241) and the RS485 communication board (CB 1241) provide the electrical interfaces for performing the PtP communications. Using the serial com munication interfaces Two communication modules (CMs) and one communication board (CB) provide the interface for PtP communications: ● CM 1241 RS232 ● CM 1241 RS422/485 ● CB 1241 RS485 You can connect up to three CMs (of any type) plus a CB for a total of four communication interfaces. Install the CM to the left of the CPU or another CM. Install the CB on the front of the CPU. Refer to the "Installation" chapter in the S7-1200 System Manual for detailed instructions on module installation and removal. 7.10 7.10.1 7.10.2 Easy Book PtP, USS, and Modbus communication protocols Pointtopoint communication The CPU supports the following Point-to-Point communication (PtP) for character-based serial protocols: ● PtP (Page 164) ● USS (Page 165) ● Modbus (Page 167) PtP provides maximum freedom and flexibility, but requires extensive implementation in the user program. PtP enables a wide variety of possibilities: • The ability to send information directly to an external device such as a printer • The ability to receive information from other devices such as barcode readers, RFID readers, third-party camera or vision systems, and many other types of devices • The ability to exchange information, sending and receiving data, with other devices such as GPS devices, third-party camera or vision systems, radio modems, and many more This type of PtP communication is serial communication that uses standard UARTs to support a variety of baud rates and parity options. The RS232 and RS422/485 communication modules (CM 1241) and the RS485 communication board (CB 1241) provide the electrical interfaces for performing the PtP communications. Using the serial com munication interfaces Two communication modules (CMs) and one communication board (CB) provide the interface for PtP communications: ● CM 1241 RS232 ● CM 1241 RS422/485 ● CB 1241 RS485 You can connect up to three CMs (of any type) plus a CB for a total of four communication interfaces. Install the CM to the left of the CPU or another CM. Install the CB on the front of the CPU. Refer to the "Installation" chapter in the S7-1200 System Manual for detailed instructions on module installation and removal.

Re: plc automation

Posted: Sun Apr 20, 2014 1:12 pm
by bubulindo
The S7-1200 has an ethernet port... I would go through that solution.

It should be possible for you to configure a UDP broadcast of the values you want and with a "simple" socket code in the Raspberry pi, catch those values.

I have done similar using Java with UDP broadcasts from a Simatic S7-300. On the 1200, it seems UDP wasn't supported and you had to use TCP/IP. Programming wise, shouldn't matter much on the raspberry pi. Setting it up on the PLC side, according to google, is simple.

Re: plc automation

Posted: Thu Apr 24, 2014 5:55 pm
by arulmcts
do you have any tutorial regarding this....... :oops: :oops: :oops: :oops:

Re: plc automation

Posted: Fri May 02, 2014 6:36 am
by jsobota
You might consider using the REX Control System. Once installed on Raspberry, you can communicate over Modbus with any device.
http://www.rexcontrols.com/rex-control- ... spberry-pi
A tutorial is part of the manual for Modbus.

Re: plc automation

Posted: Mon May 05, 2014 6:18 am
by arulmcts
if use REX xontrol system means pim will act as a PLC. but my concept is PLC has to be controlled by using pi. i have to gather data from PLC.

Re: plc automation

Posted: Tue May 06, 2014 8:22 pm
by jsobota
No problem with that, you can use REX just for monitoring. As long as you only read Modbus registers, you can gather data from the external PLC. And you get real-time running graphs etc.
If you want to exchange data in both directions, it is also possible. You just have to program your S7 to act as Modbus slave and RPi will act as Modbus master. In that case, RPi will write some data to Modbus register of the S7, the S7 will read it and process it (e.g. set its digital or analog output accordingly). The S7 will also measure some data using e.g. analog sensors and it will store the measurements in its Modbus registers. RPi will read those registers and you will be able to display it or do whatever you want to do with it.
It is also possible to use RPi as Modbus slave and S7 as Modbus master. Please provide more info how the S7 is configured.

Re: plc automation

Posted: Sat May 10, 2014 8:29 am
by arulmcts
ya sure... is it possible to use serial port as communication medium or i have to use ethernet port????

Re: plc automation

Posted: Sat May 10, 2014 9:29 am
by jsobota
You can use both serial (Modbus RTU) or ethernet (Modbus TCP) connection. If you want to use the native serial port of RPi (/dev/ttyAMA0), you have to disable the console input/output though. Keep in mind that you will probably need a level converter between RPi and S7.

You might also use a USB to RS485 converter. Just search "usb rs485" on ebay. You don't need to worry about logic levels then.

Re: plc automation

Posted: Sun May 11, 2014 2:38 pm
by arulmcts
i have to write anty coding to disable the console input/output of serial port of RPi (/dev/ttyAMA0)????

Re: plc automation

Posted: Mon May 12, 2014 8:14 am
by jsobota
You have to use the serial line /dev/ttyAMA0 exclusively for Modbus communication. By default Raspbian uses the Raspberry Pi serial port (GPIO14-GPIO15) to provide boot-up information and login prompt. You have to disable it, otherwise the Modbus communication would be disturbed and the 2 communicating devices might get confused.
See
http://www.raspberrypi-spy.co.uk/2013/1 ... rial-port/
or
http://raspberrypihobbyist.blogspot.cz/ ... -port.html
or
http://www.hobbytronics.co.uk/raspberry-pi-serial-port
for details.

Once you have done that, you can establish Modbus communication between RPi and S7. Do not forget the level converter if you decide to go this way!

Re: plc automation

Posted: Mon May 12, 2014 5:25 pm
by arulmcts
thnx......

Re: plc automation

Posted: Sat May 24, 2014 11:29 am
by arulmcts
I hav add more gpio means. What I have to do.....

Re: plc automation

Posted: Mon May 26, 2014 4:04 pm
by jsobota
I am afraid I do not understand your question. Have you succeeded in establishing the Modbus connection? Please describe the current state of your project and describe your goal with the GPIO pins in more detail.

Re: plc automation

Posted: Sat Jun 07, 2014 6:28 pm
by arulmcts
am using Omnet tool for modbus commnication simulation... my question is how many gpio pins in pi??? if want to add more gpiomeans what i have to do... am conslting with some networking guys for modbus communication...

Re: plc automation

Posted: Sat Jun 07, 2014 7:37 pm
by jsobota
If you disable SPI, I2C and system console on serial port, you can use up to 17 GPIO pins on your RPi. If that's not enough, one option is to plug in the Arduino. With MEGA2560 you get additional 54 GPIOs. And 16 analog inputs on top of that.

Re: plc automation

Posted: Sat Jul 19, 2014 4:55 pm
by TMorgan800
You will need the TIA Portal V13 software first of all.

Then you can set up your communications for TCP/IP on the S7-1200 PLC.

Then it is just a matter of making sure you get a communication handshake.

I do not know for sure if the Pi has a .gsd file or something similar for integration into a Siemens project.

There is quite a bit of help available from Siemens on how to set up the communication. ..
https://support.automation.siemens.com/ ... EW&x=0&y=0

Contact me if you need more help.
Troy.morgan@walterswholesale.com
I work for a Siemens distributor in California.

Re: plc automation

Posted: Sat Jul 19, 2014 5:00 pm
by TMorgan800
Here is a link to the S7-1200 Easy Book...

http://www.elintosprekyba.lt/library/fi ... _en-US.pdf

Re: plc automation

Posted: Sun Dec 14, 2014 6:25 am
by Entrabit
Looks like with Snap7 and a python library "python-snap7" you can get some solid easy communication via TCP. Without setting up tsends, trecv, get and put.
On how to install it is found here:
http://simplyautomationized.blogspot.co ... -1200.html

Re: plc automation

Posted: Mon Apr 04, 2016 3:37 pm
by aimad
hi,
I have the same problem as arulmcts. I have to connect a raspberry to s7 200 wich has the cpu 224XP and reference 214-2BD23-OXBO using the SIEMENS PPI protocol. please help