The main purpose of this project “automatic street light control by pic microcontroller” is to minimize the cost of electricity and also cost of man power to manually on- off the street light. In the field of modern embedded world this project “automatic street light control by pic microcontroller” is used to on – off automatically by uses of LDR (Light dependent Resistor), Opamp, relay and pic16f877a microcontroller without any human interface.
In this project LDR used as a light sensor. We know the property of LDR (Light Dependent Resistor); the resistance of LDR depends on light. LDR generally two types
1) Positive coefficient ( Resistance will increase on fall of light)
2) Negative coefficient ( Resistance will decrease on fall of light)
Using this property of LDR we can use it as a light sensor.
Opamp is used as a comparator in this project it give constant output voltage if all condition is fulfill.
And use of microcontroller to control whole thing like when street light should glow and when it off automatically.
In this project automatic street light control by pic microcontroller, LDR sense the outside light when sun light is dropped, resistance of LDR decreases and voltage drop across LDR reduce and high voltage is feed to comparator circuit. After getting high voltage from sensor comparator send constant high voltage to microcontroller. And if intensity of sun light is increase in LDR, resistance of LDR increases and voltage drop across LDR increase and low voltage is feed to comparator circuit. After getting low voltage from sensor comparator send constant low voltage to microcontroller. So we can feel here Opamp work as an analog to digital converter it gives two state high or low to microcontroller depending upon LDR feed. In microcontroller we write program that when it receives high voltage from Opamp Street light will be off and when it receives low voltage from Opamp Street light will be on. In output section relay is used to on/off the street light. To know interfacing relay with microcontroller see my previous post Interfacing Relay with PIC Microcontroller. See the bellow block diagram to understand better way
Here you see the embedded C code for Automatic street light control by pic microcontroller
// Author : Subham Dutta
// Date : 08-02-14
// Website : www.nbcafe.in
trisb = 0;
portb = 1;
trisd = 1;
portd = 0;
if (portd == 0b00000001)
portb = 0b00000000;
if (portd == 0b00000000)
portb = 0b00000001;
See the simulation video how it simulate in Proteus
For more detail: Automatic street light control by pic microcontroller