Automatic control of street lights

Automatic control of street lights is deigned to turn on and turn of street lights automatically. This project check the amount of light. If light is 80 percent available, it automatically turn off street lights. But if amount of light is less than 80 percent, this project will automatically turn on street lights. one can also adjust it according to its requirement. Light sensor is used to detect intensity of light. PIC161F877A microcontroller is used interfaced with light sensor to sense amount of light available. Control signal is generated with the help of pic16f877a microcontroller after analyzing amount of light. Control signal generated by pic microcontroller is used to turn on transistor which in turn energize the relay coil and relay turn on the street light. I have used only one lamp in this project. Because this is just for demonstration purpose. To use it practically, you can use as many street lights as many you want to control through this automatic control of street lights.

This project have many applications. For example, you are too much lazy to turn on or turn off your street light manually and you forget to turn it on or off daily. So you easily use this project to save your electricity and in return your money. In countries where load shedding is a big issue due to short fall in electricity and less in resources to generate electricity. In these countries, load shedding issue can be resolved too some extent by saving as much as you can. By using automatic control of street lights, we can save maximum amount of energy which is useful for your nation and also beneficial for you. Because it will reduce you electricity bill and in return save your money.

Circuit description :

 Followings are the main components of automatic control of street lights :

Light sensor :

Light sensor is used to sense amount of light. There are many light sensors available in market but Light dependent resistor (LDR) is used as a light sensor. Because it is cheap in price, easily available in market and can be easily interfaced with microcontroller to sense intensity of light. LDR have property to change its resistance according to intensity of light. If light is high, LDR will have low resistance and if light is low, LDR will have high resistance. So microcontroller can easily read this resistance in the form of voltage and which can be back converted into proportional value of light by using a formula available in data sheet.I recommend you to have look in data sheet of LDR.

Relay interfacing with microcontroller :

As I have already mentioned above that microcontroller is used to analyze intensity of light and to generate control signal which in turn on or off transistor which in turn energize relay to turn street light on or off. NPN transistor is used as a switch and resistor at the base of transistor is used as current limiting resistor. Diode is used to avoid back emf voltage which may produce sparking across relay.

Circuit diagram :

circuit diagram of automatic control of street lights is shown below :

circuit diagram of automatic control of street lights

circuit diagram of automatic control of street lights


To check working of this project and to understand  code watch following video:

Automatic control of street lights using microcontroller by bilalmalikuet


Code :

Code for this project is written in Mikro C and 8Mhz crystal is used in this project.

int light;
void read_ldr()
unsigned int adc_value=0;
light = 100 – adc_value/10.24;
if(light>=80) // SWITCH of the light when light is 80 percent


void main()

while (1)

click here to buy proteus simulation

if you feel any issue after reading this article, comment on this post. Kindly don’t forget to share this article with your friends. thanks 🙂


  1. Yasmin October 11, 2014
    • BILAL Malik October 11, 2014
      • khizar May 10, 2016
  2. smwal February 8, 2015
    • BILAL Malik February 10, 2015
      • Zainab hussam April 12, 2017
  3. rakib March 11, 2015
    • BILAL Malik April 19, 2015
  4. Clinton April 19, 2015
    • BILAL Malik April 19, 2015
  5. medi April 24, 2015
  6. Junaid June 4, 2015
    • BILAL Malik June 4, 2015
      • Junaid June 4, 2015
      • RK October 12, 2016
  7. Junaid June 4, 2015
    • BILAL Malik June 4, 2015
    • prashant April 7, 2016
    • muhire May 24, 2016
    • RUSHI October 12, 2016
  8. Kritika Tripathi June 26, 2015
  9. Enayat July 7, 2015
  10. shashikant December 31, 2015
  11. Eb3n January 26, 2016
  12. Rajbihari Prajapati February 8, 2016
  13. eff February 27, 2016
  14. sagar March 24, 2016
  15. moorthy April 27, 2016
  16. Jayb May 23, 2016
  17. muhire May 23, 2016
  18. Gokul July 17, 2016
  19. Nikhil August 30, 2016
  20. Tanjib Alam September 17, 2016
  21. HARIKRUSHN September 24, 2016
  22. Chow Yew hoong October 24, 2016
  23. Ahmad November 16, 2016
  24. Ahmad November 16, 2016
  25. sumanth.g.h November 18, 2016
  26. partha November 30, 2016
  27. Sahithi February 16, 2017
  28. Sahithi February 16, 2017
  29. Ahmad February 19, 2017
  30. shaikh February 20, 2017
  31. jyoti vasuja March 3, 2017
    • soujanya March 3, 2017
  32. soujanya March 3, 2017
  33. Shruthi March 4, 2017
  34. sam March 7, 2017
  35. nivetha March 20, 2017
  36. Abba Sulayman March 24, 2017
  37. randomelectronicguy March 29, 2017
  38. Navya sree April 30, 2017
  39. tytyraa June 4, 2017
  40. abhijit June 5, 2017

Add Comment