Chapter 4 Night Light

Ingredients

  • 1 Arduino
  • 1 Arduino USB cable
  • 1 Arduino power supply
  • 1 breadboard
  • 1 photoresistor (also called a “photocell”)
  • 1 LED (white, if you have one)
  • 3 jumper wires
  • Your computer

Optional Items

  • 2 extension jumper wires (male-to-female)
  • 1 hollow, translucent toy

Night lights are awesome and useful, and the best ones save power by only lighting up when it’s dark in the room. That’s what we’ll make with this project.

Concepts: Sensing Light, Taking Action

We’ll use a photoresistor to detect light. But this time, we’ll also check the amount of light we’re detecting and then do something with that information.

The circuit for this project is almost exactly the same as in “A Dark-Detecting Light.” The code, however, ...

Get Family Projects for Smart Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.