This shows you the differences between two versions of the page.
iothings:proiecte:2023:tempandmonitorsystem [2023/12/12 16:36] andrei.ulmamei add bibliography |
iothings:proiecte:2023:tempandmonitorsystem [2024/01/08 14:57] (current) andrei.ulmamei added presentation |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====Temperature monitoring and control system for Server Room==== | + | ======Temperature monitoring and control system for Server Room====== |
Student: Andrei-Alexandru Ulmamei \\ | Student: Andrei-Alexandru Ulmamei \\ | ||
Master: ACES II \\ | Master: ACES II \\ | ||
Git repository: https://gitlab.upb.ro/aulmamei/iot-project \\ | Git repository: https://gitlab.upb.ro/aulmamei/iot-project \\ | ||
- | Demo link: To be added \\ | + | Demo link: [[https://drive.google.com/file/d/1Cp1NUnDxHuX82SSxTeIZHgxlJRuXop-W/view?usp=sharing|Demo]] \\ |
- | ===Project Description=== | + | Presentation: {{:iothings:proiecte:2023:iot_au.pdf|Presentation}} |
+ | |||
+ | ======Project Description====== | ||
This goal of this project is to create a temperature monitoring and control system, intended to be used in a server room, that consists of a Web Application, a microcontroller that communicates with the Web App, a sensor for monitoring temperature and an IR transmitter, used for controlling an air conditioning unit. | This goal of this project is to create a temperature monitoring and control system, intended to be used in a server room, that consists of a Web Application, a microcontroller that communicates with the Web App, a sensor for monitoring temperature and an IR transmitter, used for controlling an air conditioning unit. | ||
- | ===Hardware Description=== | + | ======Hardware Description====== |
The hardware components needed for the project are: | The hardware components needed for the project are: | ||
Line 33: | Line 35: | ||
The schematic was realized using KiCad (https://www.kicad.org/). | The schematic was realized using KiCad (https://www.kicad.org/). | ||
- | ===Software architecture=== | + | The hardware with all the components connected can be seen below: \\ |
+ | |||
+ | {{:iothings:proiecte:2023:hw.jpeg?700x400}} | ||
+ | |||
+ | |||
+ | ======Software architecture====== | ||
The code is composed of 4 elements: the embedded software, written in Arduino IDE for the ESP32 board, the Web Component, which was written in HTML and Javascript for the frontend functionality, the Firebase Realtime Database configuration and the Grafana dashboard configuration. | The code is composed of 4 elements: the embedded software, written in Arduino IDE for the ESP32 board, the Web Component, which was written in HTML and Javascript for the frontend functionality, the Firebase Realtime Database configuration and the Grafana dashboard configuration. | ||
Line 138: | Line 145: | ||
The data is stored under the node UsersData, which has a child node named using the user id. After that, two children nodes, one for control and the other for readings is created. The control node contains three data: the ac_status (which indicates if the A/C unit has been requested to turn on/off), the ac_temp (which indicated the temperature the A/C system should be set to) and the fan_speed (the fan speed the A/C should be set to). The readings section contains multiple nodes, each node's name being the timestamp at which the data has been acquired. This node contains both the temperature and the timestamp of acquisition. | The data is stored under the node UsersData, which has a child node named using the user id. After that, two children nodes, one for control and the other for readings is created. The control node contains three data: the ac_status (which indicates if the A/C unit has been requested to turn on/off), the ac_temp (which indicated the temperature the A/C system should be set to) and the fan_speed (the fan speed the A/C should be set to). The readings section contains multiple nodes, each node's name being the timestamp at which the data has been acquired. This node contains both the temperature and the timestamp of acquisition. | ||
- | **Grafana Dashboard** | + | **Grafana Dashboard** \\ |
+ | The Grafana Dashboard was used to create the temperature graph that is shown in the Web Application. Because the Grafana API doesn't support Firebase Realtime database connection, a further step was created using the Google Sheets API with Google Script. The Realtime database was connected to the Google Sheets API, and a Google Script was created which synchronizes the sheets document to the database. This was done by creating a trigger in the Google Scripts environment. | ||
+ | <code> | ||
+ | var base = FirebaseApp.getDatabaseByUrl(firebaseUrl, secret); | ||
+ | var dataSet = [base.getData()]; | ||
+ | var readings = dataSet[0]["UsersData"][db_uid]["readings"]; | ||
+ | var temps = []; | ||
+ | var timestamps = []; | ||
+ | for (var obj in readings) { | ||
+ | var timestamp_str = readings[obj]["timestamp"]; | ||
+ | var timestamp_int = parseInt(timestamp_str); | ||
+ | temps.push(readings[obj]["temperature"]); | ||
+ | timestamps.push(new Date(timestamp_int * 1000).toLocaleString("en-US")); | ||
+ | } | ||
+ | |||
+ | var rows = []; | ||
+ | for(i = 0; i < temps.length; i++) { | ||
+ | rows.push([timestamps[i], temps[i]]); | ||
+ | } | ||
+ | |||
+ | dataRange = sheet.getRange(2, 1, rows.length, 2); | ||
+ | dataRange.setValues(rows); | ||
+ | </code> | ||
- | ===Conclusion=== | ||
- | ===Bibliography=== | + | ======Conclusion====== |
+ | In conclusion, the ESP32 is a very suited hardware component for IoT applications, due to it's hardware integration of Wi-Fi and Bluetooth. The usage of Firebase was really facile, due to the multitude of internet examples. \\ | ||
+ | The most difficult task while creating this project was to understand the infrared commands that were coming from the remote control of the A/C unit. | ||
+ | ======Bibliography====== | ||
https://randomnerdtutorials.com/esp32-data-logging-firebase-realtime-database/ \\ | https://randomnerdtutorials.com/esp32-data-logging-firebase-realtime-database/ \\ |