Automatic Street Light Controller Using Atmega8 AVR chip

Blog Contents


Energy can neither be created nor destroyed. It can only be converted from one form to another. Therefore it must be saved efficiently and utilized to its utmost potential.

We see the application of street lights every night making our city look colourful every night. The light energy emanating from these light should be used efficiently in order to save energy.

On our planet earth the resources available naturally are depleting gradually very day, so we must look for secondary options reliable enough to uphold the future.


  • This contraption consists of the following components:-
  1. Passive infrared sensor(PIR sensor)
  2. Atmega8 controller
  3. Real time clock(RTC)
  4. A collection of Light emitting diodes(LED)
  5. Light dependent resistor(LDR)
  • The light on street are activated based on the light energy input(solar on the LDR)
  • The resistance value reaches to maximum value during midnight.ere the RTC plays it’s vital role in clocking time.

The primary materials involved in this project are:-

  • ATMEGA controller
  • PID sensor
  • RTC(DS1307)
  • LCD
  • LDR

The pin known as PD0 of microcontroller is connected to the PIR sensor. Each and every form of objects emit some infrared rays.

The initial state of PIR sensor will be in high condition. After the process of detection of Infrared rays it makes transition to low state.



  • It employs I2C transmission protocol.(2 way data transmission -master to slave, slave to master) between any two separate devices.
  • The first and second pins are interfaced with the oscillating crystal.
  • The third pin is connected to battery source.
  • Sixth pin is connected to PC5 of microcontroller.
  • Fifth pin is connected to PC4 pin of microcontroller.

2.Liquid  Crystal Display:

  • The only role of a LCD is to display characters(16 letters x 2 rows).
  • The information from the Real time clock is shown here.
  • This process is continuous till it approaches a fixed time (5 am/6am)

3.Light Dependent Resistor:

  • They have low resistance in morning and a very high resistance in the dark.
  • It is interfaced with the microcontroller through ADC0 pin of the ATmega8 microcontroller.
  • LDR creates analog information(waves) which are then converted into digital information by the Analog Digital Converter (ADC).

3.ATmega8 (8051 microcontroller AVR):

  • The microcontroller needs an external clock to be activated.
  • Within the reset region of the microcontroller, the following components are embedded:-
  1. 10 microfarad capacitor
  2. 10 kilo ohms resistor
  3. Push button for active high or active low condition
  • The provision of an external pin is to get external memory while grounded. Therefore this pin is connected to VCC via 10 kilo ohm resistor.


  • This is the most crucial section of the apparatus
  • There are two main components involved:-
  1. IR Transmitter
  2. IR receiver
  • The job of the transmitter is to continuously transmit Infrared rays until an obstruction comes forward.
  • 8 IR Transmitters along with corresponding 470 ohm current limiting resistor (CLR) is connected to power supply.
  1. Light emitting diodes:
  • Finally the LED’s have to be interfaced with the microcontroller through Port 2.
  • The base of the 2n2222 transistors are connected to the LED’s whereas the emitter of the transmitters are grounded.
  • One LED  along with a series 100 ohms current limiting resistor is interfaced with the collector terminal of the corresponding  transistors.
  1. Turn on the power
  2. The Liquid crystal display displays digital information from RTC
  3. Keep the LDR in dark conditions.
  4. Then the ATmega8 monitors time continuously for fixed timings in coding.
  5. After the fixed time limit is set then the  street lights go off.
  6. You can test the motion sensor by placing your hand next to the sensor
  7. After a few seconds lights turn back on again.
  1. Can be employed on highways, narrow roads , express routes.
  2. In congested parking areas next to multi complex, cinema theatre.
  • Due to autonomous programmed operation a lot of useful energy can be saved.
  • Cost and maintenance for LED’s are much less so more savings.