HCAB
Posts: 5
Joined: Mon May 08, 2017 8:48 pm

Simple communication between RPi and PLC

Fri May 04, 2018 10:04 am

Hi all,

I have constructed a quality surveillance device based on RPi / python. The device is implemented on a factory. Now, the factory wants to set the sensitivity of the device from their factory PLC (a S7). So I need some communication between the two.
Now you think ethernet - but using ethernet in a factory environment is not easy here. Lots of firewalls and people who dont want the security risk.
However, if I could sneak the sensitivity signal through the digital ports of the PLC => RPi, nobody would care. I just want a number with 8-12 bit resolution through. there is plenty of time available as changes in sensitivity is associated with product changes with the line standing still.
I would like to send some kind of check or validation back from the RPi to the PLC for confirmation.
For some PCB reasons, I have 2 digital input ports and 3 digital outputs available on the RPi.
Anybody have some suggestions or experience on how to do this smart?

Thanks :-)

nios2
Posts: 38
Joined: Mon Mar 12, 2018 3:22 am

Re: Simple communication between RPi and PLC

Sun May 06, 2018 3:17 am

1st step is to ensure that the voltage from the PLC to the Pi is within the GPIO range.

What type of functionality is available on the S7 digital outputs?

A crude method might be to use your GPIO in a primitive bit banging SPI (Serial Peripheral Interface) mode. Your PLC acts as the master by providing a clock pulse and serial data stream (2 inputs to the Pi) . Your Pi can reply to the PLC via an output GPIO.

User avatar
CFLanger
Posts: 35
Joined: Fri Feb 06, 2015 5:04 pm
Contact: Website

Re: Simple communication between RPi and PLC

Wed May 16, 2018 6:05 pm

you need to implement MODBUS RTU. Code a modbus slave thread on the pi using libmodbus. The PLC ladder logic programming can easily add a modbus master to poll the Pi for a single register with the setting u want to transfer.
CFLanger
Senior Software Engineer at
www.ljtechnologies.com

ranpitime
Posts: 65
Joined: Sat Mar 23, 2013 5:21 am

Re: Simple communication between RPi and PLC

Thu May 17, 2018 5:30 pm

Hi,
but why not connect the Pi via Profinet to the S7 world?
With the CODESYS plc installed on the Pi,
the Pi could act as Profinet Controller or Profinet Device...
https://faq.codesys.com/display/CDSFAQ/Raspberry+-+FAQ

BR
ranpitime
Last edited by ranpitime on Fri May 18, 2018 3:40 am, edited 1 time in total.

User avatar
CFLanger
Posts: 35
Joined: Fri Feb 06, 2015 5:04 pm
Contact: Website

Re: Simple communication between RPi and PLC

Thu May 17, 2018 5:58 pm

modbus is free.
CFLanger
Senior Software Engineer at
www.ljtechnologies.com

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 5 guests