A water level indicator detects and indicates the level of water in an overhead tank and relays the information back to a control panel to indicate whether the tank has a high or low water level. In this tutorial, I am going to use the ULN2003 IC to create a simple, inexpensive water level indicator. Using this circuit you can easily control the wastage of water and electricity. Watch this video, for detailed step by step instructions on how to build this circuit and to know how this circuit works. Towards the end of the video I will also discuss whether its really worth building this circuit.
Components Required
For this tutorial we need:
- 1 x ULN2003 IC
- 8 x Different Color LEDs
- 8 x 1K Resistors
- 1 x 220Ohm Resistor
- 1 x Buzzer
- A Long Ribbon Cable, and
- A Breadboard or a Custom Built PCB
About The ULN2003 IC
The notch on the top indicates the starting and stopping points of the numberings of the chip. Starting from left to right going counterclockwise this is the Pin number 1 of the IC.
- On the left hand side Pin 1 to 7 are the Base Inputs.
- On the right hand side Pin 10 to 16 are the Collector Outputs.
- Pin 9 is the Common Cathode node for flyback diodes (required for inductive loads).
- And, Pin 8 is the Common Emitter shared by all channels of the IC. This pin is typically tied to ground.
The UNL2003 IC contains 7 High Voltage, High Current NPN Darlington Transistor Arrays each rated at 50V, 500mA in a 16-pin DIP package. You can connect the IC directly to a digital logic (like Arduino or Raspberry Pi, TTL or 5V CMOS device) without an external dropping resistor. The ULN2003 is known for its high current and high voltage capacity. The Darlington pairs can be "paralleled" for higher current Output. To know more about this IC, please check out my "Tutorial No. 51: All About ULN2003 IC", the link is in the description below.
Circuit Diagram
The circuit is very simple.
I have connected 7 LEDs to the 7 OUT Pins of the IC via 1K Resistors. On my left, are the 7 digital inputs which are connected to a ribbon cable. The other end of the ribbon is submerged in the water tank with exposed terminals at various heights to detect the water levels. Along with the 7 wires, there is an eighth wire that stays at the bottom of the tank and is connected to the +ve terminal.
As the tank starts filling up, the water level rises and a conductive path is created between the positive terminal and the base of Darlington Transistor inside the IC. Hence a logic HIGH is sent to the Input Pin of the IC which leads to the corresponding OUT Pin to go LOW lighting up the LEDs one by one starting from the bottom Red to the top Green. The bottom Red LED indicates lack of water and the top Green LED indicates that the tank is 100% full.
You can also add a buzzer to the circuit to get an audio indication when the tank is full.
If you want to be super funky, you can also add a relay module which can turn on and off the water pump.
Breadboard Demo
Before assembling the components on a PCB, lets do a quick test on a breadboard to make sure our logic works as expected.
For this demo, I am going to fill up a coffee mug with normal tap water.
As you can see, the LED indicators go up from bottom Red to the top Green as I keep filling the mug. The buzzer starts buzzing when the mug is 100% full. Hence, our setup is working as expected.
The Board
So, this is how my board looks like in 2D and 3D.
If you want to learn how to design a PCB, please check out my "Tutorial No. 45: Transformers PCB BADGE", the link is in the description below.
Component Assembly
Now, lets solder the components to the board.
Lets first solder all the resistances to the board.
Then, lets solder all the LEDs to the board. I am using a 3mm Green LED as the power indicator.
Next, I am soldering the IC base to the board. Since I care a lot about my ICs and micro-controllers, I never solder them...
I love this. I wonder if you can do something to avoid sending current thru the liquid you are measuring? On older motorcycles, they sometimes have a thermistor in the gas tank, and they push some current thru it and can somehow tell from the resistance whether it is submerged (shedding heat) or not... It would be really nice if you could have a sealed/fully insulated set of sensors you could just drop into the tank of whatever and monitor it.