Introduction: WATER LEVEL INDICATOR USING ARDUINO
Water-level indicator is used to indicate the level of water in over head tank,by using this we can avoid the overflow of water ,and at any time we can know the level of water in tank, it has a simple circuit .
Step 1: HARDWARE SETUP
HARDWARE REQUIRED :
ARDUINO UNO:
BC548: BC548 is a general purpose NPN bipolar junction transistor,it is used for amplification and switching purposes,it has three terminals collector-base-emitter.
RESISTORS:Resistor is a current limiting passive two terminal electrical component-resistor act to reduce current flow to led.
RESISTOR VALUES
470OHMS220 OHMS22K
INTERFACING CIRCUIT:
the above circuit have three level low,average,high and when level of water increase transistor base get conducted and due to conduction switching process occurs and micro-controller get interrupted and it shows the level based on the respective transistor conduction.
Step 2: PROJECT CODE
byte sensorPin[] = {8, 9, 10};
byte ledPin[] = {11, 12, 13}; // number of leds = numbers of sensors
const byte sensors = 3;
int level = 0;
void setup()
{
Serial.begin(9600);
for(int i = 0; i < sensors; i++)
{
pinMode(sensorPin[i], INPUT);
pinMode(ledPin[i], OUTPUT);
}
}
void loop()
{
level = 0;
for(int i = 0; i < sensors; i++)
{
if(digitalRead(sensorPin[i]) == LOW)
{
digitalWrite(ledPin[i], HIGH);
level = sensors - i;
}
else
{
digitalWrite(ledPin[i], LOW);
}
}
Serial.println("Water level");
switch(level)
{
case 1:
Serial.println("HIGH");
break;
case 2:
Serial.println("AVERAGE");
break;
case 3:
Serial.println("LOW");
break;
default:
Serial.println("NO WATER");
break;
}
delay(50);
}
23 Comments
7 years ago
additional comment. You can add a 1 kilo-ohm resistor in series with the 5V 'common' wire to protect the transistor against damage from accidently touching the wire ends directly.
Reply 5 years ago
hey can I see your schematic?
6 years ago
for(int i = 0; i < sensors; i++)
can you explain function of this code???
Reply 6 years ago
it's a loop
6 years ago
can u explain the working process?
6 years ago
Does with require water with salt or pure water will work?
6 years ago
is the water still safe for drinking?
Reply 6 years ago
Is it safe for drinking?
6 years ago
Can you please explain the purpose of R1/R2/R3. TIA.
6 years ago
what is the use of the below line here ? confusing...
const byte sensors = 3;
7 years ago
how can we download this????
Reply 6 years ago
download what, copy the code. rightclick save mage
7 years ago
What changes to the schematic needs to be made if i have a 3.3 V micro controller and a 55 gallon tank?
Reply 6 years ago
only supply voltage and test resistor values if they work
7 years ago
I implemented this circuit but all three pins are showing HIGH LEVEL .. not average , not low level.. plz help me.
Reply 6 years ago
always give full details when asking question, and images of your setup, there can be a million thing wrong.
6 years ago
It will cause electrolysis and the + will disintegrate.
(done it) i have this idea to periodically scan sensors for change in level. like after 10 20 sec
7 years ago
I didn't get any output . I didn't use any Register . Is it mandatory to use Register ..
7 years ago
Hi, I think the values for the resistors R1, R2 and R3 are specified too low. They should be at least 220Kohm. I used 470Kohm since the water 'resistance' is about 1-2Mohm. Also omit unspecified resistor in the 5V line that goes into water. Resistors R4, R5 and R6 will adjust the collector current, so choose higher than 470ohm if you want less than 10mA, like 1Kokm ->5mA. Logic levels with this circuit are 'high' for no water contact and 'low' for water contact. I used a 2SC945 standard bipolar NPN transistor and it works reliably. Good luck.
7 years ago
hi. what software do you used to compile the circuit?