Back to the lesson

Build yours at home

Night-light with a rule knob

What we're doing

Build a lamp that switches itself on in the dark. The knob sets the rule line: how dark it must get before the lamp comes on.

About 30 minutes.

Goes with these lessons

No kit? Try this

Same solar garden light. Cover it slowly, a little at a time. Find the moment it switches on. That moment is its rule line.

Get these parts

New to breadboards? See Getting set up
  • 4×AA battery holder with a switch (electronics shop or online)
  • One photoresistor, one NPN transistor (PN2222 or S8050), one 10k knob (potentiometer), one LED, one 220 Ω resistor, one 10k resistor, the breadboard and jumper wires (Elegoo kit)

Fill each holder with the matching number of AA batteries (household).

Keep it safe

Battery power only, never household power. Use AA packs matched to the parts, not a 9V battery. A grown-up connects and disconnects the pack. Stop immediately if any part warms. Never join the pack's two metal ends: the wires can get hot. Coin cells stay with grown-ups, locked away. CPSC warns a swallowed button or coin cell can burn through a child's throat in about two hours; suspected swallowing needs emergency medical care immediately.

A grown-up checks the transistor's legs against the kit tutorial before switching on.

Steps

  1. 1

    With the switch off, push the battery's red wire into the + line and its black wire into the − line.

  2. 2

    Find the transistor's legs: flat side toward you, legs down, usually E, B and C from left to right. Check the kit tutorial. Push them into three rows next to each other.

  3. 3

    Light path. Put the 220 Ω resistor from the + line into an empty row. Push the LED's long leg into that row and its short leg into the C row. Add a jumper from the E row to the − line.

  4. 4

    Rule knob. Push the knob's three legs into three rows: left, middle, right. Add a jumper from the + line to the left-leg row, and one from the right-leg row to the − line.

  5. 5

    Put the 10k resistor from the knob's middle-leg row into the B row.

  6. 6

    Light sensor. Push one photoresistor leg into the B row and the other into the − line.

  7. 7

    Switch on. Cover the sensor slowly with your hand. Find the moment the lamp comes on. That's the rule line.

    Not working? Never comes on? Turn the knob the other way. On even in the light? Shine a flashlight on the sensor and turn the knob until it goes off.

  8. 8

    Turn the knob a little and try again. Now it needs more dark, or less. You moved the rule line.

  9. 9

    Switch off and take the parts out.

Talk while you build

  • How dark must it get before the light switches on?
  • What changes when you turn the rule knob?

Spot it at home

  • Night lights, porch lights, car headlights that switch on in tunnels, a heater's thermostat: if colder than the setting, heat on.

What rule does our heater follow?