Dark Detector
You'll build a light that switches itself on at dusk from three parts and no code, then put it to work somewhere in your home.
About
Sensors are just components that change when the world changes. A light-dependent resistor drops its resistance in daylight. Put it in a voltage divider, feed that to a transistor, and you have a night light that costs about a dollar and needs no microcontroller. The first version usually comes on in daylight and goes off at night, which means your divider is upside down, and swapping two parts fixes it. Build it, then give it a job.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 5
- Takes
- One evening
- Skill level
- Novice (never tried it)
- Cost
- Cheap (under $10)
- Supplies
- You need some
- Where
- At home
- Other people
- On your own
Requirements
-
1
Measure an LDR in daylight, in shade, and covered by your hand. You'll see something like 1k in sun and over 100k in the dark. Write down all three numbers. Take a photo of the meter on the LDR under one of the three conditions. Photo
-
2
Build a voltage divider with the LDR and a 10k resistor and measure the midpoint. Put the battery across the pair and the meter at the junction between them. The voltage swings as you cover and uncover the LDR, and that junction is your sensor output. Take a photo of the meter at the junction with the LDR covered. Photo
-
3
Drive an LED through an NPN transistor so it lights when the room goes dark. A 2N2222 or a BC547 is fine. Run the divider output to the base through 1k, the emitter to ground, and the LED with its resistor from positive to the collector. If it lights in daylight instead, swap the LDR and the fixed resistor. Film the LED coming on as you dim the lights. Video
-
4
Replace the fixed resistor with a potentiometer and set the switch point. Now you can tune when it triggers. Set it so the light comes on at the point where you'd actually want one. Take a photo of the pot in the circuit. Photo
-
5
Install it somewhere it does a job for at least a week. A hallway, a stairwell, a tent or a closet all work, and a battery pack and tape are perfectly fine. Take a photo of it in place, lit, at night, and give us one line on whether the batteries lasted the week. Photo