SCADA on Raspberry: myth or reality?

image






Winter Is Coming. Programmable logic controllers (PLCs) are being replaced by embedded personal computers. This is due to the fact that the power of computers allows one device to incorporate the functionality of a programmable controller, server, and (if the device has an HDMI output) an operator’s workstation as well. Total: Web server, OPC part, database and workstation in a single package, and all this at the cost of one PLC.



In the article, we will consider the possibility of using such embedded computers in industry. We take as a basis a device based on the Raspberry Pi, step by step we will describe the process of installing an open, free Open Source SCADA system of Russian development - Rapid SCADA on it, and also develop an abstract compressor station project in it, which will include remote control of the compressor and three valves, as well as visualization of the compressed air production process.



Immediately make a reservation that the problem can be solved in two ways. Fundamentally, they do not differ from each other in any way, the question is only in the aesthetic and practical component. So, we need:



1.1 The first option implies the presence of the Raspberry Pi 2/3/4 itself, as well as the presence of a USB-converter in RS485 (the so-called "whistle", which can be ordered from Alliexpress).



image






Figure 1 - Raspberry Pi 2 and USB-converter in RS485



1.2 The second option includes any ready-made solution based on Raspberry, recommended for installations in industrial environments with integrated RS485 ports. For example, such as in Figure 2, based on the Raspberry CM3 + module.

image






Figure 2 - AntexGate device



2. A device with Modbus for several control registers;



3. Windows PC to configure the project.





Stages of development:



  1. Part I. Installing Rapid SCADA on Raspberry;
  2. Part II Install Rapid SCADA on Windows;
  3. Part III. Project development and its download to the device;
  4. Conclusions.




Part I. Installing Rapid SCADA on Raspberry





1. Fill out the form on the Rapid Scada website to receive the distribution package and download the latest version for Linux.



2. Unzip the downloaded files and copy the “scada” folder to the / opt directory of the device.



3. We put three scripts from the daemons folder into the /etc/init.d directory



4. We give full access to three application folders:



sudo chmod -R ugo+rwx /opt/scada/ScadaWeb/config sudo chmod -R ugo+rwx /opt/scada/ScadaWeb/log sudo chmod -R ugo+rwx /opt/scada/ScadaWeb/storage
      
      





â €5. We make the scripts executable:



 sudo chmod +x /opt/scada/make_executable.sh sudo /opt/scada/make_executable.sh
      
      





â €6. Add repository:



 sudo apt install apt-transport-https dirmngr gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update
      
      





â € 7. Install Mono .NET Framework:



 sudo apt-get install mono-complete
      
      





â €8. Install Apache HTTP server:



 sudo apt-get install apache2
      
      





â € 9. Install additional modules:



 sudo apt-get install libapache2-mod-mono mono-apache-server4
      
      





â € 10. Create a link to the web application:



 sudo ln -s /opt/scada/ScadaWeb /var/www/html/scada
      
      





⠀ 11. From the downloaded archive in the “apache” folder, copy the scada.conf file to the / etc / apache2 / sites-available directory



 sudo a2ensite scada.conf
      
      





â € 12. We follow this path sudo nano /etc/apache2/apache2.conf and add the following to the end of the file:



 <Directory /var/www/html/scada/> <FilesMatch "\.(xml|log|bak)$"> Require all denied </FilesMatch> </Directory>
      
      





â € 13. We execute the script:



 sudo /opt/scada/svc_install.sh
      
      





â €14. Reboot Raspberry:



 sudo reboot
      
      





â €15. Open the website:



 http://IP- /scada
      
      





⠀ 16. In the window that opens, enter the login “admin” and the password “12345” .





Part II. Install Rapid SCADA on Windows



Installing Rapid SCADA on Windows is required to configure Raspberry and configure the project. In theory, you can do this on the raspberry itself, but in technical support we were advised to use the development environment on Windows, because here it works more correctly than on Linux.



So let's get started:



  1. We update the Microsoft .NET Framework to the latest version;
  2. Download the Rapid SCADA distribution kit for Windows and install it offline;
  3. Launch the Administrator application. In it we will develop the project itself.


When developing, you need to pay attention to some points:



1. The numbering of registers in this SCADA-system starts from 1 address, so we had to increase the numbering of our registers by one. In our case it is: 512 + 1 and so on:



image


Figure 3 - Numbering of registers in Rapid SCADA (the picture is clickable)



2. To reconfigure the directories and correctly deploy the project on the Linux operating system, go to “Server” -> “General Settings” in the settings and click the “For Linux” button:



image


Figure 4 - Migrating directories in Rapid SCADA (the picture is clickable)



3. We define the polling port for Modbus RTU in such a way as it is defined in the Linux system of the device. In our case, this is / dev / ttyUSB0



image


Figure 5 - Migrating directories in Rapid SCADA (the picture is clickable)



If you have any questions, all additional installation instructions can be obtained on the company's website or on their youtube channel .





Part III. Project development and its download to the device



Development and visualization of the project is created directly in the browser itself. This is not quite familiar after desktop SCADA-systems, but it is quite the place to be.



Separately, I would like to note a limited set of visualization elements (Figure 6). Of the built-in components, there is an LED, a button, a toggle switch, a link and a pointer. However, a big plus is that this SCADA-system supports dynamic images and text. With minimal knowledge of graphic editors (Corel, Adobe Photoshop, etc.), you can create your own libraries of images, elements and textures, and support for GIF elements will allow you to add animation to the visualization of the process.



image






Figure 6 - Schematic editor tools in Rapid SCADA



Within the framework of this article, there was no purpose to paint the process of graphic creation of a project in Rapid SCADA step by step. Therefore, we will not dwell on this point in detail. In the developer’s environment, our simple project “Compressed air supply system” of a compressor station is as follows (Figure 7):



image


Figure 7 - Scheme editor in Rapid SCADA (the picture is clickable)



Next, fill our project on the device. To do this, specify the IP address of the device for transferring the project not to localhost, but to our embedded computer:



image


Figure 8 - Downloading the project to the device in Rapid SCADA (the picture is clickable)



As a result, we got something similar (Figure 9). On the left side of the screen there are LEDs reflecting the status of the entire system (compressor), as well as the status of the valves (open or closed), and in the central part of the screen - visualization of the process with the ability to control devices using toggle switches. When you open one or another valve, the color changes from gray to green of both the valve itself and the corresponding trunk.



image


Figure 9 - Project compressor station (GIF-animation clickable)



Here you can download the file of this project for review.



Figure 10 shows how, on the whole, what we got looks like.



image






Figure 10 - SCADA system on Raspberry



conclusions



The emergence of powerful embedded industrial computers allows you to expand and complement the functionality of programmable logic controllers. Installing similar SCADA systems on them can cover the tasks of a small production or technological process. For larger tasks with a large number of users or an increased security requirement, you will most likely have to install full-fledged servers, automation cabinets and familiar PLCs. However, for points of medium and small automation, such as small industrial buildings, boiler houses, pump rooms or smart homes - such a solution seems appropriate. According to our calculations, such devices are suitable for tasks up to 500 data input-output points.



If you have experience in drawing in various graphic editors and you are not confused by the fact that you have to create elements of graphic displays yourself, then the option with Rapid SCADA for Raspberry is very optimal. Its functionality as a ready-made solution is somewhat limited, since it is Open Source, however, it also allows you to cover the tasks of a small industrial building. Therefore, if you prepare visualization templates for yourself, then it is quite possible to use this solution to integrate, if not all, then some part of your projects.



Thus, to understand how useful such a solution for Raspberry can be for you and how much your projects are replaceable with Open Source SCADA-systems on Linux, a reasonable question arises: what SCADA-systems do you use most often?



All Articles