Photoresistor With Arduino

Photo resistors, also called LDR (light-dependent resistors), is a semiconductor component. It exhibits photoconductivity.

Night light and photography light meters use photoresistors. Their latency property is used in audio compressions and outside sensing. They can be found in alarm clocks, outdoor clocks, solar street lamps etc

Interfacing Photoresistor With Arduino

Microcontroller is not necessary to make LDR work. Circuits use photoresistors as well. The resistance value is maximum when disclosed to light and minimum in dark. 

 

Requirements

  1. Arduino Uno
  2. LED (light emitting diode)
  3. Bread board
  4. Pin to pin jumper wires

Schematics

Follow the circuit diagram below to make connections

Code

				
					int LED = 13;
void setup()
{
    Serial.begin(9600);
    pinMode(LED, OUTPUT);
}
void loop()
{
    unsigned int AnalogValue;
    AnalogValue = analogRead(A0);
    Serial.println(AnalogValue);
    if(AnalogValue>50){
        digitalWrite(LED, HIGH);
    }
    else{
        digitalWrite(LED, LOW);
        }
}
				
			

Conclusion

Once the code is uploaded, open serial monitor and observe the readings. Change the value in conditional statement (IF) by observing the value to make the sensor perform actions at day time or at night

Leave a Reply

Your email address will not be published.