Skip to content

Lesson 13: A smart night light

A light that thinks

  • A street light switches on by itself when it gets dark. Inside there is a light sensor.
  • In lessons 7 and 8 a knob gave the voltage and map set the brightness. Now you build the sensor circuit yourself, and the light controls the LED.
  • You build one with an LDR: its resistance is small in bright light and very big in the dark.
  • With a 10 kΩ resistor it makes a potential divider, so the voltage on A0 follows the light. analogRead(A0) gives 0 to 1023.

Words for this lesson

Word Meaning
LDR light-dependent resistor: a resistor that reacts to light
potential divider two resistors in a line; the middle point gets part of the voltage
PWM switching a pin on and off very fast, so an LED looks dimmer
map change a number from one range into another range
mood here: a way the light behaves (off, soft, full)

Log in or create account

IGCSE, A-Level & AP