arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

plc automation

Fri Apr 18, 2014 6:24 pm

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.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: plc automation

Fri Apr 18, 2014 10:49 pm

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.
Doug.
Building Management Systems Engineer.

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: plc automation

Sat Apr 19, 2014 6:30 am

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...

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sat Apr 19, 2014 3:59 pm

am using siemens plc type: SIMATIC S7-1200.
do you have any tutorial... plase refer some link

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sat Apr 19, 2014 4:39 pm

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:

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: plc automation

Sat Apr 19, 2014 5:12 pm

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.
Doug.
Building Management Systems Engineer.

bubulindo
Posts: 2
Joined: Fri Mar 21, 2014 9:14 am

Re: plc automation

Sun Apr 20, 2014 1:12 pm

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.

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Thu Apr 24, 2014 5:55 pm

do you have any tutorial regarding this....... :oops: :oops: :oops: :oops:

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Fri May 02, 2014 6:36 am

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.

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Mon May 05, 2014 6:18 am

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.

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Tue May 06, 2014 8:22 pm

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.

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sat May 10, 2014 8:29 am

ya sure... is it possible to use serial port as communication medium or i have to use ethernet port????

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Sat May 10, 2014 9:29 am

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.

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sun May 11, 2014 2:38 pm

i have to write anty coding to disable the console input/output of serial port of RPi (/dev/ttyAMA0)????

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Mon May 12, 2014 8:14 am

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!

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Mon May 12, 2014 5:25 pm

thnx......

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sat May 24, 2014 11:29 am

I hav add more gpio means. What I have to do.....

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Mon May 26, 2014 4:04 pm

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.

arulmcts
Posts: 13
Joined: Fri Apr 18, 2014 6:17 pm

Re: plc automation

Sat Jun 07, 2014 6:28 pm

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...

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: plc automation

Sat Jun 07, 2014 7:37 pm

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.

TMorgan800
Posts: 5
Joined: Sat Jul 19, 2014 4:45 pm

Re: plc automation

Sat Jul 19, 2014 4:55 pm

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.
[email protected]
I work for a Siemens distributor in California.

TMorgan800
Posts: 5
Joined: Sat Jul 19, 2014 4:45 pm

Re: plc automation

Sat Jul 19, 2014 5:00 pm

Here is a link to the S7-1200 Easy Book...

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

Entrabit
Posts: 1
Joined: Sun Dec 14, 2014 6:22 am

Re: plc automation

Sun Dec 14, 2014 6:25 am

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

aimad
Posts: 2
Joined: Mon Apr 04, 2016 3:12 pm

Re: plc automation

Mon Apr 04, 2016 3:37 pm

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

Return to “Automation, sensing and robotics”