Arduino Lesson #4

Lesson Objectives: Create a smart LED that turns on in a dark room and off in a light room. Describe the chemistry and physics governing photoresistors (light dependent resistors). Utilize a voltage divider to read voltage in a circuit.

Materials required:

  • Breadboard
  • Wires
  • Microprocessor with cable
  • LED
  • Resistors (100 and 10k Ohms)
  • Photoresistor (light dependent resistor, mine is a GL5539)
  • The below code.

Image of the breadboard:

Image of the schematic:

Code used for this project, which I entitled, “PhotoresistorData”:

Other helpful links that will assist with learning the content in this video or with production of circuit diagrams:

  • I used this page to design the breadboard picture. The link should take you to the project that I designed. is a pretty handy little website that allows you to design and see your circuitry.
  • I used this website to design the circuit schematic. This is one of the better free programs.
  • This website has a fantastic tutorial on voltage dividers as does this website.
  • This YouTube video walks you through the concept of voltage dividers in an easy to understand manner.
  • This tutorial was fantastic at explaining the process I outlined in the video. Their code doesn’t work in all lighting conditions, as it doesn’t have a way to calibrate based on native light conditions.
  • The code used in this tutorial is a modification of the code found here.