Serial at 9600 baudTap a part to see what it does.
Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.
Build it step by step
0 of 4 doneMount the strip
Tape it inside the container, electronics above the waterline.
Wire the sensor
+ to D7, − to GND, S to A0.
LEDs and buzzer
Green D10, yellow D11, red D12 through 220 Ω; buzzer on D8.
Calibrate
Note the readings at half and full, edit HALF and FULL, upload again.
How do you build a water level indicator?
A water level strip in a container lights green, yellow or red LEDs for low, half and full, and beeps when it is about to overflow. You need Arduino Uno R3, Water level sensor module, LED 5 mm green, LED 5 mm yellow, LED 5 mm red, Resistor 220 Ω × 3, Active buzzer 5 V and Breadboard 830 Tie Points. It takes 4 steps and about 45 minutes.
- Level
- Intermediate
- Time
- About 45 min
- Parts
- 8
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- SemiconductorsBuyLED 5 mm green × 1
- SemiconductorsBuyLED 5 mm yellow × 1
- SemiconductorsBuyLED 5 mm red × 1
- PassivesBuyResistor 220 Ω × 3
- Motors & ActuatorsBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Sensor + | Uno D7 | Powered only while reading |
| Sensor − | GND | Ground |
| Sensor S | Uno A0 | Level |
| D10 / D11 / D12 | 220 Ω then green / yellow / red LED, cathodes to GND | Level lights |
| Buzzer + | Uno D8 (− to GND) | Overflow warning |
Code
No libraries. Watch the serial readings with the strip dry, half covered and fully covered, then set HALF and FULL.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const int PWR = 7, SENSE = A0, GREEN = 10, YELLOW = 11, RED = 12, BUZZ = 8;
const int DRY = 0, HALF = 350, FULL = 520; // calibrate with your container
int readLevel() {
digitalWrite(PWR, HIGH); delay(10);
int v = analogRead(SENSE);
digitalWrite(PWR, LOW);
return v;
}
void setup() {
for (int p : {PWR, GREEN, YELLOW, RED, BUZZ}) pinMode(p, OUTPUT);
Serial.begin(9600);
}
void loop() {
int v = readLevel();
Serial.println(v);
digitalWrite(GREEN, v < HALF);
digitalWrite(YELLOW, v >= HALF && v < FULL);
digitalWrite(RED, v >= FULL);
digitalWrite(BUZZ, v >= FULL + 20);
delay(1000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
205 206 205 206 205
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Dry | Green on |
| Half full | Yellow on |
| Full | Red on, buzzer beeps just above full |
If it does not work
Readings drift over days
Corrosion: make sure the sensor is only powered while reading.
Never reaches FULL
Your strip is shorter than the water rise: lower FULL.
Readings at 0 when wet
The + wire is not on D7, or D7 is never set HIGH.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the water level indicator?
Arduino Uno R3, Water level sensor module, LED 5 mm green, LED 5 mm yellow, LED 5 mm red, Resistor 220 Ω × 3, Active buzzer 5 V and Breadboard 830 Tie Points.
How long does the water level indicator take to build?
About 45 minutes for a intermediate maker, in 4 steps.
How do I know the water level indicator works?
Dry: Green on. Half full: Yellow on. Full: Red on, buzzer beeps just above full.
Readings drift over days: what should I check?
Corrosion: make sure the sensor is only powered while reading.
Never reaches FULL: what should I check?
Your strip is shorter than the water rise: lower FULL.
Readings at 0 when wet: what should I check?
The + wire is not on D7, or D7 is never set HIGH.
