Automatic dusk-to-dawn light
Lights switch on by themselves at dusk and off again in the morning.
Shop by category
Shop all componentsWater the plant only when it is genuinely dry, cap how long the pump may run, and refuse to run again too soon. Experiment 22 watered whenever the soil was dry, which sounds sensible until you realise the sensor sits in the wet patch right where the water lands, so the reading rises long before the rest of the pot is watered, and the pump cycles repeatedly. Two timed rules fix it: the pump may never run longer than eight seconds at a stretch, and after watering it must wait a full minute before it is allowed to consider running again. That soak period lets the water spread and the reading settle.
Keep water away from the Nano and test the pump and tube over a tray first.
Charge 18650 cells only in a proper Li-ion charger and never short the holder's wires.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
The brain of every Explorer Kit project
Male-to-female and female-to-female leads for the modules
16x2 LCD with I2C backpack: four wires, two lines of text
Soil moisture sensor: the reading falls as the soil gets wetter
L298N board: here only its 5V regulator is used, to feed the pump
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
The pump runs at 5V from the L298N's on-board regulator, which is fed by the 2 x 18650 pack. The relay switches that 5V; the Nano only drives the relay.
explorer_kit_60_intelligent_water_saver.inoVerify & upload in Electrolark#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int soilPin = A0;
int relayPin = 7;
int dryLevel = 30;
unsigned long maxRunTime = 8000; // Never pump longer than 8 s
unsigned long soakTime = 60000; // Wait 60 s before pumping again
bool pumping = false;
unsigned long pumpStarted = 0;
unsigned long lastPumpEnd = 0;
int wateringCount = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void pumpOff()
{
digitalWrite(relayPin, HIGH);
pumping = false;
lastPumpEnd = millis();
}
void setup()
{
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Water Saver");
delay(2000);
lcd.clear();
lastPumpEnd = millis();
}
void loop()
{
int raw = analogRead(soilPin);
int moisture = constrain(map(raw, 1023, 300, 0, 100), 0, 100);
if (pumping)
{
if (millis() - pumpStarted > maxRunTime)
{
pumpOff();
Serial.println("Run time limit reached - pump stopped");
}
}
else
{
bool soaked = (millis() - lastPumpEnd < soakTime);
if (moisture < dryLevel && !soaked)
{
digitalWrite(relayPin, LOW);
pumping = true;
pumpStarted = millis();
wateringCount = wateringCount + 1;
Serial.print("Watering cycle ");
Serial.println(wateringCount);
}
}
lcd.setCursor(0, 0);
lcd.print("Soil: ");
lcd.print(moisture);
lcd.print("% N:");
lcd.print(wateringCount);
lcd.print(" ");
lcd.setCursor(0, 1);
if (pumping)
{
long left = (maxRunTime - (millis() - pumpStarted)) / 1000;
lcd.print("PUMPING ");
lcd.print(left);
lcd.print("s ");
}
else if (millis() - lastPumpEnd < soakTime)
{
long wait = (soakTime - (millis() - lastPumpEnd)) / 1000;
lcd.print("Soaking ");
lcd.print(wait);
lcd.print("s ");
}
else
{
lcd.print("Monitoring ");
}
delay(300);
}
Use the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
Turn the small contrast pot on the back of the I2C board. If still blank, change 0x27 in the sketch to 0x3F.
Note the reading in dry air and in a glass of water, then put those two numbers into the map() line of the sketch.
These relay modules are active LOW: writing LOW switches them on. The sketch already does this, so check IN goes to the right pin.
Experiment 22 watered whenever the soil was dry, which sounds sensible until you realise the sensor sits in the wet patch right where the water lands, so the reading rises long before the rest of the pot is watered, and the pump cycles repeatedly. Two timed rules fix it: the pump may never run longer than eight seconds at a stretch, and after watering it must wait a full minute before it is allowed to consider running again. That soak period lets the water spread and the reading settle.
Soil: 55% N:0 / Monitoring with damp soil. Below 30% the relay clicks: PUMPING 8s counting down. After the run it shows Soaking 60s and refuses to pump again.
Yes. It is project 60 of 61 in the Geekobot Explorer Kit, in level 10 (Smart home). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
11 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Dupont Jumper Wires (40 pcs), LCD1602 16x2 Character LCD Display, Capacitive Soil Moisture Sensor – 3.3V/5V Analog Output, PH2.54-3P Interface, 5V Relay Module with Optocoupler, Mini Submersible Water Pump 3–6V, L298N Dual H-Bridge Motor Driver Module, Arduino Nano IO Expansion Shield (328P Compatible), 18650 Battery Holder, plus 1 more. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1 hour. The build on this page has 8 steps.
No. This page has the complete, tested code (explorer_kit_60_intelligent_water_saver.ino).
About ₹1,284 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Timed relay events; Capping how long an actuator may run; Cool-down periods between actions; Why a sensor's position changes the logic you need.
Keep water away from the Nano and test the pump and tube over a tray first. Charge 18650 cells only in a proper Li-ion charger and never short the holder's wires.
Lights switch on by themselves at dusk and off again in the morning.
A precise thermostat that keeps tropical fish at a steady 25–26 °C.
Starts the pump when the tank runs low and stops it when it is full.
Tap a hidden pad to switch a lamp on or off, even through a wooden desk.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.