Summary of Automatic street light control by pic microcontroller
Automatic street light control by pic microcontroller minimizes electricity and labor costs by automatically switching street lights using an LDR sensor, op amp comparator, relay, and a PIC16F877A microcontroller. The LDR senses ambient light, the op amp outputs a digital high/low to the microcontroller, which drives a relay to turn the lights on at low light and off at high light. Example Embedded C code and a Proteus simulation demonstrate the implementation.
Parts used in the Automatic street light control by pic microcontroller:
- LDR (Light Dependent Resistor)
- Op amp (used as comparator)
- PIC16F877A microcontroller
- Relay
- Power supply (for microcontroller and relay)
- Connecting wires and PCB/breadboard
- Street light (load)
- Proteus (simulation software)
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.
Project description:
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;
while (1)
{
if (portd == 0b00000001)
{
portb = 0b00000000;
delay_ms(1000);}
if (portd == 0b00000000)
{
portb = 0b00000001;
delay_ms(1000);}}
}
See the simulation video how it simulate in Proteus
For more detail: Automatic street light control by pic microcontroller
- How does the LDR detect day and night?
The LDR changes resistance with light: resistance decreases when sunlight falls and increases when light intensity rises, producing corresponding voltage changes sent to the comparator. - Can the op amp act as a digital signal for the microcontroller?
Yes, the op amp is used as a comparator and provides two states (high or low) to the microcontroller based on the LDR voltage. - What does the microcontroller do when it receives a high from the op amp?
When the microcontroller receives a high voltage from the op amp, it turns the street light off according to the described program logic. - What does the microcontroller do when it receives a low from the op amp?
When the microcontroller receives a low voltage from the op amp, it turns the street light on according to the described program logic. - How is the street light physically switched on and off?
The microcontroller drives a relay in the output section, and the relay switches the street light on or off. - Is any human interface required to operate the system?
No, the system operates automatically without human interface as described in the project. - What microcontroller and code are used in the project?
The project uses a PIC16F877A microcontroller and example Embedded C code provided in the article. - Can this project be simulated before hardware implementation?
Yes, the article references a Proteus simulation and provides a simulation video link.
