Tag Archives: Real Time Sensor Dashboard

Raspberry Pi Zero for a Real-Time Sensor Dashboard

Using the Raspberry Pi or RBPi, the single board computer (SBC), and a few applications from Google, you can have a functional dashboard showing real-time parameters from sensors. Google offers its App Engine in the form of a Platform as a Service or PaaS. The advantage is you can deploy and run your own applications using the Google infrastructure without bothering about exclusive ways of setting up hardware, servers, or Operating Systems.

Google also offers the free and powerful Google Charts that you can use as simple charting tools for plotting the data from the sensors into line charts. An HTML5 templates generator such as the Initializr is also useful for generating templates for the dashboard. Initalizr has several useful frontend resources such as Bootstrap and jQuery.

RBPi Zero is the perfect hardware platform to use for this project. This SBC is a full-fledged computer, but smaller than a credit card. It features a single-core CPU running at 1 GHz and 512 MB RAM. Along with a 40-pin GPIO header, the RBPi Zero has USB and a mini HDMI port.

When you connect a few sensors to the GPIO pins, the RBPi Zero sends their data over to the Google App Engine. On the dashboard, you can see the values and the charts updating in real-time as new data arrives from the sensors. Github carries the instructions for building and deploying the project for the RBPi Zero app and the App Engine dashboard.

For this project, Java is the programming language, as both the RBPi Zero and the Google App Engine support it – both use the Pi4J library. However, those who prefer Python can easily change the code, as both RBPi and the Google App Engine support Python as well. As the latest version of Raspbian, the Operating System of the RBPi comes pre-installed with Oracle Java 8, it is easy to deploy and run an executable JAR on the RBPi Zero.

The JAR acts as the go-between with the sensors and the Google App Engine – it reads inputs from the sensors and passes them on to the Google App Engine. You can use the Apache Maven to compile and build the code on the RBPi Zero. Of course, you may also build the code on your laptop or desktop and copy the resulting JAR over to the RBPi Zero.

You can use Cloud Endpoint on the Google App Engine side. This is a powerful service for creating a backend API by using annotations. This includes the client libraries for web and mobiles. It generates a Java based Android client for use with the RBPi Zero application. Google Qauth 2.0 authenticates the API for installed applications.

The RBPi Zero based hardware provides readings from three sensors – voltage generated by a solar cell, temperature from an analog temperature sensor, and illuminance or LUX from a photocell. A 10-bit Analog to Digital converter with SPI interface is necessary to covert the analog signal to a digital format suitable for the RBPi Zero. All the sensors work with a supply of 3.3V, and the RBPi Zero is capable of sourcing this.