
Level Measurement with a Water Level Sensor
Beginner15 minA starter project that reads the water level sensor's analog output and writes the level as Empty, Low, Medium or High to the Serial Monitor once a second. As the sensor's parallel tracks go under water, the resistance drops and the reading rises. The thresholds (100, 400, 450) depend on the water's conductivity and the sensor; watching the raw values first and setting your own thresholds gives better results. Only dip the lower part with the tracks in water; keep the electronics and pins at the top dry. To reduce corrosion, do not leave the sensor powered all the time. No extra library needed.

What you need
Wiring steps
- 1
Power the sensor

Plug a red jumper wire into the 5V pin on the Arduino's POWER header. Connect its other end to the sensor's pin marked +.
- Arduino 5V → Sensor + (red wire)
- 2
Ground (GND) connection

Plug a black jumper wire into the GND pin on the Arduino's POWER header. Connect its other end to the sensor's pin marked −.
- Arduino GND → Sensor − (black wire)
- 3
Connect the signal (S) line

Plug a blue jumper wire into pin A0 on the Arduino's ANALOG IN header. Connect its other end to the sensor's S (signal) pin. The code reads the water level on this pin as a value from 0 to 1023 (sensorPin = A0).
- Arduino A0 → Sensor S (blue wire)
Arduino sketch
const int sensorPin = A0;
int value = 0;
void setup() {
// analogRead needs
// no pinMode; the hardware
// sets the pin up itself.
Serial.begin(9600);
}
void loop() {
value = analogRead(sensorPin);
if (value <= 100) {
Serial.println("Water Level: Empty");
}
else if (value <= 400) {
Serial.println("Water Level: Low");
}
else if (value <= 450) {
Serial.println("Water Level: Medium");
}
else {
// anything above
// 450 ends up here
Serial.println("Water Level: High");
}
delay(1000);
}
What the Serial Monitor shows
Water Level: Empty Water Level: Empty Water Level: Low Water Level: Low Water Level: Medium Water Level: High Water Level: High
Similar projects
LPG Gas Measurement with the MQ-5 (PPM)Intermediate30 minA project that reads the MQ-5 gas sensor's analog output, turns it into a voltage and the sensor's present resistance (Rs), measures Ro itself in clean air at start-up, and writes an estimated LPG concentration (PPM), worked out with the LPG curve in the MQ-5 datasheet, to the Serial Monitor every two seconds. At start-up it waits 10 seconds for the heater to settle, then calibrates for 5 seconds: the sensor must be in clean air then, with no gas near it. In clean air the Rs/Ro ratio is about 6.5 and the PPM below 1; with gas around, the ratio drops and the PPM rises clearly. The PPM value is an estimate: by its datasheet, a new sensor gives steady readings only after more than 24 hours of heating on first use. No extra library needed.Open project
Colour Detection with the TCS3200Intermediate30 minA circuit that tells the colour of an object held in front of it. The TCS3200 board measures light through red, green and blue filtered photodiodes and puts out the chosen colour's strength as a square wave; the Arduino times the three colours' pulses with pulseIn, prints them to the Serial Monitor and names the strongest. It teaches choosing a filter with digital pins and timing pulses. No extra library needed.Open project
Alcohol Measurement with the MQ-3 SensorBeginner25 minA project that measures alcohol vapour in the air with an MQ-3 gas sensor and writes the analog value and the threshold state to the Serial Monitor every half second. The analog value (0-1023) rises as the alcohol concentration goes up; the Limit value shows whether the threshold set with the trimmer on the board has been crossed. No extra library needed. The sensor's heater gets warm while it runs; on first use, leave the sensor powered for a while (ideally 24 hours), and let it warm up for a few minutes before measuring. The code uses 115200 baud, so pick 115200 in the Serial Monitor too.Open project
In the app, tick off every wire, match the parts to your inventory and pick up where you left off.
