To detect the light intensity using Arduino UNO.
Photo resistor allows interacting with the external environment, through intensity of light. It is based on light resistance that senses the light and will allow the microcontroller in the arduino to react and change the intensity of LED diode. The photo resistor creates a different resistance based on the intensity or the light. Changing the resistance through intensity changes the voltage too. The microcontroller reads different values and will light up the Led with more or less intensity. A low resistance value will occur when the sensor is well lighted and a high resistance value will occur when it is in darkness.
Circuit
Program:
int ldr=A0;//Set A0(Analog Input) for LDR.
int value=0;
void setup() {
Serial.begin(9600);
pinMode(13,Output);
}
void loop() {
value=analogRead(ldr);
Serial.println(value);
if(value<300)
{
digitalWrite(13,High);
}
else
{
digitalWrite(13,Low);
}
}
Result:The light intensity is measured successfully with Photo resistor and Arduino UNO.
Get all latest content delivered to your email a few times a month.