Search This Blog

Powered by Blogger.

Translate

[TC] Water Level Indicator with Alarm using 8051 Micro controller (AT89C51)

This article illustrates the construction and working of a liquid/water level indicator. Such an indicator is used in tanks to indicate the level of liquids and alert us when the tank is full. So by this circuit we can monitor the various levels of the tank and can avoid spillage of water and also we can configure our supplies according to the various levels of tank. Such module or circuit can be installed in big buildings where manual monitor of tanks is difficult and its indicator can be placed at some centralized place.





This water level indicator circuit works on the principle that water conducts electricity. A wire connected to VCC and four other wires are dipped in tank at different levels namely quarter, half, three-fourth, full and their output are taken on pins P3.0, P3.1, P3.2, P3.3 via a transistor BC547. Port P2 is connected to data pins of LCD and P1.0, P1.1, P1.2 are respectively connected to RS, RW, and EN pins of LCD.

Initially when the tank is empty LCD will show the message VACANT. As the tank starts filling up wire at different levels get some positive voltage, due to conducting nature of water. This voltage is then fed to their corresponding pins on controller. When level reaches to quarter level, LCD displays the messageQUARTER. On further rise of level, HALF and 3/4 QUARTER are displayed on LCD. When tank gets full LCD shows the message FULL CLOSE TAP. A buzzer is also provided to produce a alert the user when the tank gets filled. This buzzer can be made off by pressing the switch connected between pin 15 of controller and VCC.
Circuit Diagram :



CODE
// Program to make a Liquid level indicator using LCD
#include<reg51.h>
sbit rs=P1^0; //register select pin
sbit rw=P1^1; //read/write pin
sbit e=P1^2; //enable pin
sbit quat=P3^0; //pin connected to quater level of tank
sbit half=P3^1; //pin connected to half level of tank
sbit quat_3=P3^2; //pin connected to three -fourth level of tank
sbit full=P3^3; //pin connected to full level of tank
sbit spkr_on=P3^4;  
sbit spkr_off=P3^5; // pin to off speaker

void delay(int k) //delay function
{
int i,j;
for(i=0;i<k;i++)
  for(j=0;j<1275;j++);
}

void write(int j) //write function
{
rs=1;  //selecting command register
rw=0;  //selecting to write
P2=j;  //putting value on the pins
e=1;  //strobe the enable pin
delay(1);
e=0;
return;
}

void cmd(int j)  //command function
{
P2=j;  //put the value on pins
rs=0;  //selecting command register
rw=0;  //selecting to write
e=1;  //strobe enable pin
delay(1);
e=0;
return;
}

void puts(char *a) //puts function to print a string
{
unsigned int p=0;
for(;a[p]!=0;p++)
write(a[p]);
}

void lcd_init(void) // function to initialise the LCD
{
cmd(0x38); //setting 8-bit interface, 2 lines, 5*7 Pixels
delay(1);
cmd(0x0e); //turning on underline visible cursor
delay(1);     
cmd(0x01); //clearing screen
cmd(0x80); //moving cursor to the begining of line 1 of LCD
}

void main()
{
quat=half=quat_3=full=spkr_off=1; //configuring as input pins
quat=half=quat_3=full=spkr_off=0; //lowering input pins
spkr_on=1;    // making speaker on pin high,as it works on negative logic
while(1)
{
  while(quat==0&&half==0&&quat_3==0&&full==0&&spkr_off==0)   //condition when tank is empty
  {
   lcd_init();        // initialising LCD
   puts("VACANT");       //printing VACANT on lcd
  }
  while(quat==1&&half==0&&quat_3==0&&full==0&&spkr_off==0)	//condition when tank is quater
  {
   lcd_init();
   puts("QUATER");      //printing QUATER on lcd
  }
  while(quat==1&&half==1&&quat_3==0&&full==0&&spkr_off==0)	//condition when tank is half
  {
   lcd_init();     
   puts("HALF");      //printing HALF on lcd
  }
  while(quat==1&&half==1&&quat_3==1&&full==0&&spkr_off==0)	//condition when tank is three-fourth
  {
   lcd_init();
   puts("3/4 FULL");     //printing 3/4 FULL on lcd
  }
  while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_off==0)	//condition when tank is full
  {
   lcd_init();
   puts("FULL;CLOSE TAP");     //printing FULL;CLOSE TAP on lcd
   spkr_on=0;// Enabling speaker
  }
  while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_on==0&&spkr_off==1)//enabling high speaker_off pin
  {
   spkr_on=1;//disabling speaker
  }
}
}


Digital thermometer circuit

Digital thermometer circuit.

CA3162, CA3161 & LM35.

A simple digital thermometer circuit with out a micro controller and having a seven segment LED read out is shown here. The circuit is based on three ICs: CA3162, CA3161 and LM35. CA3162 is a monolithic analogue to digital (A/D) converter that has BCD output. The A/D converter inside the IC is a dual slope type with differential inputs. The IC has an internal timing circuitry and hold function. When the hold function is enables, the output IC latches itself to the present state. CA3161 is a monolithic BCD to seven segment converter IC. It can directly drive a seven segment display and there is no need for current limiting resistors. LM35 is a three terminal precision temperature sensor IC from National semiconductors. The output of LM35 is highly linear and has a scale factor of 10mV/C. The IC consumes only 60uA as standby current and is calibrated directly in degree Celsius.

Circuit diagram.

About the circuit .

IC LM35 is used for sensing the temperatures. A voltage proportional to the temperature will be available at pin 2 of the LM35 and this voltage is coupled to the high input pin (pin11) of the CA3162. CA3162 does the job of converting this analogue voltage in to a BCD format. POT R1 connected at pin 13 of the CA3162 is used for gain adjustment while POT R2 can be used for ZERO adjustment. Capacitor C2 is the integrating capacitor of the A/D converter circuitry inside the IC. The working of the CA3162 is as follows, the voltage applied to the input pin (pin11) is converted into a current (using the built in V/I converter circuit) that charges the integrating capacitor C2 for a preset amount of them. Then the integrating is disconnected from the V/I converter circuit and a reference constant current source is connected to the integrating capacitor. The time taken for the charge to restore to its original value is noted and the number of clock cycles elapsed during this time will be a measure of the charge induced by the input voltage (voltage applied to pin 11). The point of restoration is sensed using an internal comparator which latches the counter and the count is then multiplexed into the BCD outputs and the entire cycle is repeated. The hold pin CA3162 (pin6) can be used for running the IC in different modes. When the hold pin is grounded or left open the IC runs in low speed mode (sampling rate is 4Hz). When hold pin is held at +5V, the IC runs in high speed mode i.e. a sampling rate of 96Hz. When the hold pin is held at a fixed 1.2V, the BCD output latches to the current state. C1 is the power supply bypass capacitor whose job is to bypass noise if any from the power supply line.
The next section of the circuit is the BCD to seven segment decoder plus display driver section. For that purpose CA3161 is used. The BCD output pins of the CA3162 are connected to the input pins of the CA3161. Transistors Q1, Q2, Q3 common anode terminals of the corresponding seven segments displays. Q1, Q2, Q3 are driven by the 4, 3, 5 pins (digit driver pins) of the CA3162 respectively.

Notes.

  • The circuit can be assembled on a vero board or on a PCB.
  • Use 5V DC for powering the circuit.
  • POT R2 can be used for Zero adjustment.
  • IC2 and IC1 must be mounted on holders.
  • Capacitor C1 must be placed as close as possible to the power and ground pins of the CA3162.
  • Capacitor C2 could be a polyester type while C1 can be a ceramic capacitor.
  • The DC power supply used for powering this circuit must be well regulated and free from any sort of noise.
  • The type numbers of the driver transistor are not critical and you can make suitable substitutions.
  • Hold function can be enabled by providing the pin 6 with 1.2V using a voltage divider network.

Water level Controller


Water level controller circuit.

Description.
A simple but very reliable and effective water level controller circuit diagram is shown here. The circuit uses 6 transistors, 1 NE555 timer IC, a relay and few passive components. The circuit is completely automatic which starts the pump motor when the water level in the over head tank goes below a preset level and switchess OFF the pump when the water level in the over head tank goes above the full level.
Probe D is positioned at the bottom level of the tank while probes A, B and C are placed at full, half and medium levels of the tank respectively. The level sensing part of the circuit is built around transistors Q1, Q2 and Q3. When water level is below the quarter level probes A, B and C are open and the transistor Q1, Q2 and Q3 remains OFF. When the water level rises and touches the probes the corresponding transistors gets biased and switches ON. Resistors R1, R2, R3 limit the bases current of corresponding transistors while resistors R4, R5, R6 limit their collector current. LEDs D1, D2 and D3 provide a visible indication of the current water level.
When the water level goes below medium, transistor Q2 gets switches OFF and its collector goes positive. Collector of Q2 is connected to the base of transistor Q6 and as result transistor Q6 gets switched ON. Transistor Q5 will be also ON because its base in connected to the collector of Q4 which is presently OFF. As a result when the water level goes below medium relay K1 gets energised and the pump is driven. The relay is wired in the latching mode so that even if the water level goes above medium level the pump remains ON so that the tank gets completely filled. For wiring the relay in latching mode one set  of N/O contacts is used. When relay is activated these contacs close which forms a short across collector and emitter of Q6. This makes the state of Q6 irrelevant to the opertion of the relay and the relay remains ON as long as the transistor Q5 is ON. The only way to make the relay OFF is by switching OFF Q5 and it is done automatically when the water level reaches the full level.
Collector of transistor Q1 is connected to the trigger pin (pin2) of IC1. When the water level reaches full level the transistor Q1 gets switched ON. As a result its collector goes to ground level which triggers the IC1 which is wired as a monostable. The output of IC1 goes high for about 1S. This makes the transistor Q4 ON for the same time and transistor Q5 whose base is connected to the collector of Q4 is switched OFF cutting the supply to the relay. This makes the motor OFF and it remains OFF until the water level again goes below the medium level.
Resistor R8 is a pull up resistor for the trigger pin of the NE555. Capacitor C3 couples the collector of Q1 to the trigger pin of NE55 and facilitates edge triggering whenever the transistor Q1 goes ON. A monostable circuit can be made edge triggered by connecting the trigger signal to the trigger input pin through a capacitor. The capacitor blocks DC and passes sudden changes. The circuit used here is termed as negative edge triggered because the monostable is triggered when ever the trigger input signal falls. R10 and R12 limits the collector current of Q4 and Q5 respectively while R9 and R11 limits their base current. R13 limits the base current of Q6 while D4 is a freewheeling diode which protects the switching transistors from voltage transients.
Circuit diagram.

 
Water level controller circuit diagram

probes
Probe arrangement diagram
The probes can be arranged as shown in the diagram above. Insulated Aluminium wires can be used as the probes. The probes can be binded on a plastic rod and should be erected vertically inside the tank. The length of the probes wires and the supporting plastic rod must be chosen according to the depth of the tank. Since DC is used in the level sensing section electrolysis will occur in the probes and so the probes require small maintinances in 1 or 2 month intervals. Using AC in the sensing section will completely eliminates the chance of electrolysis and I am presently working on such a circuit. You can expect it soon.
Notes.
  • Use 12V DC for powering the water level controller circuit.
  • The relay I used was a 5V/220 ohm relay and that’s why the current limits resistor R12 was added in the circuit. If you use a 12V relay then the R12 can be shorted.
  • Do not use a relay that consumes 500mA. Maximum collector current PN2222 can handle is 600mA.
  • Use insulated single strand aluminium wires for probe and they can be arranged in the tank as per the probe arrangement diagram.
  • Use a holder for mounting NE555.
  • The circuit can be assembled on a Perf board.
  • K1 must be a double pole relay.
  • The load current, voltage ratings of the relay must be selected according to the ratings of the pump motor.
  • The type number of the transistors used here are not very critical and you can do suitable replacements if any type number is not availble.
  • Most of the components required for this project can be found inside your scrap box.

Power supply for this circuit.

12V DC supply
12V DC power supply
A classic 12V regulated DC supply based on 7812 is shown above. A power ON indicator LED is also added in the circuit.Resistor R13 limits the LED current. A small aluminium heatsink can be fitted to the 7812 for better saftey.Small Al heatsinks for TO-220 package are readily available in the market

Touch Switch Circuit


Touch Switch Circuit using NE 555

Description

This is the circuit diagram of a small touch plate controller using IC NE 555 .This circuit is ideally useful for making touch operated doorbells, buzzers,toys etc which when touched on the touch plate operates the relay for a preset time and the turns off automatically.
This circuit is realized by utilizing the high input impedance of trigger pin of the 555 IC.When  the IC is triggered by the induced voltage of human body the output goes high for a time determined by R1 and C1.The transistor is used to drive the relay.The relay contacts can be used to drive the load like bell, motor , lights etc.

Notes.

To make the touch plate cut a 1 square cm thin metal sheet.
To setup the circuit connect to power supply and  adjust R1 while keeping touching on the touch plate.Stop at the point where relay activates.If relay is in the activated state initially then do the same until the relay is deactivated.

Touch Switch Circuit Diagram

touch switch circuit



Page Rank

google pagerank

Write For Us

Submit a Guest Post

Find us on Facebook

Categories

555 Timer IC 7 segment Display 8051 Project AC Circuits Adafruit Alarms Amplifier Circuits Analog Circuits android Arduino arm processor Assembly Languange Atmel Atom Size Audio Circuits augmented reality Automotive Circuits avr Battery Circuits Bicycle Gurad bluetooth Cable TV Circuits Cambridge University Camera Technology Circuit Boards Clipping And Clamping Circuits Clocking And Timer Circuits Computing contact lens Contact Us Form Contests Controller Circuit Conversion Circuits Counter Circuits Digital Electronics diy circuits Downloads EFY EFYTimes Electronic Books Electronic Components Electronic Locks And Keys Engineering Fan Circuits Filter Circuits Fire Alarm free Frequency Fun And Game Circuits future Google Hack n Mod Ham Radio Circuits heart rate monitoring High Voltage Circuits Home Circuits IC Guide ieee Industrial Circuits Infrared Instructables Inventions ipad lcd Led Circuits Light Related Lighting Circuits Medical Circuits Meter Clocks Microcontrollers Microprocessors Mini Projects modules Movie maker NatGeo Navigation Notice Optical Fiber PC Circuits PCB Boards Physics pnp transistor Power Supplies Printing Projects Programmer Project Ideas Projectors Protection circuits Proximity Detectors Radar Radio Circuits Radio Transmitters Raspberry Raspberry Pie Remote Circuits Retis Lab RFID Robot Cars Robotics Science Science Alert Security And Safety Sensor Circuits Servo Motors Smallest Smartwatches sms Software solar cell sound application Spectram Switch Technology News Telephone Related Television Related Test And Measurement Circuits Thermal Projects Tone generator circuits Touch Screen Tutorials Wearables Wi-Fi Wireless
Like us on Facebook
Follow us on Twitter
Recommend us on Google Plus
Subscribe me on RSS