This shows you the differences between two versions of the page.
iothings:proiecte:2021:smart-irrigation-system [2022/01/28 12:46] teodor_sorin.ghidiu [Smart Irrigation System] |
iothings:proiecte:2021:smart-irrigation-system [2022/01/28 18:36] (current) teodor_sorin.ghidiu |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Smart Irrigation System ====== | ====== Smart Irrigation System ====== | ||
+ | |||
<sub>Author: Ghidiu Teodor Sorin</sub> | <sub>Author: Ghidiu Teodor Sorin</sub> | ||
+ | |||
+ | <sub>Master: SSA</sub> | ||
+ | |||
+ | <sub>GitHub: https://github.com/SorinSr/SmartIrrigationSystemESP </sub> | ||
\\ | \\ | ||
Line 9: | Line 14: | ||
=== I. Short Description === | === I. Short Description === | ||
- | The purpose of this project is to create a smart irrigations system developed for home use, but scalable to industial applications also. The whole idea started when I planted some hot peppers, but after some weeks I forgot to water them, so they died. The best way to deal with this problem was to develop to develop an automation for this process. | + | The purpose of this project is to create a smart irrigations system developed for home use, but scalable to industrial applications also. The whole idea started when I planted some hot peppers, but after some weeks I forgot to water them, so they died. The best way to deal with this problem was to develop to develop an automation for this process. |
- | The proposed system is continuously monitoring soil moisture, air humidity and temperature, and based on those imputs system decides whether to water the plants or to wait. These three measures are displyed on a small screen and also they are transmited to a Blynk Cloud and from there they are displayed on the web dashboard and also in the mobile app. The water level from the tank is visible as well Blynk app, and also an on-tap watering function is avaliabale, to water the plants whenever needed. | + | The proposed system is continuously monitoring soil moisture, air humidity and temperature, and based on those inputs system decides whether to water the plants or to wait. These three measures are displayed on a small screen and also they are transmitted to a Blynk Cloud and from there they are displayed on the web dashboard and also in the mobile app. The water level from the tank is visible as well Blynk app, and also an on-tap watering function is available, to water the plants whenever needed. |
=== II. Hardware Description === | === II. Hardware Description === | ||
- | For this project I used multiple components, in order to monitor, controll, display and trigger actions. | + | For this project I used multiple components, in order to monitor, control, display and trigger actions. |
**ESP-WROOM-32S:** low-cost microcontroller very suitable for applications like this because it incorporates WI-FI, Bluetooth, GIPIO Pins with digital and analog I/Os, I2C and many more. Another thing that was very helpful, was the integration with Arduino IDE. | **ESP-WROOM-32S:** low-cost microcontroller very suitable for applications like this because it incorporates WI-FI, Bluetooth, GIPIO Pins with digital and analog I/Os, I2C and many more. Another thing that was very helpful, was the integration with Arduino IDE. | ||
- | **OLED Display SSD1306:** a small 0.96 inch display with 128x64 pixels resolution that was uesd to display temperature, humidity and soil moisture. This device is using I2C communication protocol, so in order to communicate with it, was required to use the suitable pins for this: GPIO21 – SDA and GPIO22 SCL. | + | **OLED Display SSD1306:** a small 0.96 inch display with 128x64 pixels resolution that was used to display temperature, humidity and soil moisture. This device is using I2C communication protocol, so in order to communicate with it, was required to use the suitable pins for this: GPIO21 – SDA and GPIO22 SCL. |
- | **DHT11:** this sensor is used to measer the temperature and humidity. It has a high precision and large measurmet range: 0 to 50 Celsius dergees, for temperature, and 20 to 90% humidity. | + | **DHT11:** this sensor is used to measure the temperature and humidity. It has a high precision and large measurement range: 0 to 50 Celsius degrees, for temperature, and 20 to 90% humidity. |
**Moisture sensor:** this sensor has to parts, one that comes in contact with water, and the other one, that process and send data. One interesting thig about this sensor is the fact that it can have an analog output and also a digital one. It has adjustable sensitivity and an indicator LED to show when the maximum value is obtained. | **Moisture sensor:** this sensor has to parts, one that comes in contact with water, and the other one, that process and send data. One interesting thig about this sensor is the fact that it can have an analog output and also a digital one. It has adjustable sensitivity and an indicator LED to show when the maximum value is obtained. | ||
**Water level sensor:** another sensor which stays in water. This sensor has an analog output and a LED to indicate it is functioning. | **Water level sensor:** another sensor which stays in water. This sensor has an analog output and a LED to indicate it is functioning. | ||
- | SRD-50VDC-SL-C relay module: this realy was ued to controll the water pump. Low current signal triggers the relay in order to open or close the circuit. This type of rellays support up to 250V and 10A. | + | SRD-50VDC-SL-C relay module: this relay was used to control the water pump. Low current signal triggers the relay in order to open or close the circuit. This type of relays support up to 250V and 10A. |
**Water pump:** this pump is very useful because it can function under water without problems and it has an imput voltage between 3 and 6V. | **Water pump:** this pump is very useful because it can function under water without problems and it has an imput voltage between 3 and 6V. | ||
Other components used: **battery holder**, to power the pump, **jump wires** and **breadboard** to make all the connections. | Other components used: **battery holder**, to power the pump, **jump wires** and **breadboard** to make all the connections. | ||
+ | |||
+ | |||
+ | {{ :iothings:proiecte:2021:whatsapp_image_2022-01-28_at_13.17.58.jpeg?600 |}} | ||
+ | |||
=== III. Software Description === | === III. Software Description === | ||
Line 37: | Line 46: | ||
• **WiFi.h** and **WiFiClient.h** were needed for WI-FI communication | • **WiFi.h** and **WiFiClient.h** were needed for WI-FI communication | ||
- | • **BlynkSimpleEsp32.h** - is the library used in order to send and retreive data from Blynk IoT external service. Template ID, device name and auth tocken were needed to connect to the service. Thisi credentials were hard-coded at the beeging of the file. | + | • **BlynkSimpleEsp32.h** - is the library used in order to send and retrieve data from Blynk IoT external service. Template ID, device name and auth token were needed to connect to the service. This credentials were hard-coded at the begging of the file. |
- | • **DHT.h** - is the library needed to read values from temperature and humidty sensors. In order to use the appropiate methods DHT11 type and the dedicated pin were specified. | + | • **DHT.h** - is the library needed to read values from temperature and humidity sensors. In order to use the appropriate methods DHT11 type and the dedicated pin were specified. |
• **Wire.h** - is used in order to facilitate communication using I2C protocol, used by the OPED screen. | • **Wire.h** - is used in order to facilitate communication using I2C protocol, used by the OPED screen. | ||
Line 45: | Line 54: | ||
• **Adafruit_GFX.h** and **Adafruit_SSD1306.h** are the libraries used to display and customize text on SSD1306 OLED screen. | • **Adafruit_GFX.h** and **Adafruit_SSD1306.h** are the libraries used to display and customize text on SSD1306 OLED screen. | ||
- | Firstly, were initialized al the needed variables for pins, WI-FI and external services credentials and screen setings. | + | Firstly, were initialized al the needed variables for pins, WI-FI and external services credentials and screen settings. |
After that, sendTempHumid() method was defined in order to read date from the DHT11 sensor, validate data and send it to Blynk for further processing and displaying. | After that, sendTempHumid() method was defined in order to read date from the DHT11 sensor, validate data and send it to Blynk for further processing and displaying. | ||
Line 66: | Line 75: | ||
</code> | </code> | ||
- | Now, data retreinved from soil moisture and water level sensors is read, processed, validated and sent to cloud. In this methdod, based on the soil moisture value relay is actioned to start the water pump. | + | Now, data retrieved from soil moisture and water level sensors is read, processed, validated and sent to cloud. In this method, based on the soil moisture value relay is actioned to start the water pump. |
<code> | <code> | ||
Line 114: | Line 123: | ||
</code> | </code> | ||
- | In setup() method Serial port is being initialized, relay is opened, display is initialized, authentication to Blynk is made and dht is started. Lastrly, the timer for the two measurments functions is set. | + | In setup() method Serial port is being initialized, relay is opened, display is initialized, authentication to Blynk is made and dht is started. Lastly, the timer for the two measurements functions is set. |
<code> | <code> | ||
Line 132: | Line 141: | ||
</code> | </code> | ||
- | In loop() method Blynk and tmier are started, and data is displayed on screen. | + | In loop() method Blynk and timer are started, and data is displayed on screen. |
<code> | <code> | ||
Line 179: | Line 188: | ||
- | Here are some samples from Blynk web and mobile dashboars: | + | Here are some samples from Blynk web and mobile dashboards and code flow: |
+ | |||
+ | {{:iothings:proiecte:2021:blynk_mobile.jpg?300 |}} | ||
+ | |||
+ | {{ :iothings:proiecte:2021:sdfcapture.jpg?300|}} | ||
+ | |||
+ | {{ :iothings:proiecte:2021:blynk_web.jpg?300 |}} | ||
+ | |||
+ | |||
+ | === IV. Issues and solutions === | ||
+ | |||
+ | One funny issue, run out of jump wires and I was forced to glue them using glue gun. | ||
+ | At begging had some problems with Blynk IoT new developed app and understanding how to use it. | ||
+ | Some of the sensors don’t have any pin notations on them, and I had to try multiple times how to connect. | ||
- | {{ :iothings:proiecte:2021:screenshot_20220128-034715_blynk_iot.jpg?200 |}} | + | === V. Conclusion === |
- | {{ :iothings:proiecte:2021:capture.jpg?300 |}} | + | |
- | {{ :iothings:proiecte:2021:sdfcapture.jpg?300 |}} | + | |
+ | I relay enjoyed developing this project and I relay want to implement it to all my hot peppers that I planted. Also, I want to make a room thermometer using the sensors and screen and implement some other smart features and home automations using ESP-32 or Arduino. | ||
+ | In conclusion, this was a very useful and fun project. I had the chance to put up some practical knowledge and build a solution for a problem. Blynk IoT is a powerful platform and combined with ESP board give us endless projects to implement. | ||
+ | === VI. Bibliography === | ||
+ | https://en.wikipedia.org/wiki/ESP32 | ||
+ | https://www.espressif.com/en/products/socs/esp32 | ||
+ | https://app.diagrams.net/ | ||
+ | https://randomnerdtutorials.com/esp8266-nodemcu-client-server-wi-fi/ | ||
+ | https://docs.blynk.io/en/getting-started/developer-mode | ||
+ | IoT laboratories and courses | ||