DISCLAIMER: This project was solely developed by myself, for the class Electronic Systems for the Internet of Things, with components I had on the shelf. The model of the project, the main processing system and subsystems was my own call/choice. I have translated the C++ code presented in proj-code folder. All the images that I provide will appear in text in portuguese. Some items may appear partially finished.
With the code I provide, you won't be able to single-handedly replicate the project, but it is a great help for similar projects.
The objective of this project was to create a functioning system with multiple devices that communicated with each order in a typical IoT environment. Basically, the project is comprised of 1 main processing system and 2 subsystems, heating and ventilation:
-
The main processing system is composed of a Raspberry Pi 4 (connected to a router phisically with an ethernet cable), with 4 servers with different purposes.
-
MQTT Broker Mosquitto - Allows the arrival of messages into the many MQTT existent MQTT topics;
-
Data bridge Node-RED - Allows the easy connection between the MQTT broker and the storage in the database;
-
Real-time database InfluxDB - Allows the storage of all the incoming data in the respective fields inside a timetable, through database storage queries;
-
Dashboard Grafana - Allows the querying of the database in order to pull the data and display it in a graphical, more appealing manner.
-
-
The heating subsystem is composed of a digital temperature sensor (DS18B20) and a 1 kW resistor (100 Ω) controlled by an ESP32 connected to a SSR. Low voltage is on the microcontroller side (3.3 VDC), optically isolated from the 'high voltage' side (230 VAC), which is the voltage applied to the resistor. A circuit breaker was also used on the AC side for extra protection of the load. The ESP32 was connected to the same network as the Raspberry Pi, but wirelessly, through WiFi.
-
The ventilation subsystem is composed of an analog temperature sensor (LM35), a digital environmental sensor based on a BME680 IC, a 230 VAC fan controlled by an ESP8266, also connected to a SSR. Low voltage is on the microcontroller side (3.3 VDC), optically isolated from the 'high voltage' side (230 VAC), which is the voltage applied to the fan. A circuit breaker was also used on the AC side for extra protection of the load and a snubber circuit for the SSR high side protection against high reverse voltage provoked by the fan's coils. The ESP8266 was connected to the same network as the Raspberry Pi, but wirelessly, through WiFi.
A Telegram bot within a private group was created in order to receive commands and parametrize both subsystems wirelessly (through the same WiFi network), if desired. The temperature setpoint in both subsystems was configurable within a certain range as well as the upper and/or lower hysteresis for the ventilation subsystem.
The control system of heating and ventilation is based on an IoT topology. It is composed by 2 subsystems, the heating subsystem and the ventilation subsystem. These 2 subsystem are connected to a WiFi network, in which there's a device that hosts multiple servers, this device encomprises the main processing system, this last allows the diffusion of the data obtained in the subsystems. The device used in this main system is a Raspberry Pi 4, and hosts a Node-RED that allows to create a data bridge between the data sent by the subsystem and the remaining services, like the MQTT broker Mosquitto server and the database server InfluxDB, which therefore communicates with a dashboard server, called Grafana.
Project based in multiple hardware and software solutions:
The Main Processing System, based on a Raspberry Pi 4 with Raspbian and with the following servers:
Heating Subsystem, based on a Lolin NodeMCU V3 with a sensor shield.
Ventilation Subsystem, based on a WeMos LOLIN32 Lite (ESP32).
Below I present some of the grafana screenshots that I provided in my class report.