Home Automation Circuit Diagrams

Auto Intensity Control Of Street Lights Circuit Diagram

“Auto intensity control of street lights  circuit diagram with the help of  pic microcontroller“, after reading this article you will get to know that  how the auto intensity control system of street lights functions? How can we control intensity of street lights automatically? We can design this project very easily using simple electronic components & pic16f877 a microcontroller. Let’s begin with basic introduction of automatic intensity control of street lights.

The main purpose of project is to make street lights intelligent so that they can turn-on & off themselves automatically. Moreover, this project is supposed to make street lights’ intensity varying according to intensity of light & number of vehicles moving on road. Here are the main features of this project :

  1. Street lights turn themselves on automatically during night/darkness. They turn themselves off automatically during day time when the light is visible.
  2. Street lights automatically control their intensity according to the intensity of light. For instance, in the evening intensity of light starts decreasing, at the same time street lights start increasing their intensity. When there is no intensity of light in after evening, street lights turn themselves on with full intensity till mid-night at 12:00 am.
  3. There is another feature bundled with this project that is ‘vehicle detection’. Infrared-sensor-circuit can detect vehicles on road. After 12:00 am street lights start decreasing their intensity. At 1:00 am street lights turn-off automatically. After 1:00 am function of vehicles detection starts. If there is any vehicle on road after 1:00 am, street lights turn-on for 2 minutes. After that they turn-off automatically. In other words, After 1:00 am street lights turn-on only if there is any vehicle moving on the road. Otherwise they remain off. This process continues till morning. But after having visible intensity of light during morning street light turns off automatically.

Advantages of auto intensity control of  street lights :

Some of the main advantages & merits of them are given below:

  • Need not to control street lights manually.
  • Electrical power-saving.
  • Life time of street lights increases.
  • Street lights become intelligent.
  • Vehicles can be detected.

Circuit diagram description :

These are main components of auto intensity control of street lights. I have explained all the components & their functions briefly.

DS1307 real-time clcok:

DS1307 real-time clock keeps the information of the time during day & night. In order to control intensity of light & its turn-on/turn-off ability after 12:00 am, time is used. So, real-time clock ds1307 is interfaced with pic micro-controler so that we may keep information of real-time.

Light dependent resistor ( LDR) :

‘Light dependent resistor’ is actually a kind of light sensor that measures intensity of light. LDR is connected with pic16f877a micro-controller that measures light’s intensity. This measured intensity of light is then used to control street lights & their intensity.

Infrared sensor :

‘Infrared sensor’ is a combination of infra-red transmitter & receiver. We use it for the detection of vehicles after 1:00 am. If there is any vehicle moving on the road after 1:00am, street lights turn-on automatically for 2 minutes otherwise remain turned off. I have already explained the main function of ‘infrared sensor circuit’ (i.e vehicle detection) for this project.

Light crystal display :

LCD ( ‘liquid crystal display’ ) displays time & status of street lights. If street lights are turned on, LCD will display street lights are ‘on’, otherwise it will display that street lights are ‘off’.

Auto intensity control of street lights circuit diagram:

Complete circuit diagram of auto intensity control of street lights using pic microcontroller is given below :

auto intensity control of street lights circuit diagram
auto intensity control of street lights circuit diagram

List of components  for auto intensity control of street lights:

(Category,Reference,Value,Order Code)
Capacitors,"C1",22pF,Digikey 478-1018-6-ND
Capacitors,"C2",22pF,Digikey 478-1018-6-ND
Integrated Circuits,"U1",PIC16F877A,
Integrated Circuits,"U10",DS1307,
Miscellaneous,"RV1",10K,Digikey 3005P-101-ND
Code for auto intensity control of street lights:
Code for the project is written in Mikro C for pic. Complete C code for auto intensity control of street lights is written below :
// LCD module connections
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections

unsigned short read_ds1307(unsigned short address)
unsigned short r_data;
I2C1_Wr(0xD0); //address 0x68 followed by direction bit (0 for write, 1 for read) 0x68 followed by 0 –> 0xD0
I2C1_Wr(0xD1); //0x68 followed by 1 –> 0xD1

void write_ds1307(unsigned short address,unsigned short w_data)
I2C1_Start(); // issue I2C start signal
//address 0x68 followed by direction bit (0 for write, 1 for read) 0x68 followed by 0 –> 0xD0
I2C1_Wr(0xD0); // send byte via I2C (device address + W)
I2C1_Wr(address); // send byte (address of DS1307 location)
I2C1_Wr(w_data); // send data (data to be written)
I2C1_Stop(); // issue I2C stop signal

unsigned char BCD2UpperCh(unsigned char bcd)

return ((bcd >> 4) + ‘0’);

unsigned char BCD2LowerCh(unsigned char bcd)
return ((bcd & 0x0F) + ‘0’);

int Binary2BCD(int a)
int t1, t2;
t1 = a%10;
t1 = t1 & 0x0F;
a = a/10;
t2 = a%10;
t2 = 0x0F & t2;
t2 = t2 << 4; t2 = 0xF0 & t2; t1 = t1 | t2; return t1; } int BCD2Binary(int a) { int r,t; t = a & 0x0F; r = t; a = 0xF0 & a; t = a >> 4;
t = 0x0F & t;
r = t*10 + r;
return r;

int second;
int minute;
int hour;
int hr;
int ap;
int light;
int pwm;
int ir;
int adc_value = 0;

unsigned short set_count = 0;
short set;

char time[] = “00:00:00 PM”;
void main()
I2C1_Init(100000); //DS1307 I2C is running at 100KHz
TRISD = 0x07;
PORTD = 0x00;
TRISE.F0 = 1;
TRISC.F2 = 0; // designate PORTC pins as output
PORTC.F2 = 0; // set PORTC to 0

PWM1_Start(); // start PWM1 // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

set = 0;

if(PORTD.F0 == 0)
if(PORTD.F0 == 0)
if(set_count >= 4)
set_count = 0;
if(PORTD.F1 == 0)
if(PORTD.F1 == 0)
set = 1;

if(PORTD.F2 == 0)
if(PORTA.F2 == 0)
set = -1;
if(set_count && set)
case 1:
hour = BCD2Binary(hour);
hour = hour + set;
hour = Binary2BCD(hour);
if((hour & 0x1F) >= 0x13)
hour = hour & 0b11100001;
hour = hour ^ 0x20;
else if((hour & 0x1F) <= 0x00) { hour = hour | 0b00010010; hour = hour ^ 0x20; } write_ds1307(2, hour); //write hour break; case 2: minute = BCD2Binary(minute); minute = minute + set; if(minute >= 60)
minute = 0;
if(minute < 0)
minute = 59;
minute = Binary2BCD(minute);
write_ds1307(1, minute); //write min
case 3:
write_ds1307(0,0×00); //Reset second to 0 sec. & start Oscillator


second = read_ds1307(0);
minute = read_ds1307(1);
hour = read_ds1307(2);
hr = hour & 0b00011111;
ap = hour & 0b00100000;
time[0] = BCD2UpperCh(hr);
time[1] = BCD2LowerCh(hr);
time[3] = BCD2UpperCh(minute);
time[4] = BCD2LowerCh(minute);
time[6] = BCD2UpperCh(second);
time[7] = BCD2LowerCh(second);
time[9] = ‘P’;
time[10] = ‘M’;
time[9] = ‘A’;
time[10] = ‘M’;

Read Also>> Electrical Appliances Over Under Volt Protection Circuit Diagram 

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button