light sensor and street light control using Arduino

Light sensor and street light control using Arduino is designed to measure intensity of light or amount of light. Street light is controlled automatically with the help of intensity of light and Arduino.Arduino UNO R3 is used in this project. Light dependent resistor is used for detection of light. Relay is used to provide isolation between Arduino and 220 volt AC street light. I will explain functionality and working of each component in later part of this article.Light sensor and street light control using Arduino

Circuit diagram of light sensor and street light using Arduino is shown below. Now I will explain each component use in this project.

Light dependent resistor (LDR) :

Light dependent resistor is used to detect change in light intensity or as a light sensor. LDR is basically a variable resistor. LDR resistance changes with the change in intensity of light. If intensity of light falling on LDR is high, LDR will have low resistance. When intensity of light decreases, LDR offer high resistance. Hence there is a inverse relationship between intensity of light and resistance of LDR.

So LDR is used as a light sensor. Now the question come to mind, how to measure resistance which in return can be used to calculate intensity of light. As you know Arduino UNO R3 board have six analog to digital converter channels. All analog to digital converters can measure voltage only. These channels can not measure resistance directly. But resistance can be measured indirectly by converting it into voltage form. This is basically call signal conditioning. 10K ohm resistor is used in series with LDR through 5 volt source. This circuit is used to convert resistance into voltage form. Voltage measured across LDR can be measure with the help of analog to digital converter of Arduino. This measured voltage can be converted back into resistance using voltage division formula.I assume that you know how to measure analog voltage using analog to digital converter of Arduino UNO R3. If you don’t know how to do this. I recommend you to go through following tutorial first before going further:

How to measure analog voltage using Arduino UNO R3
Relay :

In this project, relay is used to provide isolation between low voltage circuitry and high voltage circuitry. Arduino is also used to provide control signal to relay whenever intensity of light falls below a certain level. Control signal is generated from pin 13 of Arduino which is used as a output pin. Transistor is used as a switch here. If you don’t know how to use input or output pins of Arduino UNO R3, read following article :




 “How to use input or output pins of Arduino UNO R3

circuit diagram of light sensor and street light control using Arduino is shown below :

light sensor and street light control using Arduino

circuit diagram of  light sensor and street light control using Arduino

Code :

Code for light sensor and street light control using Arduino is given below :

int Adc_channel = A0; // select the input pin for the potentiometer
int output_pin = 13; // select the pin for the LED
int light_value = 0; // variable to store the value coming from the sensor

void setup()
{
// declare the ledPin as an OUTPUT:
pinMode(output_pin, OUTPUT);
}

void loop() {
// read the value from the sensor:
light_value = analogRead(Adc_channel);
// turn the ledPin on
light_value = 100 – light_value/10.24;
if(light_value>=90) // SWITCH of the light when light is 90 percent
{
digitalWrite(output_pin, LOW);
}
else
{
digitalWrite(output_pin, HIGH);
}

delay(500);

}

Code is self explanatory and I have also used comments with code line. But if you still have any issue while making this project, you are welcome to comment on this post.Thanks for reading this article. If you consider it helpful kindly share it with your friends.

15 Comments

  1. Priya January 8, 2015
  2. Priya January 8, 2015
    • smwal February 5, 2015
  3. dipen August 16, 2015
    • BILAL Malik August 16, 2015
  4. Sangapan Alfred December 27, 2015
    • BILAL Malik December 27, 2015
  5. Logeshwari February 17, 2016
  6. praful February 21, 2016
  7. ravi March 26, 2016
  8. ravi March 26, 2016
  9. Sam January 22, 2017
  10. Sam January 22, 2017
  11. Sa February 5, 2017
  12. mounika March 1, 2017

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 972 other subscribers