A success story all along the line – the Raspberry Pi. Although it is titled a tinkering computer, it is also being used more and more frequently in the automation industry. Here we show how easy it is to operate and monitor a Raspberry Pi with a CODESYS runtime from the cloud..
The Raspberry Pi is now also available in a form suitable for automation with DIN rail and matching IO. In our example, however, a simple starter kit is sufficient to simulate the IO. The circuit is quickly set up. Some LEDs signal states, which can be changed by push buttons.
After the hardware setup is complete, the software is installed. Our Raspberry first needs an operating system and a CODESYS runtime environment. We recommend the document “First Steps” in the CODESYS Store:
- https://www.raspberrypi.org/downloads/
- https://store.codesys.com/codesys-control-for-raspberry-pi-sl.html
- https://store.codesys.com/anyviz-cloud-adapter.html
The control program, in IEC 61131-3, is written quickly. Each of our three buttons inverts a logical variable that stands for a state. All three states are set to the GPIO outputs to which the LEDs are connected. An online update to our Raspberry and we can simulate the three states. But where is the cloud now?
Now we’re connecting to the cloud
From now on the exciting part begins – the connection to the AnyViz Cloud. For the connection to our Cloud, the AnyViz Cloud Adapter is required. This is quickly integrated into our control program as a library via the CODESYS Store. Afterwards only the symbols in the symbol configuration have to be ticked and AnyViz has to be called in our CODESYS program as a free-wheeling task.
In the web interface of the AnyViz portal we now create our HMI. We signal the states as icons with dynamic color switching. To set the individual states, we select the Vizual slide switch. For a long-term evaluation we activate the data recording at all three data points when changing values. A diagram for later analysis completes our HMI.
Conclusion
This simple example shows how easy it is with the portal software AnyViz to connect a controller to the cloud. The data can then be visualized and remotely operated and monitored with any device. The Raspberry Pi does not necessarily have to assume the role of controller. It is also ideally suited as a gateway to connect an existing automation solution to the Cloud. Our Universal Cloud Adapter without PLC environment is perfect for this.