This shows you the differences between two versions of the page.
iothings:proiecte:2024:temperature_monitor [2025/01/13 21:01] alexandru.chirila01 |
iothings:proiecte:2024:temperature_monitor [2025/01/14 12:41] (current) alexandru.chirila01 |
||
---|---|---|---|
Line 10: | Line 10: | ||
---- | ---- | ||
- | This project is meant to monitor the temperature for a certain room: the room where the sensor will be placed. It is a simplist project consisting of two parts: | + | This project is meant to monitor the temperature for a certain room: the room where the sensor will be placed. It only prints data when the temperature changes by at least 0.5 °C since the last printed temperature value. It also plays a notification sound when this change of temperature occurs. The project consists of two separate parts: |
- | - An arduino program which monitors the temperature and sends it to a Firebase database | + | - An arduino program which monitors the temperature and sends it to a Firebase database. The program runs on an ESP32 |
- | - A Python script which can be run on any computer or even an Android phone or an iPhone (Python interpreter installation required) | + | - A Python script which gets the temperature from the database. It can be run on any computer or even an Android phone or an iPhone (Python interpreter installation required) |
+ | |||
+ | === Schematic === | ||
+ | ----- | ||
+ | |||
+ | {{:iothings:proiecte:2024:schema_2.png?600|}} | ||
=== Hardware Description === | === Hardware Description === | ||
Line 63: | Line 68: | ||
/* Assign the callback function for the long running token generation task */ | /* Assign the callback function for the long running token generation task */ | ||
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h | config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h | ||
- | |||
Firebase.begin(&config, &auth); | Firebase.begin(&config, &auth); | ||
Firebase.reconnectWiFi(true); | Firebase.reconnectWiFi(true); | ||
Line 88: | Line 92: | ||
As said before, the data read from sensor is saved in Firebase and is updated in real time in the output of the python script. | As said before, the data read from sensor is saved in Firebase and is updated in real time in the output of the python script. | ||
- | === Running the Python script === | + | === Python script === |
---- | ---- | ||
- | Running the python script is as follows: | + | In order for the Python script to run, the playsound3 library needs to be installed. Here is a simple way to install it via pip: |
- | $ python .\app_client.py | + | pip install git+https://github.com/sjmikler/playsound3.git |
- | Response status code: 200 | + | |
- | Temperature: 55.01°C | + | Running the python script is done as follows: |
- | Response status code: 200 | + | |
- | Temperature: 55.01°C | + | {{:iothings:proiecte:2024:running_the_script.png?700|}} |
=== References === | === References === | ||
https://randomnerdtutorials.com/esp32-firebase-realtime-database/ | https://randomnerdtutorials.com/esp32-firebase-realtime-database/ | ||
+ | |||
+ | https://github.com/sjmikler/playsound3 |