How to Make a Water Level Sensor With Arduino
by rich254 in Circuits > Electronics
512 Views, 1 Favorites, 0 Comments
How to Make a Water Level Sensor With Arduino
![IMG20210824184503.jpg](/proxy/?url=https://content.instructables.com/FYX/GDMB/KSQ2WTUB/FYXGDMBKSQ2WTUB.jpg&filename=IMG20210824184503.jpg)
Hello friends in this instructable i am going to show you how to make a water level indicator with an alarm based system using the Arduino microcontroller
THE IDEA
The main idea in this project, is to be able to create an precise water level sensor that indicates the level of the water, and sounds an alarms when the water is at a certain level whether high or low . with this project you can be able to configure as per your needs to indicate water level when high mid or low then sound an alarm at a certain level .
Supplies
1. MATERIALS
2. Computer
3. Arduino uno boad
4. 2 Leds x2
5. Two 10k resistors x2
6. water level sensor
7. Buzzer
8. connector Jumper wires
9. Breadboard
The Components
![IMG20210824184748.jpg](/proxy/?url=https://content.instructables.com/FFK/L9Z3/KSQ2WUAR/FFKL9Z3KSQ2WUAR.jpg&filename=IMG20210824184748.jpg)
![IMG20210824184839.jpg](/proxy/?url=https://content.instructables.com/F0Z/I8JJ/KSQ2WUGI/F0ZI8JJKSQ2WUGI.jpg&filename=IMG20210824184839.jpg)
![IMG20210824184910.jpg](/proxy/?url=https://content.instructables.com/FGK/QYU7/KSQ2WUHI/FGKQYU7KSQ2WUHI.jpg&filename=IMG20210824184910.jpg)
![IMG20210824184948.jpg](/proxy/?url=https://content.instructables.com/F99/28HS/KSQ2WUKE/F9928HSKSQ2WUKE.jpg&filename=IMG20210824184948.jpg)
![IMG20210824184647.jpg](/proxy/?url=https://content.instructables.com/FWD/RZWU/KSQ2WU6W/FWDRZWUKSQ2WU6W.jpg&filename=IMG20210824184647.jpg)
![IMG20210824184815.jpg](/proxy/?url=https://content.instructables.com/FCO/AXTR/KSQ2WUCO/FCOAXTRKSQ2WUCO.jpg&filename=IMG20210824184815.jpg)
![IMG20210824184900.jpg](/proxy/?url=https://content.instructables.com/FME/9XAR/KSQ2WUHH/FME9XARKSQ2WUHH.jpg&filename=IMG20210824184900.jpg)
Wiring
![IMG_20210824_190633.jpg](/proxy/?url=https://content.instructables.com/FS9/PXY4/KSQ2WAAK/FS9PXY4KSQ2WAAK.jpg&filename=IMG_20210824_190633.jpg)
![IMG20210824184503.jpg](/proxy/?url=https://content.instructables.com/FYX/GDMB/KSQ2WTUB/FYXGDMBKSQ2WTUB.jpg&filename=IMG20210824184503.jpg)
![water level sensor project with Arduino tutorial](/proxy/?url=https://content.instructables.com/FW1/9QBX/KSQEIJ3C/FW19QBXKSQEIJ3C.jpg&filename=water level sensor project with Arduino tutorial)
Video link: click here to watch a full video guide
#steps
:one
Connect the digital pin5 and ground to the Buzzer .
:Two
Connect the resistors to each positive side of the LEDS
then connect the digital pins 6 and seven to the resistors then ad the GND wires.
:Three
Connect the digital pin9 to the positive side of the sensor
A0 to the signal connection and GND to the -ve terminal.
:four
connect your Arduino to the pc for programing.
video link: watch a full video guide
Code
#define sensorPin A0 /*declares the pinsto be used*/
#define sensorPower 9
#define pinAlarm 5
#define pinLed 6
#define pinLed2 7
int store=0 ; //creates a initial variable;
void setup() {
// put your setup code here, to run once;
Serial.begin(9600);
pinMode(sensorPower,OUTPUT);
pinMode(sensorPin,OUTPUT);
pinMode(pinLed,OUTPUT);
pinMode(pinLed2,OUTPUT);
pinMode(pinAlarm,OUTPUT);
digitalWrite(sensorPower,LOW); }
.
void loop() {
// code to run repeatedly:
int waterLevel=readSensor();
if(waterLevel>=100)
{ digitalWrite(pinAlarm,HIGH);
digitalWrite(pinLed,HIGH);
delay(100);
digitalWrite(pinLed,LOW);
delay(10);
digitalWrite(pinLed2,HIGH);
delay(10);
}
else{ digitalWrite(pinAlarm,LOW);
digitalWrite(pinLed,LOW);
digitalWrite(pinLed,LOW);
digitalWrite(pinLed2,LOW);
}
//................code for alarmand LEds..........................;
Serial.print("Water Level IS : ");
Serial.println(waterLevel);
delay(100);
}
int readSensor(){
digitalWrite(sensorPower,HIGH);
delay(10);
store=analogRead(sensorPin);
digitalWrite(sensorPin,LOW);
return store; }
#NOTE
remember to adjust the readings to match your sensor reading as indicated by the serial monitor then set your alarm levels as you wish [if(waterLevel>=100)]
Connect to Pc
![water level sensor project with Arduino tutorial](/proxy/?url=https://content.instructables.com/FN4/FRIM/KSQEIJAK/FN4FRIMKSQEIJAK.jpg&filename=water level sensor project with Arduino tutorial)
upload the code and test out your sensor , then adjust the alarm levels in the code as you may wish.
Enjoy creating the circuit.
https://youtu.be/rePA22QtveY