This shows you the differences between two versions of the page.
iothings:proiecte:2021:soilmoisturemonitoringsystem [2022/01/13 19:05] andrei.simion1707 [Software] |
iothings:proiecte:2021:soilmoisturemonitoringsystem [2022/01/27 14:01] (current) andrei.simion1707 [Soil Moisture Monitoring System] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Soil Moisture Monitoring System ====== | ====== Soil Moisture Monitoring System ====== | ||
+ | <sub>author Andrei Simion</sub> | ||
+ | <sub>ACES 2022</sub> \\ | ||
+ | <sub>source code : [[https://gitlab.com/asimion/soil-moisture-monitoring-system|Soil Moisture Monitoring System Gitlab]]</sub>\\ | ||
+ | <sub>youtube demo : [[https://www.youtube.com/watch?v=GyXDtKF13-U| YT DEMO]]</sub> | ||
- | ===== Description ===== | + | =====I Description ===== |
The idea from which I started this project would be that we always forget to water the flowers, and in agriculture or even in the flower garden (or even the few flower pots in everyone's apartment) monitoring the soil moisture is imperative. If we want to have good crops or flowers that are healthy and grow beautifully. | The idea from which I started this project would be that we always forget to water the flowers, and in agriculture or even in the flower garden (or even the few flower pots in everyone's apartment) monitoring the soil moisture is imperative. If we want to have good crops or flowers that are healthy and grow beautifully. | ||
Line 9: | Line 13: | ||
In addition, the system will send a daily warning email at a certain time with the current value of soil moisture.\\ | In addition, the system will send a daily warning email at a certain time with the current value of soil moisture.\\ | ||
The purpose of this project is to have good irrigation management that will provide better crops or healthier plants. | The purpose of this project is to have good irrigation management that will provide better crops or healthier plants. | ||
- | ===== Hardware ===== | + | =====II Hardware ===== |
As hardware components for the realization of this project I used: | As hardware components for the realization of this project I used: | ||
Line 56: | Line 60: | ||
{{:iothings:proiecte:2021:soil_moisture_system_hw.jpeg?400| Soil Moisture Monitoring System HW Diagram }} | {{:iothings:proiecte:2021:soil_moisture_system_hw.jpeg?400| Soil Moisture Monitoring System HW Diagram }} | ||
=====III Software ===== | =====III Software ===== | ||
- | {{:iothings:proiecte:2021:software_schematic_soil_moisture_system.jpeg?300| Software Diagram}} | + | {{:iothings:proiecte:2021:software_schematic_soil_moisture_system.jpeg?700| Software Diagram}} |
- | **CONFIG PHASE** | + | **CONFIG PHASE**\\ |
In this part of the code I have defined macros and declared global configuration variables specific to the operation of peripherals, connections to servers and APIs that will allow us to make various setup function calls in the next step.\\ | In this part of the code I have defined macros and declared global configuration variables specific to the operation of peripherals, connections to servers and APIs that will allow us to make various setup function calls in the next step.\\ | ||
- | **setup()** | + | **setup()**\\ |
At this step all the initializations of peripherals, services, etc. that we need are done:\\ | At this step all the initializations of peripherals, services, etc. that we need are done:\\ | ||
Line 67: | Line 71: | ||
- the LCD screen initializes | - the LCD screen initializes | ||
- trying to connect to the network via WiFi by calling the try_connect_WiFi() function | - trying to connect to the network via WiFi by calling the try_connect_WiFi() function | ||
- | - initialize connection to NTP server and test requesting current date via print_localtime_test () | + | - initialize connection to NTP server and test requesting current date via print_localtime_test() |
- | - SMTP is initialized with smtp.debug (1) to print the debug mode of the service on the serial and with smtp.callback(smtpCallback) the callback function is set to obtain information about the status of the email being sent | + | - SMTP is initialized with smtp.debug(1) to print the debug mode of the service on the serial and with smtp.callback(smtpCallback) the callback function is set to obtain information about the status of the email being sent |
- | - the SMTP session is initialized with the call of the set_session_config (*) function and the header of the message to be transmitted, by the call of the set_message_header (*) function | + | - the SMTP session is initialized with the call of the set_session_config(ESP_Mail_Session*) function and the header of the message to be transmitted, by the call of the set_message_header(SMTP_Message*) function |
- | **loop()** | + | **loop()**\\ |
This is the main loop. Once you reach this stage, the code described in the loop() function will run indefinitely(endless). Basically here is a description of the functionality of the entire system. The following main operations are performed here: | This is the main loop. Once you reach this stage, the code described in the loop() function will run indefinitely(endless). Basically here is a description of the functionality of the entire system. The following main operations are performed here: | ||
- the call of the compute_moisture_percentage() function is made and the soil moisture sensor is read and the obtained value will be transformed into percentages. | - the call of the compute_moisture_percentage() function is made and the soil moisture sensor is read and the obtained value will be transformed into percentages. | ||
Line 77: | Line 81: | ||
- by calling the MQTT_connect () function we connect to the feed in the dashboard on io.adafruite.com | - by calling the MQTT_connect () function we connect to the feed in the dashboard on io.adafruite.com | ||
- data is published calling SoilMonitoring.publish(moisturePercentage) | - data is published calling SoilMonitoring.publish(moisturePercentage) | ||
- | - by calling the get_time_hour() function I request the NTP server for the current hour and minute and then I check if they are the ones I specified. if this condition accomplished i will call send_message(String) | + | - by calling the get_time_hour() function I request the NTP server for the current hour and minute and then I check if they are the ones I specified. if this condition accomplished i will call send_message(String) |
+ | |||
+ | {{:iothings:proiecte:2021:soil_moisture_monitor_system.jpeg?400| Soil Moisture Monitoring System}} | ||
===== Bibliography ===== | ===== Bibliography ===== | ||
+ | - [[https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf|ESP32 WROOM datasheet]] | ||
+ | - [[https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/| LCD I2C]] | ||
+ | - [[https://www.dfrobot.com/product-599.html| Soil Moisture Sensor]] | ||
+ | - [[https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/| Installing the ESP32 board in Arduino IDE]] | ||
+ | - [[https://randomnerdtutorials.com/esp32-troubleshooting-guide/| ESP32 Troubleshooting guide]] | ||
+ | - [[https://electropeak.com/learn/esp32-ntp-client-server-get-date-and-time// | ESP32 client server get data and time (NTP server)]] | ||
+ | - [[https://www.survivingwithandroid.com/send-email-using-esp32-smtp-server/ | Send E-mail using ESP32 SMTP server]] | ||
+ | - [[https://iotdesignpro.com/projects/how-to-connect-esp32-mqtt-broker|How to connect ESP32 to MQTT server]] |