Introduction
Automating irrigation for home gardens or school projects is a popular IoT challenge for makers in Pakistan. A plant watering system can be built with an ESP32 or Arduino board, a moisture sensor, a pump, and a few supporting components. This guide walks you through the complete parts catalog, wiring diagram, and basic code, while showing why buying from Robotics Kits is faster and safer than hunting for parts at Hall Road Lahore, Digilog, Electrobes, or AliExpress.
Why Choose Robotics Kits?
- Live PKR prices – see the current cost of each component without currency conversion hassles.
- Cash on Delivery (COD) – pay when the package arrives, a service many local markets still lack.
- AI Build‑to‑Buy – our AI Lab instantly creates a Bill of Materials (BOM) and adds it to your cart.
- Local support – fast shipping across Pakistan and a dedicated help desk for troubleshooting.
Compared with traditional markets like Hallroad, Digilog, or overseas platforms such as AliExpress, Robotics Kits eliminates hidden fees, counterfeit parts, and long delivery times.
Core Components (BOM)
| Qty | Part | Typical Use | Recommended Brand (Robotics Kits) | |-----|------|-------------|------------------------------------| | 1 | ESP32‑S3 or Arduino Uno | Main controller, Wi‑Fi for remote monitoring | ESP32‑S3 (Wi‑Fi/BLE) | | 1 | Soil Moisture Sensor (capacitive) | Detects water level in the soil | Capacitive sensor | | 1 | 12 V DC Submersible Pump | Moves water from reservoir to plant | Mini pump | | 1 | Motor Driver L298N | Drives pump with PWM control | L298N module | | 1 | Power Supply (12 V 2 A) | Powers pump and driver | Wall adapter | | 1 | Jumper wires (male‑to‑male) | Connects modules | 20 cm dupont set | | 1 | Breadboard (optional) | Prototyping platform | Standard board | | 1 | Water reservoir (plastic bottle) | Holds water | Re‑usable bottle | | 1 | Tubing (2 mm) | Channels water to plant | Silicone tube |
You can also upgrade with a Raspberry Pi for a web dashboard, an STM32 for low‑power operation, or add an ultrasonic HC‑SR04 to monitor water level in the reservoir.
Wiring Diagram Explained
1. Power Connections
- Connect the 12 V adapter to the VCC and GND pins of the L298N.
- The ESP32‑S3 is powered via its USB‑C port (5 V) and shares ground with the driver.
2. Motor Driver to Pump
- Wire the pump’s two leads to the OUT1 and OUT2 terminals of the L298N.
- Enable the driver using the ENA pin (connect to a PWM‑capable GPIO on the ESP32, e.g., GPIO 5).
3. Sensor to Controller
- The soil moisture sensor has three pins: VCC, GND, and AO (analog output).
- Connect VCC to 3.3 V on the ESP32, GND to ground, and AO to GPIO 34 (ADC1_CH6).
4. Optional Extras
- Add an HC‑SR04 on GPIO 12 (Trig) and GPIO 13 (Echo) to detect reservoir level.
- Use a relay module if you prefer a 5 V pump; connect the relay coil to a digital pin and control it via the ESP32.
Sample Code (ESP32‑S3)
#include <WiFi.h>
// Pin definitions
const int moisturePin = 34; // ADC pin for sensor
const int pumpPin = 5; // PWM pin for L298N ENA
// Moisture thresholds (0‑4095)
const int dryThresh = 2000;
const int wetThresh = 1200;
void setup() {
Serial.begin(115200);
pinMode(pumpPin, OUTPUT);
analogReadResolution(12);
}
void loop() {
int moisture = analogRead(moisturePin);
Serial.print("Soil moisture: "); Serial.println(moisture);
if (moisture > dryThresh) {
// Soil is dry – turn pump on
ledcWrite(0, 255); // full speed PWM
digitalWrite(pumpPin, HIGH);
Serial.println("Pump ON – watering...");
} else if (moisture < wetThresh) {
// Soil is wet – stop pump
ledcWrite(0, 0);
digitalWrite(pumpPin, LOW);
Serial.println("Pump OFF – soil moist.");
}
delay(5000); // check every 5 seconds
}Upload the sketch via the Arduino IDE, then monitor the serial output. Adjust the thresholds based on your soil type.
Assembly Steps
- Mount the ESP32‑S3 on a small enclosure near the plant.
- Insert the moisture sensor into the soil about 2 cm deep.
- Place the pump inside the water reservoir and connect tubing to the plant pot.
- Wire the L298N as described, ensuring all grounds are common.
- Power up the system and observe the serial monitor for correct operation.
- (Optional) Connect to Wi‑Fi and send moisture data to a cloud dashboard using MQTT – a common IoT pattern in Pakistan maker labs.
Buying Guide – Where to Source the Parts
| Component | Robotics Kits (Online) | Hall Road Lahore / Digilog | AliExpress | |-----------|------------------------|---------------------------|------------| | ESP32‑S3 | Live PKR price, COD, AI BOM | Often out of stock, price in PKR varies | Shipping 2‑4 weeks, no COD | | Soil Moisture Sensor | Certified capacitive, no corrosion | Generic resistive sensors, prone to rust | Cheap but quality varies | | L298N Driver | Tested modules, 12 V rating | May be mislabeled, limited warranty | Low price, long lead time | | Pump & Tubing | Packaged together for kits | Sold separately, need to match voltage | Multiple listings, risk of counterfeit |
Robotics Kits bundles the above items into a ready‑to‑assemble kit, complete with a PDF wiring guide and a QR code that opens the AI Lab for instant ordering. This eliminates the guesswork of mixing parts from Electrobes or Hallroad markets.
Testing & Calibration
- Dry test: Run the pump without water to verify PWM control.
- Wet test: Fill the reservoir, insert the sensor, and watch the pump activate when the soil dries.
- Calibration: Record raw ADC values for dry and wet soil, then update
dryThreshandwetThreshin the code. - Safety: Keep the pump and power supply away from direct sunlight to avoid overheating.
Scaling the Project
For larger gardens, duplicate the sensor‑pump pair and connect all pumps to a single ESP32 using separate PWM channels. You can also integrate a Raspberry Pi to host a Flask web app that displays real‑time moisture graphs, leveraging the same MQTT topics used by the ESP32.
Frequently Asked Questions
- Can I use an Arduino Nano instead of ESP32? Yes, but you’ll lose built‑in Wi‑Fi. Add an ESP‑01 module for connectivity.
- Do I need a separate power supply for the pump? A 12 V 2 A adapter is sufficient for a single small pump. For multiple pumps, consider a higher‑current supply.
- Is the system compatible with solar panels? Absolutely – pair a solar charge controller with a 12 V battery and the same driver circuit.
Conclusion
Building a plant watering system in Pakistan is straightforward when you have the right parts and a clear wiring guide. By sourcing from Robotics Kits, you benefit from live PKR pricing, COD, and an AI‑driven Build‑to‑Buy experience that outpaces traditional markets like Hall Road Lahore, Digilog, Electrobes, and overseas sites such as AliExpress.
Ready to automate your garden? Visit Robotics Kits today, use our AI Lab to generate your BOM instantly, and enjoy fast COD delivery across Pakistan.