Serial Communication Between PLC and Raspberry Pi

Join Date
Nov 2014
Location
Lahore
Posts
12
Hello. I want to establish serial communication between the S7-300 and a raspberry pi. Toward that end, I'd like to begin by sending a simple 1 or 0 and have my PLC react accordingly. So I suppose you could say I want to use the raspberry pi as a switch. This is for testing purposes. I can transmit data from the raspberry pi via C++ or Python but I have no idea how to incorporate data received serially by the PLC in my ladder logic program. How can I accomplish this in Siemen's TIA Portal V13? Is there a block or instruction that I can insert into my ladder logic program and it will read the serial port? Thanks for the help in advance.
 
Modbus RTU is a simple and straightforward protocol. I'm not a Siemens guy, but it would surprise me if your PLC doesn't support it.
 
The S7-300 does support MODBUS. However, I cannot figure out how to implement that in the software. I am just a beginner as far as Siemens is concerned so I am having a hard time figuring out some of the more specialized stuff in the software.
 
For 35 Euros you can implement a CoDeSys PLC in your RPi.
http://store.codesys.com/codesys-control-for-raspberry-pi-sl.html

If with your testing you are OK with a 2 your timeout, then it is actually free.

I have played around with the Modbus/TCP which works great. I know it also supports Ethernet/IP but I haven't played with the Modbus/RTU but there is a pretty good forum for support:
http://forum.codesys.com/viewforum.php?f=21

I don't think it supports the /RTU directly but there is some mention of it on the forum.
 
Hi!

I am not familiar with TIA, but have used Step7 since it appeared back then.

The Youtube example is not relevant, as it shows an S7200 that is incompatible in all ways to your S7300.

In the S7 300 you will need a serial communication card like CP340 or CP341. Set it up with corresponding line speed, character bits, stop bits and parity. Use fhe function blocks BSEND and BRCV to write and read data.

Kalle
 
@Kalle
Thanks for pointing me in the right direction. I was able to configure TIA Portal and PLCSim to emulate an S7-300 PLC with a CP-340 card but I don't know how to put that to use in the ladder logic program. Cannot find the commands/instructions you mentioned. Got the software from uni. Maybe my license is limited in that I do not have access to all the blocks?

@boneless
The PLC at university does not have ethernet support sadly. Stuck with an MPI to USB adapter.
 
Thanks, boneless. I understand MPI is based off RS-485 so I can treat the C++ or Python program as normal serial communication, right? Access the USB port, configure the baud-rate etc. and send my data?
 
Theoretically, maybe. I don't know a whole lot about serial communication, but as I understand it, MPI is a proprietary protocol, and I have not seen anybody successfully dismember it. But I can be very wrong :).
 

Similar Topics

I am working to control some objects using Weintek HMI through Fatek PLC. I wrote a simple program to control an output Y_0 using input X_0. I...
Replies
3
Views
3,790
Hi Experts. I need your help, I wanna communicate a MIcro850 with L19ER CompactLogix through Serial communication (Modbus RTU). I am using...
Replies
2
Views
2,138
problem in communication between micrologix 1200 & Panel View 600 Plus by serial DF1 Hello Friends i have to do communication between micrologix...
Replies
6
Views
6,604
Hello everyone, I want to make a serial communication using Siemens S7-1200 with CM 1241 (RS-232) and communicate with my Arduino. Here is the...
Replies
13
Views
9,744
Hi everyone, I'm trying to go online with an IFM PLC over a serial connection, using CoDeSys. Things were working fine for a while; I managed to...
Replies
7
Views
11,420
Back
Top Bottom