This sketch guide you to create a LED animation transition using LDR ( Light Dependent Resistor) with Arduino. Photo Resistor are variable resistor which change resistance depending on the light hitting the sensor. When you put your hand closer to the sensor, you block an increasing the amount of light, which increases the resistance of the LDR. as you move your hand away the amount of light hitting the surface of LDR increase thus decreasing the resistance.

The change in the resistance of the LDR(Light Dependent Resistor) will affect the voltage being read at one of the Arduino’ Analog Input (A0). As resistance increase, the voltage drops (and vice versa).

V = IR ( V = Voltage / I = Current / R = Resistance )

Voltage reading will be used to select which LED to light up.

PhotoCell and LEDs

Electronic Parts Required

  • Arduino
  • 9x LED
  • 9x 220k Resistors
  • 1x LDR (Light Dependent Resistor)
  • Jumper Wires

 Arduino Sketch


Starter #15 Using Photo Resistor and LEDs

Leave a Reply

Your email address will not be published. Required fields are marked *