Simple Automatic Arduino Watering System (Volume Based, Arduino UNO/NANO)

by Vellvoid in Circuits > Arduino

37 Views, 1 Favorites, 0 Comments

Simple Automatic Arduino Watering System (Volume Based, Arduino UNO/NANO)

33091e46-56d2-48b8-b2cd-21a42cd0267c.png
FUR7NGJMM9W8TFF.png

Deterministic. Calibrated. Repeatable. A timer-based system delivering exact milliliter dosing | no moisture sensors required.


Design Philosophy

Same time → same volume → predictable plant response. (Moisture sensors drift. Calibration doesn't.)


System Specs

  1. Pump calibration: 4.93 ml/sec
  2. Watering schedule: 2 doses per day
  3. Base volume: 140 ml/day → 70 ml per dose (Week 0)
  4. Weekly growth ramp: +10% per week (multiplicative)
  5. Control method: Timer-based (no sensor)

Arduino Code [COPY PASTA]

Volume-based dosing with weekly ramp

const int PUMP = 7;
const float ML_PER_SEC = 4.93;

float base_ml_per_day = 140.0;
float weekly_growth = 0.10;

unsigned long start_ms;

void dose_ml(float ml) {
float s = ml / ML_PER_SEC;
digitalWrite(PUMP, HIGH);
delay((unsigned long)(s * 1000.0));
digitalWrite(PUMP, LOW);
}

void setup() {
pinMode(PUMP, OUTPUT);
digitalWrite(PUMP, LOW);
start_ms = millis();
}

void loop() {
unsigned long elapsed = millis() - start_ms;
int weeks = elapsed / (7UL * 24UL * 60UL * 60UL * 1000UL);

float ml_day = base_ml_per_day;
for (int i = 0; i < weeks; i++)
ml_day *= (1.0 + weekly_growth);

float dose = ml_day / 2.0;
dose_ml(dose);
delay(12UL * 60UL * 60UL * 1000UL);
}

Circuit Simulation

Interactive wiring – open, copy and simulate directly:

→ Open Full Tinkercad Simulation

PARTS

Step 1 – Parts & Cost Overview


Two build paths:

• Option A: Breadboard (beginner-friendly, no soldering)

• Option B: Soldered perfboard (clean & permanent)


Core Components (Required)


  1. Arduino Uno or Nano – €4–25
  2. Mini DC Water Pump (5–12V) – €6–12
  3. NPN Transistor (e.g. 2N2222) or Logic MOSFET – €0.50–2
  4. Flyback Diode (1N4007 or 1N5819) – €0.20
  5. 1kΩ Resistor – €0.10
  6. External Power Supply (5–12V depending on pump) – €8–15
  7. Silicone Tubing – €3–6
  8. Water Reservoir (container) – €0–10


Option A – Breadboard Build (Beginner)

  1. Breadboard – €4–8
  2. Jumper wires (male-male) – €4–6

Estimated total cost: €30–60 depending on Arduino choice


Option B – Soldered Permanent Build

  1. Perfboard / Prototyping PCB – €3–6
  2. Soldering iron (if not owned) – €20–40
  3. Solder wire – €5–10
  4. Heat shrink tubing – €5
  5. Small project enclosure – €6–15

Estimated total cost: €35–80 depending on tools


Optional Upgrades

  1. Real-Time Clock Module (RTC) – €4–8
  2. LCD Display – €6–12
  3. MOSFET instead of NPN (higher efficiency) – €2
  4. Inline water filter – €5


Realistic Budget Range:

Basic working system: ~€35–50

Clean permanent enclosure build: ~€50–80

Understanding the System Architecture

Before connecting any wires, it’s important to understand how the system works.


Core Logic

  1. Arduino → Controls timing and calculates water volume
  2. Transistor / MOSFET → Acts as a power switch for the pump
  3. Flyback Diode → Protects the circuit from voltage spikes
  4. Water Pump → Moves water from the reservoir to the plant
  5. External Power Supply → Provides sufficient current for the pump

Why Not Connect the Pump Directly to the Arduino?

The Arduino output pin can supply only about 20–40 mA.

A small DC pump often requires 200–500 mA.

Direct connection would overload the microcontroller and may permanently damage it.


Power Flow Overview

Arduino

Pin 7 (Control Signal)

Transistor

Electronic Switch

Water Pump

Load

External PSU

Power Source

Important: Arduino GND and Power Supply GND must be connected together. This is called a common ground.

Breadboard Wiring (Beginner Version)

Screenshot_20260303_143502.png

Step 3 – Breadboard Wiring (Beginner Friendly)

Goal: Build the circuit on a breadboard (no soldering).

The Arduino sends a small control signal. The transistor switches the pump power safely.

Photo 1 – Breadboard + Parts Overview

Breadboard overviewTip: The two long side rails are usually power rails (+ and –). The middle gap separates left and right rows.

What you will build

Arduino Pin 7 → (small signal) → Transistor → (switches power) → Pump → External Power Supply


Step-by-step wiring (do it in this order)

  1. Place the transistor on the breadboard.
  2. Keep it near the center gap so each leg is on its own row.
  3. Connect Arduino GND to the breadboard GND rail.
  4. (This is your “ground line”.)
  5. Connect the external power supply GND to the SAME GND rail.
  6. This common ground is mandatory.
  7. Wire the transistor switch path:
  8. Transistor Emitter → GND rail
  9. Transistor Collector → Pump negative (–)
  10. Wire pump power:
  11. Pump positive (+) → External power supply +
  12. Wire the control signal from Arduino:
  13. Arduino Pin 71kΩ resistor → Transistor Base


Transistor legs (Base / Collector / Emitter)

Important: Pin order depends on your transistor model. Use the datasheet or your Tinkercad diagram.


Add the protection diode (required)

Place the diode directly across the pump terminals (Anode on + of the Pump, Cathode on - of the Pump).

Stripe (band) of the diode must face the pump + / power +.

Photo 3 – Diode placement (stripe direction)

The diode protects your transistor + Arduino from the pump’s voltage spike when switching off.

Before you power it on (quick checklist)

  1. Common ground: Arduino GND and PSU GND (Li-ion or Powersupply) connected together
  2. Diode stripe points to pump +
  3. Pump + goes to external PSU + (not to Arduino 5V)
  4. No loose wires touching random rows

Typical beginner mistakes (and what happens)

  1. Pump runs constantly: transistor legs are mixed up (Base/Collector/Emitter wrong)
  2. Pump never runs: no common ground OR wrong pin 7 wiring OR pump PSU off
  3. Arduino resets / weird behavior: missing diode OR powering pump from Arduino

First Safe Test (Before Real Watering)



Step 4 – First Safe Test (Before Real Watering)




Before connecting your plant, we test the pump for 5 seconds only.
Use a cup or empty container for testing.




Upload This Test Code





Simple 5-Second Pump Test


const int PUMP = 7;

void setup() {
pinMode(PUMP, OUTPUT);
digitalWrite(PUMP, HIGH); // Pump ON
delay(5000); // 5 seconds
digitalWrite(PUMP, LOW); // Pump OFF
}

void loop() {
}





What Should Happen




  • Pump runs for 5 seconds

  • Pump stops automatically

  • Arduino stays powered and stable





If Something Is Wrong





  • Pump runs constantly: transistor legs are wrong

  • Pump never runs: missing common ground or wrong pin wiring

  • Arduino resets: missing diode or weak power supply




Pump Calibration (Measure Ml Per Second)



Step 5 – Pump Calibration (Measure ml per Second)




Before using the full watering logic, we must measure how much water your pump delivers per second.




What You Need




  • Measuring cup (with ml scale)

  • Stopwatch (phone is fine)

  • Container for water





Upload This Calibration Code





10-Second Pump Calibration


const int PUMP = 7;

void setup() {
pinMode(PUMP, OUTPUT);
digitalWrite(PUMP, HIGH); // Pump ON
delay(10000); // 10 seconds
digitalWrite(PUMP, LOW); // Pump OFF
}

void loop() {
}





Calibration Procedure




  1. Place pump tube into measuring cup.

  2. Upload the calibration code.

  3. Measure how many milliliters were pumped in 10 seconds.

  4. Divide measured ml by 10.






Example:

You measured 49 ml in 10 seconds.


49 ml ÷ 10 sec = 4.9 ml/sec




Insert Value Into Final Code




const float ML_PER_SEC = 4.9;




Important Notes




• Always calibrate with the final hose length.

• Height difference affects flow rate.

• Repeat measurement twice for accuracy.


Activate the Full Watering System



Step 6 – Activate the Full Watering System




Now we upload the final system logic with calibrated volume dosing and automatic weekly growth scaling.




Final Watering Code





Volume-Based Dosing with Weekly Ramp


const int PUMP = 7;
const float ML_PER_SEC = 4.9; // <-- Insert your calibrated value

float base_ml_per_day = 140.0;
float weekly_growth = 0.10;

unsigned long start_ms;

void dose_ml(float ml) {
float s = ml / ML_PER_SEC;
digitalWrite(PUMP, HIGH);
delay((unsigned long)(s * 1000.0));
digitalWrite(PUMP, LOW);
}

void setup() {
pinMode(PUMP, OUTPUT);
digitalWrite(PUMP, LOW);
start_ms = millis();
}

void loop() {
unsigned long elapsed = millis() - start_ms;
int weeks = elapsed / (7UL * 24UL * 60UL * 60UL * 1000UL);

float ml_day = base_ml_per_day;
for (int i = 0; i < weeks; i++)
ml_day *= (1.0 + weekly_growth);

float dose = ml_day / 2.0;

dose_ml(dose);
delay(12UL * 60UL * 60UL * 1000UL);
}





What This Code Does




  • Calculates total daily water volume

  • Increases volume by 10% per week

  • Splits daily amount into two doses

  • Runs pump only as long as needed (based on ml/sec)





Before You Let It Run Long-Term




• Ensure tubing is securely attached

• Check for leaks

• Verify pump stops after each cycle

• Make sure reservoir cannot run dry


Downloads

Troubleshooting (If Something Is Not Working)



Step 7 – Troubleshooting (If Something Is Not Working)




If your system doesn’t behave as expected, don’t panic.
Almost every issue comes from one of the points below.




Problem 1 – Pump Runs Constantly




Cause: Transistor legs are connected incorrectly.


Fix:

  • Check Base, Collector, Emitter orientation

  • Compare with your transistor datasheet

  • Make sure resistor is between Arduino Pin 7 and Base






Problem 2 – Pump Never Turns On




Cause: Missing common ground or wiring error.


Fix:

  • Arduino GND and Power Supply GND must be connected together

  • Check that pump + goes to external PSU + (not Arduino 5V)

  • Verify Pin 7 is correct in the code






Problem 3 – Arduino Resets or Acts Weird




Cause: Missing flyback diode or weak power supply.


Fix:

  • Check diode placement (stripe must face pump +)

  • Use proper external power supply

  • Do NOT power pump directly from Arduino






Problem 4 – Water Amount Is Wrong




Cause: Pump not calibrated correctly.


Fix:

  • Repeat Step 5 calibration

  • Measure exactly 10 seconds

  • Use the correct ml/sec value in the code






Quick Sanity Checklist




✔ Common ground connected

✔ Diode stripe facing pump +

✔ Resistor between Arduino and transistor

✔ Pump powered by external supply

✔ Correct ML_PER_SEC value





If it still doesn’t work: disconnect everything and rebuild it slowly.
Most problems come from one misplaced wire.