Page 44 - ITU Journal Future and evolving technologies Volume 2 (2021), Issue 5 – Internet of Everything
P. 44
ITU Journal on Future and Evolving Technologies, Volume 2 (2021), Issue 5
• Memory Tags are tags which hold and store informa‑ The RaspberryPi communication is managed through the
tion; they can be seen as variables in a programming usage of MQTT, where:
language.
• Sensors’ information is published to the topic
• Expression Tags are tags which are driven by a user‑ rpi/cpu/temperature
de ined expression, such as a mathematical opera‑
• Actuators’ information is fetched by subscribing to
tion, a logical operation, and so on.
the topic rpi/fan/speed
• Query Tags are tags which pool their value from an
SQL statement. They can also refer to other tags to All the required logic is written using Python and exe‑
build dynamic queries. cuted at boot time by means of a crontab task.
• Reference Tags are tags which simply refer to other
tags to fetch their value.
Ignition, and the next Grafana tool, will be coupled with
OpenHAB to realize a simple yet real domotics system
with the support of real devices, as presented in Section 4.
3.5 Grafana
Grafana 10 is an open‑source web‑based tool for data vi‑
sualization and analysis. It allows the modeling of cus‑
tom dashboards, based on the required use cases and
supports different data sources, like: In luxDB,
Microsoft SQL Server, PostgresSQL, AWS CloudWatch,
etc. Also, it allows the development and installation
of custom modules/plugins which can expand its
capabilities. Fig. 2 – Domotics ‑ fan’s connection schema
4. CASE STUDY AND PROTOTYPE OpenHAB, presented in Section 3 and hosted on the home
NAS, is used to bridge the connection among the propri‑
In the case study presented herein, real devices are di‑ etary Xiaomi smart home sensors. The adopted modules
12
rectly connected to software applications and tools, which are: (i) Xiaomi Smart Home Binding , which is used to
are able to change their status. The idea is to build a sys‑ communicate with the sensor gateway; and (ii) MQTT
13
tem using the Ignition software SCADA solution to con‑ Binding , which is used to connect to an MQTT broker.
trol real devices connected to it. The list of used de‑ Con iguration for the Xiaomi binding is done through the
vices includes: (i) a RaspberryPi Zero W 11 with an at‑ OpenHAB web GUI, by providing the gateway IP and pri‑
tached computer fan; (ii) three Xiaomi room temperature vate API key, as shown in Fig. 3. By means of a web
and humidity sensors; and (iii) two Xiaomi smart plugs. GUI, it is possible to automatically search and add all de‑
Also, different host systems are involved: (i) Virtualbox tected/connected sensors creating for each a dedicated
to host the SCADA system; (ii) home NAS (Network At‑ item. Such an item is used in rule’s de inition to identify
tached Storage) to host the MQTT broker (deployed using the sensor. The MQTT binding is con igured by adding
Mosquitto); and (iii) cloud VPS to host historical database an appropriate thing ile in the OpenHAB con iguration
and data visualization UI. folder, thus allowing it to be referred in MQTT commu‑
The RaspberryPi Zero W behaves like an IoT enabled PLC. nication. The next step is de ining the logical rules to fol‑
PLC devices are equipped with sensors (to gather infor‑ low for publishing sensor data over MQTT. These are de‑
mation) and actuators (to perform actions). In this case, ined by adding rules’ ile into the OpenHAB con iguration
CPU temperature information is used to feed the sensor’s folder. The rule triggers on every detected state change
data. For the actuator, instead, an external fan is used and on the observed sensor by publishing its new value to the
controlled through the GPIO pins using Pulse Width Mod‑ appropriate topic, as de ined before.
ulation (PWM). PWM is a method used to control devices The core of the system is the Ignition SCADA, which is the
that require power or electricity. It essentially makes use software in charge of reading and managing all attached
of a digital signal, which is periodically turned on or off devices, connecting via the MQTT protocol. Ignition leans
to modulate the connected device. In particular, PWM is on a Microsoft SQL server database, which is used as a lo‑
used to control the fans’ motor; the larger the time frame cal buffer to periodically store and change the status of
between pulses is, the slower the motor turns. The sensors’ information in case the connection towards the
envisioned scheme is shown in Fig. 2. historical server is lost, but also to manage data migration
12
10 Grafana, interactive visualization tool. https://grafana.com https://www.openhab.org/addons/bindings/mihome/
11 https://www.raspberrypi.org/products/raspberry-pi-zero-w/ 13 https://www.openhab.org/addons/bindings/mqtt/
32 © International Telecommunication Union, 2021