
Kit 001
💻 Step 3 – Upload the Code
You’ve wired your system — now it’s time to make it smart.
We’ll upload a simple Arduino program that reads your soil moisture sensor and turns the water pump on when the soil gets too dry.
🧰 What You’ll Need
Arduino IDE installed
USB-C cable to connect your Arduino
The code below (or download from GitHub)
What This Code Does
Checks the sensor once per second
If the moisture level is too low (above 1000), it activates the pump
Otherwise, it keeps the pump off
Select Your Board & Port
In Arduino IDE:
Go to Tools → Board → Arduino Uno R4 WiFi
Then Tools → Port and select your Arduino’s port (e.g., COM3 or
/dev/tty.usbmodem...
)
5. Click Upload
Hit the ✓ checkmark to verify
Click the → arrow to upload
Open Serial Monitor to see real-time moisture values
What’s a “Moisture Value”?
Dry soil = High value (usually 800–1023)
Wet soil = Low value (300–700)
You can tweak the
if (moisture > 1000)
value to make it more or less sensitive