AutomationMax
Posts: 2
Joined: Tue Apr 23, 2019 12:19 am

PLC and Raspberry PI 3 B

Tue Apr 23, 2019 2:30 am

Hi,

This is my first Raspberry Pi project! I am using a PI3B which is installed in the back of a touch screen monitor. I do also have a PLC which is controlling the equipment.

It goes like this :

Code: Select all

+--------------------------------+
|              PLC               |
|           Codesys with         |
|           webvisu              |   >>-----------+
|           FTP Server           |                    |
|           OPC UA Server        |                    |
+--------------------------------+                    |
						  +---------------+
                                                  |  ROUTER | <<---WAN -------- INTERNET
						  +---------------+
+--------------------------------+                    |
|              RPI3B             |                    |
|           Displaying           |                    |
|            web visu            |   <<-----------+
|            in KIOSK mode       |
|                                |
+--------------------------------+

I would like to add some feature to this setup:
-Share data between RPI and PLC
-Logs tags from the PLC into the RPI
-Send e-mail with RPI on PLC event (trigger, receiver address and text data will be from the PLC)
-Web control of the webvisu (VNC?)
-Remote control of the PLC (openVPN?)

I do not know from where to start at this point, and I would like to receive some advise.

What is the better way to share tags in this situation?
After that, how can I trigger events like sending e-mail or log data to a file?
Is VNC viewer a reliable and secure way to execute simple remote control?
Is opvenVPN will let me connect to the PLC?

User avatar
Joel_Mckay
Posts: 289
Joined: Mon Nov 12, 2012 10:22 pm
Contact: Website

Re: PLC and Raspberry PI 3 B

Tue Apr 23, 2019 9:30 am

You probably should look into a proper industrial HMI for you vendor's PLC, and a commercial VPN-appliance/router designed for this kind of application.

The Pi is not intended for industrial environments, and will not meet legal or safety certification requirements without design specific lab paperwork. Note, while a pi will pass CE/FCC, it will usually fail industry specific ISO requirements.

And no, adding a remote administration tool will not ensure your control system will function correctly over the network, or prevent random stalls when openvpn decides to take a vacation.

Best of luck,
J

AutomationMax
Posts: 2
Joined: Tue Apr 23, 2019 12:19 am

Re: PLC and Raspberry PI 3 B

Tue Apr 23, 2019 2:03 pm

Hi Joel,

Thank you for reply.

I do perfectly understand your worries. But to make things clear, I will not use this PI as a commercial or industrial solution. It is only intended to challenge myself. I've been around PLCs programming for decades and I see this as a way to learn some basics in networking and other programming language as maybe C#, python...

So, buying an industrial HMI will certainly make it, but it will not help me to learn something new!

Regards,

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: PLC and Raspberry PI 3 B

Thu Apr 25, 2019 12:22 pm

There are a number of good open source SCADA HMI projects for Linux, most would be portable to an RPI.

Linux (BSD aka Raspbian) are perfectly suited to industrial HMI applications, with the proper software. I do not agree with the statement that you must use the PLC providers expensive, feature less, usually Windows based HMI suite. There are many better, cheaper and more featured HMI/SCADA suites available.

What I do take exception to is people proposing RPI's instead of PLC's with sloppy DIY code, no understanding of 'Reliable Software Design' principals, in applications where controller failure could create a hazardous situation.

PLC's have their place, and so do RPI's.

I have delivered countless PLC-->RPI hybrid projects, feel free to discuss any questions you may have.
..the only thing worse than a stupid question is a question not asked.

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: PLC and Raspberry PI 3 B

Thu Apr 25, 2019 12:40 pm

Joel_Mckay wrote:
Tue Apr 23, 2019 9:30 am
Note, while a pi will pass CE/FCC, it will usually fail industry specific ISO requirements.
A very general and broad statement, and IMHO inaccurate. I invite you to specify an ISO Standard that a RPi would fail to meet, but a PLC would.

In all systems design, especially Reliable Control or Industrial applications, the entire system (hardware, infrastructure, environment, O/S and application) must be considered jointly. To make a blanket statement that a RPI is not suitable for I or RC applications is incorrect. The RPI hardware, combined with a suitable O/S, and application software can (and is) be used for mainstream industrial applications, where appropriate. There are several new entrants to the mainstream PLC market that are based on RPI H/W, RTLinux and suitable ladder style application builders. All certified to ISO/FCC/UL/EU standards.

My point is, 'horses for courses'. RPI (and all similar SBC embedded Linux controllers) add a new dimension to any I or RC system design challenges.

Dont get me wrong, I am a die hard PLC Industrial Design Engineer, obsessed with reliability and safety. Unlike a lot of mainstream PLC providers grappling with how to compete with this new technology disruptor.

Lecture over, apologies to all. Excuse my obsession with anyone who makes sleeping, generalist statements, especially in a forum for beginners and students.
..the only thing worse than a stupid question is a question not asked.

User avatar
Joel_Mckay
Posts: 289
Joined: Mon Nov 12, 2012 10:22 pm
Contact: Website

Re: PLC and Raspberry PI 3 B

Thu Apr 25, 2019 5:34 pm

omegaman477 wrote:
Thu Apr 25, 2019 12:40 pm
A very general and broad statement, and IMHO inaccurate. I invite you to specify an ISO Standard that a RPi would fail to meet, but a PLC would.
...
Lecture over, apologies to all. Excuse my obsession with anyone who makes sleeping, generalist statements, especially in a forum for beginners and students.
I encounter Pis professionally, and due to the design choices it will fail numerous ISO EMC and EMI lab test standards. The reason this happens is primarily the lack of shielding on versions without metal-encapsulated chips, poor cost-optimized power-supply choices, and usb based Ethernet chips dropping RF spurs. Some tests also include exposure to Radar, which again is unsafe for most consumer grade devices.

While an opinion can't be false, I do strongly recommend you review the specific rules for your intended application. As an un-shielded Pi will interfere with Safety Beacons it is illegal to have near ships in my country, and can get you a $5k fine or 1 year in jail. The lab certified spectra for this specific marine standard was posted in another thread (similar subject matter), and note a government representative will not care about your personal feelings when serving your group a warrant to seize the offending equipment.

Also, the regular Pi is not industrial grade by a any stretch of the imagination, and is not even as reliable as an atmel based Arduino in some ways.. This doesn't infer every overpriced HMI system is reliable either, given there is an ecosystem of people who would write 747 nav code in JavaScript if given a chance to do so. However, the internal SoC itself minimally requires additional monitoring, as one cannot rely on the on-chip watchdog silicon in some failure modes (pi B+/2/3/3B+ releases). There is also the flash memory write limits, that constrain what kind of use-cases you can get away with long-term.

I invite you to read the standards for your specific application, and understand they apply to everyone under most circumstances with few exceptions.... Even if someone is part of this forum, and having fun building stuff. You are correct in that neither of our opinions really change the legal rules that may be applied in any given region. ;-)

There are some great little projects around for DIY EMC design pre-checks, and well worth the effort to peruse:
https://www.youtube.com/watch?v=2xy3Hm1_ZqI

Best of luck,
J

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

Re: PLC and Raspberry PI 3 B

Sat Apr 27, 2019 4:43 pm

Hi,
you mean you you want to share data between the CODESYS plc and some
other applications which are running on the PI?

OPCUA is not a bad option do do this.
You could use a python client to access the symbols in the CODESYS plc.

For me VNC running on the PI is a good option to do the HMI stuff from remote.(Webvisu - in CODESYS)
Sure to change the plc application you need to setup VPN on the PI.

BR
ranpitime

lawsonkeith
Posts: 12
Joined: Mon Jun 30, 2014 8:11 pm

Re: PLC and Raspberry PI 3 B

Sun Apr 28, 2019 7:04 am

Hi

For data exchange you could use an OPC server which would be the most obvious way of doing it. Failing that Modbus TCP/IP can be used as well but it's really a fieldbus protocol so not ideal. They'd be the obvious generic SCADA and fieldbus protocols I'd look at.

I'd avoid vnc and try and do any admin over ssh, openVPN is just a way of encrypting data by the way if that's important to you. If not I'd avoid it as it'll complicate what you're doing a bit.

Have a look at nodeRed, it'll do user interface and Modbus / OPC I think.

So far as it being not fit for purpose it depends on the application, most industrial PCs I've seen aren't anything special so for a lot of tasks it'll be fine, just don't use it an anything safety critical. That applies to PLCs too really though as you'd need safety variants for those too is you're doing anything safety critical, not to mention all the going through relevant safety standards.

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

Re: PLC and Raspberry PI 3 B

Sun Apr 28, 2019 8:31 am

Hi,
correct me if I'm wrong.
the first request was - share symbols / or data between the CODESYS plc and the PI ( both are running on the same PI?!)
So there is no additional OPC server needed only either OPC UA or shared memory.
The OPC UA server is embedded in the CODESYS plc runtime and is therefore running on the PI ( you need just to add/configure symbold
which you want to share make accessible)
-> so you need OPC UA client on your application side.
https://forum.codesys.com/viewtopic.php ... 932#p19932
Possible is to use shared memory too ( to communicate between your PI application and the plc and share data)
In CODESYS you do not need any addition HMI, everything is embedded... even with your touchmonitor just use it as HMI in CODESYS.
(Webvisu fullscreen mode)
So then you are set and just need to use:
https://www.raspberrypi.org/documentati ... ccess/vnc/
to do the clicks from remote ;-)


BR
ranpitime

Return to “Automation, sensing and robotics”