πŸ€– What is Arduino?

Arduino is a small, affordable computer that can sense the world around it (using sensors) and control things like lights, motors, or buzzers. Think of it as the "brain" of an electronic project. You tell it what to do by writing simple instructions (code) on a regular computer, then upload those instructions to the Arduino.

Microcontroller: A tiny computer on a single chip that can run one program at a time.
Sensor: A device that detects changes in the environment (moisture, temperature, light).
Actuator: A device that does something (LED lights up, buzzer sounds, motor spins).
Code/Sketch: The set of instructions you write to tell Arduino what to do.
⚠️ No Arduino board at school? You can simulate this project using free online Arduino simulators like Wokwi or Tinkercad Circuits. The concepts are the same, and you can still get SBA credit with screenshots of your working simulation.

Every year, Kenyan farmers lose crops because they water too much (causing root rot) or too little (causing drought stress). This project solves that problem by creating an automatic warning system: when soil gets too dry, a red LED lights up or a buzzer sounds. You are building a real "smart farming" device used by commercial farms worldwide.

🌍 Real-World Application: Large farms in Kenya (e.g., Sunripe, Vegpro) use soil moisture sensors connected to automated irrigation systems. When sensors detect dry soil, water is released automatically – saving millions of litres of water every year.
πŸ“˜ KNEC SBA connection: This project covers Computer Science Strand 3: Programming and Electronics, and Agriculture Strand 3: Smart Farming Technologies. Your evidence will include wiring photos, the working code, and a demonstration video.
🧠

Arduino Uno Board

The "brain" of your project. Cost: 1,500-2,500 KES at electronics shops (Luthuli Avenue, Nairobi) or online (Jumia, Kilimall).

Alternative: Arduino Nano (smaller, cheaper at 800-1,200 KES) or any compatible clone.

πŸ’§

Soil Moisture Sensor Module

Two metal prongs that you stick into soil. They measure how much water is present. Cost: 200-400 KES.

How it works: Wet soil conducts electricity more easily than dry soil.

πŸ’‘

LED + 220-ohm Resistor

LED lights up when soil is dry. Resistor protects LED. Cost: 10-20 KES total.

πŸ”Š

Buzzer (optional)

Makes sound when soil is dry. Cost: 50-100 KES.

πŸ”Œ

Jumper Wires + USB Cable

Coloured wires connect components. USB cable connects Arduino to computer. Cost: 150-300 KES.

🌱

Small pot with soil

For testing the sensor.

πŸ’° Total cost: 2,000-3,500 KES (one-time investment). FREE alternative: Use Tinkercad Circuits simulator (free, web-based).

πŸ”Œ Connection Guide (Follow Exactly)

Soil Moisture Sensor β†’ Arduino:

  • VCC pin (power) β†’ 5V pin on Arduino
  • GND pin (ground) β†’ GND pin on Arduino
  • DO (Digital Output) pin β†’ Pin 7 on Arduino

LED β†’ Arduino (with resistor):

  • LED long leg (positive) β†’ 220-ohm resistor β†’ Pin 8 on Arduino
  • LED short leg (negative) β†’ GND pin on Arduino

Buzzer (optional) β†’ Arduino:

  • Buzzer positive (+) β†’ Pin 9 on Arduino
  • Buzzer negative (-) β†’ GND pin on Arduino
Wiring diagram'">
1

Download Arduino IDE

Go to arduino.cc/en/software and download the free Arduino IDE for your computer. Install it.

2

Connect Arduino to Computer

Use USB cable. A green light on Arduino should turn on.

connecting arduino
3

Select Board and Port

Tools β†’ Board β†’ Arduino Uno. Then Tools β†’ Port β†’ Select the COM port that appears.

Copy the entire code below. Paste into Arduino IDE, then click the Upload button (right arrow).

// SIMPLE SOIL MOISTURE SENSOR - FOR BEGINNERS
int sensorPin = 7;      // Soil sensor on pin 7
int ledPin = 8;         // LED on pin 8
int buzzerPin = 9;      // Buzzer on pin 9

void setup() {
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(sensorPin) == 0) {
    Serial.println("SOIL IS WET - No alarm");
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzerPin, LOW);
  } else {
    Serial.println("SOIL IS DRY - WATER YOUR PLANT!");
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
  }
  delay(500);
}
          
code upload'">
πŸ“– Code Explanation: setup() runs once. loop() runs forever. digitalRead() checks sensor (0=wet,1=dry). digitalWrite() turns LED on/off. Serial Monitor shows messages.
1

Open Serial Monitor

Tools β†’ Serial Monitor. Set baud rate to 9600.

2

Test with dry soil

Insert sensor into dry soil. LED turns ON. Serial Monitor shows "SOIL IS DRY".

dry soil test'">
3

Test with wet soil

Add water to soil. LED turns OFF. Serial Monitor shows "SOIL IS WET".

wet soil test'">
  • ❌ Upload error "Board not found": Check USB connection and select correct Port.
  • πŸ’‘ LED always on: Sensor reading reversed. Swap LOW and HIGH in code for LED.
  • 🌱 Sensor always reads "dry": Check VCC to 5V and GND to GND. Loose wires are #1 problem.
  • πŸ”Œ No red light on Arduino: USB cable may be power-only. Try different cable.
DateActivitySuccess?Notes
_______Collected materials______________
_______Wiring connections______________
_______Installed Arduino IDE______________
_______Uploaded code______________
_______Test with dry soil______________
_______Test with wet soil______________
_______Final demonstration______________
CriteriaExceeds (5)Meets (4)Approaching (3)Below (2-1)
Hardware AssemblyAll components correct, neat, stableWiring correct but slightly messyWiring has errorsNon-functional
Code FunctionalityUploads without errors, accurate sensor readingWorks with minor bugsCode uploads but sensor failsDoes not upload
UnderstandingExplains each component and code lineExplains most componentsPartial explanationNo explanation
DocumentationComplete log + photos + extra featureLog with 3+ photosMinimal documentationNone
🎯 To Achieve "Exceeds" (20/20):
  • Add LCD screen displaying "Water Plant!"
  • Add relay + water pump for automatic watering
  • Modify code to show moisture as percentage
  • Create poster on smart farming in Kenya
Embedded Systems Engineer IoT Developer Precision Agronomist Robotics Engineer Automation Technician

Kenyan companies like Twiga Foods, SunCulture, and Illuminum Greenhouses use soil sensors. Entry-level IoT technicians earn 30,000-50,000 KES/month. Experienced engineers earn 100,000+ KES/month.

πŸ–¨οΈ Print or Save as PDF

Take this guide to your lab. Copy code directly from the printed page.