diy plant watering system esp32

ESP32 DIY Automatic Plant Watering System

By Laura Martinez
AD

Embarking on a green thumb journey can be rewarding, but keeping your plants healthy requires consistent care, especially when it comes to watering. This is where a DIY plant watering system using an ESP32 microcontroller can be a game-changer, ensuring your plants receive the perfect amount of water, even when you're away. Let's dive into creating your own automated plant watering system.

Before we start, you might be wondering why ESP32? This tiny yet powerful microcontroller offers numerous benefits, including low power consumption, built-in Wi-Fi and Bluetooth connectivity, and plenty of GPIO pins for connecting sensors and actuators. Plus, it's incredibly affordable, making it an excellent choice for DIY projects like this one.

Understanding the System Components

The core components of your DIY plant watering system include the ESP32, a moisture sensor, a water pump or solenoid valve, and some basic electronics like resistors and jumper wires. You'll also need a power supply for the pump or valve and the ESP32 itself.

AD
How to make a plant watering system with ESP32 board and Blynk app
How to make a plant watering system with ESP32 board and Blynk app
ESP32 Irrigation System With Water Reservoir
ESP32 Irrigation System With Water Reservoir
Smart Automatic Plant Watering System using Arduino | DIY, IOT Arduino Projects
Smart Automatic Plant Watering System using Arduino | DIY, IOT Arduino Projects

Moisture sensors, like the FC-28 or the Capacitive Soil Hygrometer, measure the water content in the soil. When the soil is dry, the sensor sends a signal to the ESP32, which then activates the water pump or solenoid valve to supply water to your plant.

Choosing the Right Moisture Sensor

Moisture sensors come in various types, each with its own advantages and disadvantages. The two most common types are resistive and capacitive sensors. Resistive sensors change their resistance based on the moisture level, while capacitive sensors change their capacitance. For our purposes, capacitive sensors are more suitable as they're less affected by temperature and soil type.

DIY Plant Watering System with Arduino | Step-by-Step Guide
DIY Plant Watering System with Arduino | Step-by-Step Guide
a person holding a cell phone in front of a board with plants and other electronic devices
a person holding a cell phone in front of a board with plants and other electronic devices
DIY IoT Plant Watering System Using Arduino
DIY IoT Plant Watering System Using Arduino

Some popular capacitive moisture sensors include the FC-28 and the Capacitive Soil Hygrometer. Both are affordable, easy to use, and provide reliable readings. Ensure the sensor you choose is compatible with the ESP32 and has clear documentation for easy integration.

Water Pump or Solenoid Valve: Which to Choose?

Water pumps and solenoid valves both serve the same purpose – to control water flow – but they have different characteristics that might make one a better choice for your project.

AD

Water pumps are typically used when you need to move water over a long distance or against gravity. They're also useful if you want to create a self-contained system with a reservoir. However, they can be noisy and may require additional components like a water level sensor to prevent overflow.

DIY Automatic Watering System for Plants
DIY Automatic Watering System for Plants
some plants and water in blue buckets on the ground with text overlay that reads diy wick watering system
some plants and water in blue buckets on the ground with text overlay that reads diy wick watering system
an electronic device is connected to the other components in this diagram, which shows how it works
an electronic device is connected to the other components in this diagram, which shows how it works
🌿 DIY Smart Plant Monitor with ESP32 🌿
🌿 DIY Smart Plant Monitor with ESP32 🌿
Smart Garden base esp32-cam IoT | project
Smart Garden base esp32-cam IoT | project
a woman holding a plastic water bottle in front of her face with the words how to make a self - watering system
a woman holding a plastic water bottle in front of her face with the words how to make a self - watering system

Solenoid valves, on the other hand, are silent, compact, and can be controlled precisely. They're ideal for controlling water flow in a pipe system. However, they require a constant water supply and may not be suitable for long-distance watering. For most indoor plants, a 12V solenoid valve is a great choice.

Setting Up Your ESP32 and Connecting Components

To get started, you'll need to set up your ESP32 development environment. This involves installing the Arduino IDE and adding the ESP32 board manager. Once you've done that, you can upload sketches to your ESP32 using a USB cable.

AD

Connecting your components to the ESP32 involves wiring the moisture sensor to an analog pin, the water pump or solenoid valve to a digital pin, and powering both the ESP32 and the pump or valve. The exact connections will depend on the components you've chosen, so consult their respective datasheets for detailed instructions.

Automated Watering of Potted Plants With Intel Edison
Automated Watering of Potted Plants With Intel Edison
IoT Automatic Plant Watering System
IoT Automatic Plant Watering System
several plants are in plastic containers on a table with an electronic device next to them
several plants are in plastic containers on a table with an electronic device next to them
Indoor Automatic Plant Watering System
Indoor Automatic Plant Watering System
a potted plant sitting on top of a table next to an electronic circuit board
a potted plant sitting on top of a table next to an electronic circuit board
Arduino Automatic Watering System
Arduino Automatic Watering System
Auto Plant Watering System
Auto Plant Watering System
DIY Wireless Automatic Plant Watering System Without Internet Access Requirement
DIY Wireless Automatic Plant Watering System Without Internet Access Requirement
Micro:bit Automatic Plant Watering System - The DIY Life
Micro:bit Automatic Plant Watering System - The DIY Life
DIY Self-Watering Drip System for Plants | creative explained #shorts
DIY Self-Watering Drip System for Plants | creative explained #shorts
145K views · 1.2K reactions | 🌱Smart Plant Irrigation System with BC547 #reels #shorts #viralreelschallenge | Electronic Project 26
145K views · 1.2K reactions | 🌱Smart Plant Irrigation System with BC547 #reels #shorts #viralreelschallenge | Electronic Project 26
Low Cost Automatic Plant Watering System | Smart Gardening Idea
Low Cost Automatic Plant Watering System | Smart Gardening Idea
a solar powered device is sitting on a table next to a potted plant
a solar powered device is sitting on a table next to a potted plant
Smart Watering System that can water six plants remotely | Arduino + IoT
Smart Watering System that can water six plants remotely | Arduino + IoT

Wiring the Moisture Sensor

Most moisture sensors have three pins: VCC, GND, and DO (or OUT). Connect VCC to the ESP32's 3.3V pin and GND to a GND pin. The DO pin should be connected to an analog pin on the ESP32. This pin will read the moisture level and trigger the watering process when the soil is dry.

Some sensors may require a pull-up resistor on the DO pin. If your sensor does, connect a 10kΩ resistor between the DO pin and the 3.3V pin. This ensures that the pin reads a high signal when the sensor is dry.

AD

Wiring the Water Pump or Solenoid Valve

Water pumps typically require a higher voltage than the ESP32 can provide, so you'll need a separate power supply. Connect the pump's power wires to this supply and the control wire to a digital pin on the ESP32.

Solenoid valves can be powered directly by the ESP32, as they typically operate at 12V or lower. Connect the valve's power and control wires to the appropriate pins on the ESP32. Ensure you use a flyback diode to protect the ESP32 from voltage spikes when the valve is turned off.

Programming the ESP32

With your hardware set up, it's time to write the firmware for your ESP32. You'll use the Arduino IDE to write and upload your sketch. The sketch should read the moisture level, determine if the plant needs water, and activate the water pump or solenoid valve if necessary.

Here's a simple sketch to get you started. This sketch reads the moisture level every five minutes and turns on the water pump or solenoid valve if the moisture level is below a set threshold.

```cpp const int moisturePin = 34; // Analog pin connected to the moisture sensor const int pumpPin = 2; // Digital pin connected to the water pump or solenoid valve const int threshold = 500; // Moisture level threshold (adjust as needed) void setup() { pinMode(pumpPin, OUTPUT); Serial.begin(115200); } void loop() { int moistureLevel = analogRead(moisturePin); Serial.print("Moisture level: "); Serial.println(moistureLevel); if (moistureLevel < threshold) { digitalWrite(pumpPin, HIGH); delay(5000); // Water for 5 seconds digitalWrite(pumpPin, LOW); Serial.println("Watering..."); } delay(300000); // Check every 5 minutes } ```

Calibrating Your System

Moisture sensors can vary in their readings, so it's essential to calibrate your system to ensure accurate watering. Place your plant in its pot and connect the moisture sensor. Allow the soil to dry out completely, then measure the resistance or capacitance of the sensor. This is your dry threshold.

Next, water the plant thoroughly and measure the resistance or capacitance again. This is your wet threshold. Adjust the threshold variable in your sketch to fall between these two values. This ensures that the ESP32 activates the water pump or solenoid valve only when the soil is dry.

Monitoring Your System

To monitor your system, you can connect the ESP32 to your Wi-Fi network and use a web server or a mobile app to display the moisture level and watering status. This allows you to keep an eye on your plants even when you're not at home.

Libraries like ESPAsyncWebServer and Blynk make it easy to create a web server or a mobile app for monitoring your plant watering system. You can also use IFTTT or other automation services to send notifications when your plants need water.

And there you have it – a comprehensive guide to creating your own DIY plant watering system using an ESP32. With this system, you can ensure your plants receive the perfect amount of water, even when you're away. Happy growing!

AD