top of page

SCADA: Raspberry Pi and Advanced HMI

Anchor 3
Introduction
 
What is SCADA?

 

According to Wikipedia SCADA is:  "a system operating with coded signals over communication channels so as to provide control of remote equipment. The control system may be combined with a data acquisition system by adding the use of coded signals over communication channels to acquire information about the status of the remote equipment for display or for recording functions". In short words, it's a system that will control outputs, receive and collect data about inputs and present all this data to operator.

 

Nowadays, there are plenty of comercial SCADA systems. Unfortunately, most of them cost a lot, are difficult in configuration and demands a lot of knowledge from engineer that configures them. But luckily, the world is not so brutal and there good people who share their software and enable us to build amateur automation systems that can monitor your home, office or garden. Moreover, thanks to technical progress, miniaturization and genius of Cambridge researches, we have brilliant Raspberry Pi that make our world easier. 

 

How to build simple your own SCADA?

 

According to the definition to build SCADA, we need: hardware, software and HMI. Probably, on the internet you will find many different proposals of SCADAs and its components - better, worse, cheaper or more expensive. My solution is based on two components:

  • Raspberry Pi

  • PC with Advanced HMI

 

In next lines I will describe how to integrate all these components into one system.

Advanced HMI is a software based on .NET framework and written in Visual Basic. It allows you to create HMI in very easy way - just by dragging and dropping proper components to the main screen. The big advantage (perhaps the biggest one) is that you can use it for free!

 

The second big advantage is that engineer doesn't need to know complicate details about code or the functionality - the configuration is so easy that everyone in just few minutes is able to prepare his own HMI. Furthermore, it's good to mention that it includes various communiction drivers e.g. Allen Bradley, Beckhoff, Modbus TCP/RTU, Omron and OPC (check here).

 

And last thing - this software works on Windows and the installation is very easy, it only demands Microsoft Visual Studio Express. Here you can see how easy it is to configure:

Python Application

 

Modbus server

 

As communication protocole I have use Modbus TCP. First of all - Advanced HMI has this drivers and moreover, there is Pymodbus library that makes work with this protocol very easy. You can find more information about Pymodbus in my previous article.

 

WiringPi

 

To control GPIO I used wiringPi library. I will not describe it more, all information you will find on the webiste: http://wiringpi.com/ and download this library from here: https://github.com/WiringPi/WiringPi-Python.

 

DHT11 sensor
 

DHT11 sensor measures temperature and humidity. First and foremost, it's very, very cheap. On the ebay you will find lots of it. But there is one problem. To read data from this sensor you have to count microseconds quite precisely. There are 40 bits and every bit lasts specific period of time - when it's "0" it's ca. 28us and it's "1" it's ca. 70us. The problem with Raspberry Pi is that it is not Real Time Operating System. It means that counting time can be problematic. I have found two libraries that allow you to read data from DHT11:

 

And I recommend the second one - it makes that your code during counting microseconds has high priority and therefore it's quite precise. The first one works really badly and about 40% of received packets include some errors.

 

Gspread
 

Gspread is Google API that allows us to connect with sheets from Google disc and edit them. I used it to prepare raports - it's very simple to download this file and convert it to more user-friendly Excel.

 

For me Gspread at the beginning seemed to be super easy to implement, but since April 2015 it changed and now to have access to your files on Google disc you need to use double authorization - previously your mail and password were enough. The authorization process demands to configure some settings in Google Developers Console, save these settings to json file, upload it to Raspberry Pi and finally share your file with mail that appears in json file... in short -  quite complicated.

 

More information about Google API and some goods tips how to authorize the access you will find in these websites:

 
Practical tests
 

Finally, I would like to show you how it works in practice. Here are some photos:

And here you can watch my movie:

All necessary files you will find here.

 

If you need some more information, are interested in some details, have some questions or just want to share with me your ideas - send me mail:

 

bottom of page