DIY

Plant watering system with Wi-Fi control

Plant irrigation system with Wi-Fi control -Fi  Plant watering system with Wi-Fi control In this article we will consider another scheme for automating the process of watering plants. The man who made this system is fond of electronics and flower cultivation.
Flowers grow in five boxes in two places on the terrace above the pond. The distance from the water mirror to the flowers is about 60 cm. The task was as follows:
Automatic water intake from the pond and irrigation with drip tape in five flower pots.
Two separate pumps, one for boxes with flowers at the railing, the other for boxes on deck.
Watering plants only at certain times in the morning and evening for a short period of time.
Watering plants only on warm and sunny days.
When implementing this project, it is assumed that there is home automation (with a weather station) and Home Assistant is installed.
Tools and materials:
-Computer;
-Soldering iron; -Glue gun; -3D-printer (option) ; -Board ESP-Wroom-32; -Power supply, 12V, 2A;
-Power connector plug/socket;
-Module L298N; -Self-priming water pump 12 V – 2 pcs;
– Water filter;
-System of micro-drip irrigation, including a hose 10 m long;
-Body made of ABS plastic;
Step one: diagram
The device works as follows:
Power supply supplies 12V to motor driver.
Motor driver supplies 5V to ESP32.
Motor driver supplies power to both water pumps.
ESP32 controls the motor driver via two GPIO data pins .
Plant watering system with Wi-Fi control Step two: L298N motor driver board
For the driver board to generate 5V, a jumper must be placed near the 12V input. With the jumper installed, the L298N motor driver board can also directly power the ESP32.
The motor driver has 6 digital inputs, 3 for each motor. ENA and ENB are pulse width modulated (PWM) inputs that determine the speed of the motor. The inputs In1/In2 and In3/In4 control the direction of rotation of the motor. After checking the direction of rotation of the motor, the inputs In1, In2, In3 and In4 can be connected to 5V/Gnd of the ESP32 respectively. In this case, the connection is as follows:
In1/In3 = high, In2/In4 = low
ENA and ENB are by default connected to 5V via two jumpers. When PWM is used to set the motor speed, these jumpers must be removed.
Both motors are connected to the motor output pins on the driver board.
Plant irrigation system with Wi-Fi control Step Three: Self-Priming Diaphragm Pump
The first pump that the master tried with this assembly was a simple and cheap 12 V DC brushless pump AD20P-1230C. But this pump could not suck in water from below. For such purposes, a so-called “self-priming” diaphragm pump is needed.
The main parameters of this pump include:
Model: DC diaphragm pump R365
Operating voltage: 12 V DC
No load current: 0.23 A
Maximum flow: 2 -3 l/min.
Maximum outlet pressure: 1-2.5 kg
Maximum lift: 1-2.5 m
Maximum suction: 2 m
Thus, it can suck in water from a depth of 2 m, which is more than enough, since in this case it is necessary to raise the water only 90 cm up. Then he has to push the water another meter. In any case, this pump meets the technical requirements.
 Plant watering system with Wi-Fi control Plant irrigation system with Wi-Fi control Step Four: Connecting ESP32
ESP32 is a cheap but powerful chip from Espressif Systems. It is used quite often in various simple wireless automation projects. Features of ESP32:
ESP32 has many input and output pins.
ESP32 has built-in Bluetooth and Wi-Fi for wireless data transfer.
Combined with ESPHome, ESP32 can be integrated into Home Assistant.
ESPHome is updated by software air
ESPHome has a simple local web server
The connections are as follows:
5 Volt power is connected from the motor driver board to the Vin pin of the ESP32.
Gnd is connected to Gnd
GPIO pin D14 is connected to ENA for PWM motor A < br> GPIO D32 pin is connected to ENB for PWM motor B
Plant irrigation system with Wi-Fi control Step Five: Housing
The device must be housed in a waterproof housing. The master has designed and 3D printed a supporting structure that holds all the components and which can be easily installed in a standard ABS enclosure.
The pumps and electronics are located in separate compartments in the enclosure. The 12V power connector is located on the side.
Plant irrigation system with Wi-Fi control  Wi-Fi Plant irrigation system with Wi-Fi control  Wi-Fi Step six: programming
First you need to write some parameters.
Esphome sets the device name as well as the specific ESP board used. If the In1, In2, In3 and In4 pins of the motor driver board are directly connected to 5V (In1, In3) and ground (In2, In4), the entire on_boot entry can be deleted.
Network credentials must be specified in the wifi. < br> The api entry ensures that Home Assistant finds the device.
The web_server entry creates a web server through which the device can be directly controlled.
The ota entry allows data to be updated via a Wi-Fi network rather than a USB connection.
Two motor control pins are set in the output entry. The ledc platform is selected to control PWM at 1000Hz. If the pins In1, In2, In3 and In4 of the motor driver board are connected directly to 5V (In1, In3) and ground (In2, In4), these settings are not used and can be deleted.
The sensor entry determines the WiFi signal strength.
The code can be downloaded below.

 # # Smart WiFi Controlled Irrigation System Using Home Assistant and ESPHome # # Generic ESP32, name, platform and initial GPIO pin states esphome & # 58; name & # 58; waterpump platform & # 58; ESP32 board & # 58; esp-wrover-kit # The on_boot entry can be removed when pins In1, In2, In3 and In4 are directly # connected to 5V (In1, In3) and Gnd (In2, In4) respectively. on_boot & # 58; then & # 58; - output.turn_on & # 58; gpio_in1 - output.turn_off & # 58; gpio_in2 - output.turn_on & # 58; gpio_in3 - output.turn_off & # 58; gpio_in4 # WiFi, connect to network as defined in secrets.yaml file. wifi & # 58; ssid & # 58; ! secret wifi_ssid password & # 58; ! secret wifi_pass # I have preference for fixed IP address, comment out for dynamic IP address manual_ip & # 58; static_ip & # 58; 192.168.1.95 gateway & # 58; 192.168.1.1 subnet & # 58; 255.255.255.0 # fast_connect & # 58; true # Enable fallback hotspot (captive portal) in case wifi connection fails ap & # 58; ssid & # 58; & # 34; Waterpump Fallback Hotspot & # 34; password & # 58; & # 34; Waterpump & # 34; # Enable Captive Portal in case connection to defined WiFi network fails. captive_portal & # 58; # Enable logging logger & # 58; # Enable Home Assistant API, required to auto discover new ESPHome devices api & # 58; # Enable local web server for direct connection outside Home Assistant web_server & # 58; port & # 58; 80 # Enable over-the-air updates ota & # 58; # Define the output pins connected to the Motor Driver board # The entries for pins In1, In2, In3 and In4 can be removed when directly # connected to 5V (In1, In3) and Gnd (In2, In4) respectively. output & # 58; # Motor 1 - ENA, Enable A (= PWM) - platform & # 58; ledc pin & # 58; GPIO14 id & # 58; gpio_m1 frequency & # 58; & # 34; 1000Hz & # 34; # Motor 1 - IN1 - platform & # 58; gpio pin & # 58; GPIO27 id & # 58; gpio_in1 # Motor 1 - IN2 - platform & # 58; gpio pin & # 58; GPIO26 id & # 58; gpio_in2 # Motor 2 - IN3 - platform & # 58; gpio pin & # 58; GPIO25 id & # 58; gpio_in3 # Motor 2 - IN4 - platform & # 58; gpio pin & # 58; GPIO33 id & # 58; gpio_in4 # Motor 2 - ENB, Enable B (= PWM) - platform & # 58; ledc pin & # 58; GPIO32 id & # 58; gpio_m2 frequency & # 58; & # 34; 1000Hz & # 34; # Define two light switches in HA that control both water pumps light & # 58; # Motor 1 - platform & # 58; monochromatic output & # 58; gpio_m1 name & # 58; & # 34; Water pump 1 & # 34; # Motor 1 - platform & # 58; monochromatic output & # 58; gpio_m2 name & # 58; & # 34; Water pump 2 & # 34; # Define a WiFi strength sensor to indicate the WiFi strength of connection sensor & # 58; - platform & # 58; wifi_signal name & # 58; & # 34; Waterpump_WiFi_Signal & # 34; update_interval & # 58; 60s filters & # 58; - median & # 58; window_size & # 58; 7 send_every & # 58; 4 send_first_at & # 58; 3  

Step Seven: Setting Up in Home Assistant
Automation is set to run every morning at 7:00 am and every evening at sunset. But only when the sky is clear, foggy, or partly cloudy.

 automation & # 58; - alias & # 58; & # 39; waterpump automation & # 39; trigger & # 58; # Every morning at 7 & # 58; 00 - platform & # 58; time at & # 58; & # 34; 07 & # 58; 00 & # 58; 00 & # 34; # every evening at sun set - platform & # 58; sun event & # 58; sunset condition & # 58; # Only run when sky is clear, cloudy or partly-cloudy - condition & # 58; or conditions & # 58; - condition & # 58; state entity_id & # 58; weather.waterfront state & # 58; & # 39; clear & # 39; - condition & # 58; state entity_id & # 58; weather.waterfront state & # 58; & # 39; cloudy & # 39; - condition & # 58; state entity_id & # 58; weather.waterfront state & # 58; & # 39; partlycloudy & # 39; action & # 58; # Switch the pump on, and let it run for 3 minutes - service & # 58; light.turn_on entity_id & # 58; - light.water_pump_1 - light.water_pump_2 - delay & # 58; minutes & # 58; 3 - service & # 58; light.turn_off entity_id & # 58; - light.water_pump_1 - light.water_pump_2 # Just to be sure, switch it off once more - delay & # 58; seconds & # 58; 30 - service & # 58; light.turn_off entity_id & # 58; - light.water_pump_1 - light.water_pump_2  

 Plant irrigation system with Wi-Fi control

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button