Not only do plants enhance the environment aesthetically, but they also aid in photosynthesis, absorbing carbon dioxide and releasing oxygen, effectively purifying indoor air and reducing the concentration of harmful substances (such as formaldehyde, benzene, etc.), thereby improving indoor air quality. But what happens to your green friends when you're away for an extended period?
This project solves that problem! We'll build an automatic watering system that:
- Continuously monitors soil moisture using a soil moisture sensor
- Displays the moisture level on a 1602 LCD screen
- Automatically activates a water pump when the soil gets too dry
- Stops watering when sufficient moisture is detected
All logic runs on the ACEBOTT ESP32 using simple threshold-based decision making. This project introduces sensor reading, relay control (for high-power devices), and I2C LCD display β essential skills for any smart home enthusiast!
Hardware
- ACEBOTT ESP32 Smart Home Edu Kit β Level 2 (QE024)
- ESP32 Controller Board
- Soil Moisture Sensor
- 5V Relay Module
- Water Pump
- 1602 I2C LCD Display
- Acrylic structural parts
- Jumper wires (included)
- Small container for water
- Plant (not included)
Software
- ACECode (Scratchβbased) OR Arduino IDE
1. Soil Moisture Sensor
A moisture sensor measures the moisture level in soil by detecting the resistance between two metal electrodes. The moisture in the soil affects this resistance β wetter soil = lower resistance = higher analog reading (or vice versa depending on your sensor). The sensor outputs an analog signal that we can read with the ESP32's ADC pins.
Pinout:
- S: Connect to analog I/O pin (GPIO25 in our code)
- V: Connect to 5V
- G : Connect to GND
2. Water Pump
The water pump is a mechanical device that operates by driving an impeller with an electric motor.
This rotation generates centrifugal force, drawing liquid into the pump body and delivering it through pipes to the desired location.
Important: The ESP32's I/O pins cannot provide enough current to drive the pump directly. That's why we need a relay module!
Pinout:
- Red wire: Connect to 5V
- Black wire: Connect to GND (through the relay)
3. 5V Relay Module
A relay is an electrical switch that allows a low-power signal (from the ESP32) to control a high-power device (like the water pump). It works like this:
In our circuit:
Pinout:
- S (Signal): Connect to GPIO33 (digital output)
- V: Connect to 5V
- G: Connect to GND
- COM: Connect to GND (yes, this is correct β check your kit's manual!)
- NO: Connect to pump negative (black wire)
- NC: Leave unconnected
4. 1602 I2C LCD Display
The 16x2 character LCD with I2C backpack simplifies wiring dramatically β only 4 wires (VCC, GND, SDA, SCL) instead of 8+! We'll use it to display the current soil moisture reading and pump status.
Pinout:
- VCC: Connect to 5V
- GND: Connect to GND
- SDA: Connect to GPIO21 (I2C data)
- SCL: Connect to GPIO22 (I2C clock)
Follow the kit's official Assemble documentation β Level 2 for detailed visuals. Here's a summary:
Step 1: Prepare the Base
Assemble the base where all components will be mounted.
Step 2: Install the LCD Display
Mount the 1602 LCD in a visible spot on your smart home structure.
Step 3: Install the Relay Module
Fix the relay module onto the base near the pump.
Step 4: Install the Water Pump
Place the pump securely. Ensure the inlet tube reaches your water container and the outlet tube reaches the plant.
Step 5: Install the Soil Moisture Sensor
Mount the sensor so its prongs can be inserted into the plant's soil.
Step 6: Wire Everything
Follow the wiring diagram below.
Step 7: Final Arrangement
Place a small water container next to the pump and position your plant nearby.
πΉ Logic Overview
- Read analog value from soil moisture sensor
- Display the value on the LCD (e.g., "H: 850")
- If moisture value is below threshold (dry soil):
Activate relay (HIGH) β pump runs for 500ms
Display "Water: Turn on"
- If moisture value is above threshold (wet enough):
Deactivate relay (LOW) β pump stops
Display "Water: Turn off"
- Repeat every second
πΉ Arduino Sketch
The magic number 1000 in the code is just a starting point. You need to find the right threshold for your soil and plant:
- Insert the sensor into dry soil β note the value (e.g., 800).
- Water the plant thoroughly β wait a few minutes, then note the value (e.g., 2500).
- Choose a threshold somewhere in between. For example, if dry=800 and wet=2500, set threshold to 1500.
Condition Typical Value Range
Very dry 0 β 1000
Moist 1000 β 2500
Wet 2500 β 4095
β οΈ Note: These values depend on your specific sensor and soil type. Always calibrate for your setup!
Update the threshold in the code:
if (moisture_value < 1500) { // Use YOUR calibrated valueπΉ Project DemoWatch the automatic watering system in action ππ
π‘ ConclusionWith a soil moisture sensor, a relay, a water pump, and an LCD display, I added an intelligent plant care system to my ACEBOTT smart home. Now my plants stay hydrated even when I'm on vacation!
This project teaches:
β Analog sensor reading and calibration
β Controlling high-power devices with relays
β I2C LCD display usage
β Threshold-based automation logic
β Real-world problem solving









Comments