This shows you the differences between two versions of the page.
iothings:proiecte:2023:smartplantmonitoringsystem [2024/01/14 18:09] nicusor.drogeanu |
iothings:proiecte:2023:smartplantmonitoringsystem [2024/01/15 18:45] (current) nicusor.drogeanu |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Smart Plant Monitoring System ====== | ====== Smart Plant Monitoring System ====== | ||
- | Student: Nicusor-Mirel Drogeanu | + | Student: Nicusor-Mirel Drogeanu \\ |
- | Master: ACES II | + | Master: ACES II \\ |
- | Git repository: TODO | + | Git repository: https://github.com/DrogeanuNicu/iot_project \\ |
- | Demo link: TODO | + | Demo link: https://drive.google.com/file/d/1pQIGBkYDs_wFQoDo-eFxLSXitbUCK-s_/view?usp=sharing \\ |
- | Presentation: TODO | + | Presentation: https://docs.google.com/presentation/d/1S5WGhz_DkgjawbWLUeJ0xflm8HtqspAb/edit?usp=drive_link |
====== Project Description ====== | ====== Project Description ====== | ||
Line 11: | Line 11: | ||
====== Hardware Description ====== | ====== Hardware Description ====== | ||
The hardware components needed for the project are: | The hardware components needed for the project are: | ||
- | * ESP32 board - The main microcontroller of the application, it is used to connect to WiFI in order to send MQTT messages. | + | * ESP32 board - The main micro-controller of the application, it is used to connect to WiFI in order to send MQTT messages. |
* DHT11 - The sensor used to collect the temperature and the air humidity. | * DHT11 - The sensor used to collect the temperature and the air humidity. | ||
- | * Soil moisture senzor - Used to get the moisture level of the soil. | + | * Soil moisture sensor - Used to get the moisture level of the soil. |
* LCD with I2C - Used to display the collected data. | * LCD with I2C - Used to display the collected data. | ||
* DC Motor - Used to control the fan. | * DC Motor - Used to control the fan. | ||
Line 19: | Line 19: | ||
* 12V DC power supply - Used to power the pump. | * 12V DC power supply - Used to power the pump. | ||
* 2 relays - To control the fan and the pump. | * 2 relays - To control the fan and the pump. | ||
- | * 10 K resistor - USed for the DHT11 sensor. | + | * 10 K resistor - Used for the DHT11 sensor. |
* Breadboard | * Breadboard | ||
* Wires | * Wires | ||
Line 25: | Line 25: | ||
Architecture Diagram: | Architecture Diagram: | ||
- | {{:iothings:proiecte:2023:iot_project_hw_diagram.png?800|}} | + | {{:iothings:proiecte:2023:iot_project_hw_diagram_new.png?800|}} |
Setup: | Setup: | ||
Line 31: | Line 31: | ||
{{:iothings:proiecte:2023:setup_drogeanu_iot_project.jpeg?800|}} | {{:iothings:proiecte:2023:setup_drogeanu_iot_project.jpeg?800|}} | ||
- | {{:iothings:proiecte:2023:setup_drogeanu_iot_project2.jpeg?800|}} | + | {{:iothings:proiecte:2023:setup_drogeanu_iot_project2.jpeg?600|}} |
+ | |||
+ | {{:iothings:proiecte:2023:full_setup_iot_drogeanu.png?800|}} | ||
+ | |||
+ | |||
+ | ====== Software Description ====== | ||
+ | |||
+ | Software prerequisites: | ||
+ | ESP-IDF was used for the ESP32 code(https://github.com/espressif/esp-idf). \\ ESP32 uses freeRTOS to easily use the 2 available cores. | ||
+ | |||
+ | ESP32 software diagram: | ||
+ | |||
+ | {{:iothings:proiecte:2023:sw_arhitecture_iot_drogeanu.png?800|}} | ||
+ | |||
+ | "Init" functions have their own tasks, because the init process for some components requires delays (e.g. LCD). In this way, the workload is split and freeRTOS can switch from one component to another when one of them needs to wait. | ||
+ | |||
+ | In the main loop there are 3 tasks that are running: | ||
+ | * Reads the sensor data, controls the fan and the pump. | ||
+ | * Prints the collected data to the LCD and sends it to the server via MQTT. | ||
+ | * Checks if any new MQTT message was received. If this is the case (the user set some new limits), the limits are updated. | ||
+ | |||
+ | |||
+ | Backend software diagram: | ||
+ | |||
+ | {{:iothings:proiecte:2023:server_sw_diagram_iot_drogeanu.png?800|}} | ||
+ | |||
+ | A flask application runs on RPI5, it communicates with the MQTT broker, Mosquitto, and responds to the user's HTTP requests. | ||
+ | A virtual python environment was used for development, so porting the application is easy. | ||
+ | |||
+ | Frontend software diagram: | ||
+ | |||
+ | {{:iothings:proiecte:2023:frontend_sw_diagram_iot_drogeanu.png?400|}} | ||
+ | |||
+ | React was used for the frontend. The application does fetch for the limits already set and also a dataset to render on the graphical components like table and graph. Then an interval is set to fetch the data every second. | ||
+ | |||
+ | ====== Web interface ====== | ||
+ | |||
+ | {{:iothings:proiecte:2023:web_interface-iot-drogeanu.png?800|}} | ||
+ | |||
+ | The web interface presents a chart, a table, one fan status switch, one pump status switch and a download button. | ||
+ | The chart allows to enable or disable the characteristics to allow observations only on a certain characteristic | ||
+ | Each characteristic in the table has an upper and a lower limit option, which can be changed according to the plant's needs. | ||
+ | By pressing the "Download" button, the user will get all the collected data in a "csv" format. | ||
+ | |||
+ | ====== Conclusions ====== | ||
+ | |||
+ | In conclusion, ESP32 is a fantastic option for an IoT project because of the different connection options it has. | ||
+ | Using ESP-IDF compared to Arduino has proven to provide more support for handling tasks on ESP32, thus allowing efficient use of hardware resources. | ||
+ | Using a web framework like Flask for the backend was a good choice, considering the scalability of this application. | ||