Close your eyes and try to pour a glass of water. How do you know when to stop? Many blind and partially sighted people use a small gadget called a liquid level indicator: it hangs on the rim of the cup and beeps when the drink comes close to the top. In this lesson you build your own with the water level sensor and a buzzer. As the water rises, the beeps get faster and higher, so you can hear the cup filling up, and when it is nearly full the alarm plays a clear "stop" signal. Designing for people who can't see is a great way to think differently: everything the device says has to be in sound.
What you'll learn
- How the water level sensor measures how deep it is in water
- Why the sensor should only get power while it measures
- How to turn a reading into a sound that tells you how full the cup is, with
map() - How to design a device for people who can't see the screen or the lights
What you need
- UNO R3 board and USB cable (UNO R3 Starter Kit)
- Water level sensor (45-in-1 Sensor Kit)
- Passive buzzer module (45-in-1 Sensor Kit)
- A clothes peg or a paper clip to hang the sensor on the rim
- A glass and a jug of tap water
- Breadboard and jumper wires (UNO R3 Starter Kit)
Use it with tap water only. The sensor is a bare circuit board, made for learning, not for food. Test it with a glass of tap water and don't drink water that has touched it. A finished device for real drinks needs food-safe contacts, for example two short pieces of stainless steel, like the ones in the indicators you can buy. Never use it with hot drinks while you are testing: hot water and electronics don't mix, and it is easy to get burnt when you can't see.
Wiring

Build it step by step
Plug in all the parts first, then add the wires in this order. In each picture the new wires are bright and the ones from earlier steps are faded. Click a picture to see it larger.



| From | To |
|---|---|
| Water level sensor + | UNO pin 7 |
| Water level sensor − | GND |
| Water level sensor S | UNO A0 |
| Passive buzzer S (or +) | UNO pin 8 |
| Passive buzzer − | GND |
Sensor modules from different makers can label and order their pins differently. Always follow the labels printed on your module.
The sensor's + pin goes to pin 7, not 5V, so the sketch can switch the sensor on only while it measures. Clip the sensor on the inside of the glass with a peg, with the long lines pointing down. The lowest end of the lines should be about 2 to 3 cm below the rim: that is where "stop" will be, leaving room so nothing spills.
The sketch
const int POWER_PIN = 7, SENSOR_PIN = A0, BUZZER_PIN = 8;
const int TOUCH = 80; // the water has reached the sensor: start beeping
const int FULL = 420; // nearly full: say "stop". Change this after the calibration step
bool full = false;
int readLevel() {
digitalWrite(POWER_PIN, HIGH); // power on only while measuring:
delay(10); // the sensor corrodes much more slowly
int value = analogRead(SENSOR_PIN);
digitalWrite(POWER_PIN, LOW);
return value;
}
void setup() {
Serial.begin(9600);
pinMode(POWER_PIN, OUTPUT);
tone(BUZZER_PIN, 880, 100); // "ready" chirp, so you know it is on
delay(150);
tone(BUZZER_PIN, 1320, 100);
}
void loop() {
int level = readLevel();
Serial.print("Reading: ");
Serial.println(level);
if (level < TOUCH) { // dry: empty cup, or sensor taken out
full = false; // ready for the next drink
delay(200);
return;
}
if (full) { // already said "stop": stay quiet
delay(200);
return;
}
if (level >= FULL) { // nearly full: three long beeps
full = true;
for (int i = 0; i < 3; i++) {
tone(BUZZER_PIN, 1568, 300);
delay(450);
}
return;
}
// Filling up: the higher the water, the higher and faster the beeps
int pitch = map(level, TOUCH, FULL, 440, 1320);
int pause = map(level, TOUCH, FULL, 600, 60);
tone(BUZZER_PIN, pitch, 40);
delay(pause);
}
Calibrate it
- Upload the sketch and open the Serial Monitor at 9600 baud. With the sensor dry, the reading is close to 0.
- Hang the sensor in an empty glass and pour slowly. Watch the numbers rise as the water climbs up the lines.
- Stop pouring when the glass is as full as you would like it, and note the reading, for example 430.
- Set
FULLa little lower than that number, for example 400, and upload again. A lowerFULLmeans "stop" comes earlier, leaving more room.
Try it
- Empty the glass, hang the alarm on it and close your eyes (or ask a friend to wear a blindfold).
- Pour slowly. You hear slow, low beeps as soon as the water touches the sensor, then faster and higher beeps.
- Stop when you hear the three long beeps. Open your eyes: how full is the glass?
- Lift the sensor out to reset it for the next glass.
What you should see

How it works

The water level sensor has long copper lines next to each other. Half of them are connected to + and the other half go to the S pin through a transistor. Dry, nothing connects them. Water conducts a little electricity, so the deeper the sensor goes into water, the more of the lines are bridged and the higher the voltage on S: analogRead() gives a number from about 0 (dry) to 500 or more (deep in water).
If current flows through the lines all the time, the copper slowly corrodes in water. So the sketch powers the sensor from pin 7 for only 10 milliseconds, measures and switches it off again. The sensor only has power for a small part of the time: 10 ms out of every 210 ms while it waits in a dry cup.
map() turns the reading into sound. At TOUCH (80) the beep is 440 Hz with 600 ms between beeps; at FULL (420) it would be 1320 Hz, three times higher, with only 60 ms between beeps. Your ears can follow that change easily, a bit like a car's parking sensor. The full variable makes the alarm say "stop" only once, and stay quiet until the sensor is dry again, so it doesn't keep beeping while you drink.
Good assistive devices are designed together with the people who use them. Ask: is it loud enough in a noisy kitchen? Can you tell which way to hang it by touch alone? Does it need a vibration motor for people who are both blind and deaf?
Try this next
- Add a second "almost there" level: a different, short melody when the glass is three quarters full.
- Make it quieter for night time: a button that switches between loud and soft beeps (shorter tones sound softer).
- Find a blind or partially sighted person, or a teacher of the visually impaired, and ask what they would change. Real designers do this!
- Learn more ways to help blind people in the ultrasonic walking aid and the Braille lesson.
Troubleshooting
-
It beeps with no water: the sensor is still wet, or water has run between the lines on the back. Dry it with a tissue and raise
TOUCHa little. -
It says "stop" too early or too late: repeat the calibration step and change
FULL. Tap water with more minerals conducts better and gives higher readings. - The reading is always 0: check that + goes to pin 7 and S to A0. The sensor only has power during the 10 ms measurement, so a multimeter on + shows almost nothing: that is normal.
- No sound: check the buzzer on pin 8. An active buzzer only makes one pitch; use the passive one.