Project 7 — The Invisible Eye (Beam-Break Treasure Alarm)
Text written by Claude Fable 5 (claude-fable-5).
Project 7 — The Invisible Eye (Beam-Break Treasure Alarm)
The one idea: there is light you can’t see — and we have an eye that can. Block the invisible beam and the eye notices instantly.
This project introduces the part that powers the rest of the series (Projects 7–11): the optointerrupter — a small plastic U with an infrared LED on one prong and a phototransistor (an electronic eye) on the other, staring at each other across a ~5 mm slot. Anything that enters the slot breaks the beam. It’s the LDR from Project 6’s theremin idea all over again — light controlling a circuit — but a thousand times faster and with its own private light source.
Bought breakout modules instead of bare parts? The little boards marked “slot-type optocoupler / speed sensor” have the two resistors and often a comparator already on board — just power VCC/GND and watch the OUT (D0) pin. Which way the logic points (HIGH or LOW when blocked) varies by board, so test yours with an LED first. The projects below assume the bare part, which is cheaper and teaches more; with a module, skip straight to the trigger stages and flip things if the logic is backwards.
What you need
- 4×AA battery holder (6 V) — 3×AA (4.5 V) also works
- A slotted optointerrupter — ITR9608, H21A1, or similar (buy a few; they’re pennies, and Projects 8–11 want more)
- An NPN transistor (BC547, 2N2222, or similar) — new part, also pennies
- The NE555 from Project 6
- An active buzzer (screams on steady DC — the alarm needs that)
- Resistors: ~220 Ω, ~470 Ω, two ~10 kΩ, ~100 kΩ; a 100 µF capacitor
- A piece of stiff card, some thread, and a “treasure” to guard
Warm-up — find the invisible light
The optointerrupter has 4 legs: two for the hidden IR LED, two for the eye. Wire the LED side first: battery + → 220 Ω → LED anode → LED cathode → battery −. You’ll see… nothing. That’s the point.
Now look at the slot through a phone camera (the front selfie camera works best — it usually has no IR filter): a ghostly purple-white glow! The LED is shining hard the whole time, in a colour human eyes can’t see but the camera (and our electronic eye) can.
Don’t know which pair of legs is the LED? Nothing breaks if you guess wrong through a 220 Ω resistor — just try both pairs (both ways round) until the phone camera shows the glow. Detective work is part of the fun.
Build it — stage 1: finger in the eye
Wire the eye so that a blocked beam sounds the buzzer:
+6V ──┬── 220Ω ── IR LED ──────────────┐
│ │
├── 10kΩ ──┬── C (phototransistor)
│ │ E ───────────┤
│ [node] │
│ └── 10kΩ ── NPN base │
├── buzzer(+) NPN emitter─┤
│ buzzer(−)── NPN collector │
GND ──┴────────────────────────────────┘
- LED side: + → 220 Ω → LED → − (as in the warm-up).
- Eye side: + → 10 kΩ → phototransistor collector; emitter → −. The junction between the 10 kΩ and the collector is our signal node.
- Node → 10 kΩ → base of the NPN. Emitter → −. Buzzer from + to the NPN’s collector.
How it reads: beam shining → the eye conducts → node pulled LOW → transistor off → silence. Anything in the slot → eye goes blind → node jumps HIGH → transistor on → BZZZT. Poke a finger, a pencil, a LEGO piece into the slot. Instant response, every time — compare that with how lazily an LDR reacts.
(If yours does the opposite — buzzes on light, silent when blocked — the eye’s collector and emitter are swapped. Swap the two legs.)
Build it — stage 2: the treasure trap
An alarm that only sounds while the slot is blocked is easy to sneak past. A real alarm keeps screaming after a split-second trigger. That’s a job for the 555 in monostable (“one-shot”) mode: one nudge on its trigger and the output holds high for a time you choose.
The trap logic is beautifully sneaky, so set it up in this reversed way:
- Cut a small card tab and park it in the slot — beam blocked, node HIGH, everyone calm. Tie a thread from the tab to the treasure.
- Thief lifts the treasure → thread yanks the tab out of the slot → the beam reconnects → node snaps LOW — and a LOW on pin 2 is exactly what triggers a 555.
Wiring (remove the stage-1 NPN + buzzer first, or build alongside):
- 555 pin 1 → GND; pins 8 and 4 → +.
- Pin 2 (trigger) → the signal node from stage 1.
- 100 kΩ from + to pins 6 and 7 (tied together).
- 100 µF capacitor from pins 6/7 down to GND — mind the stripe: − leg to GND.
- Pin 3 (output) → buzzer +; buzzer − → GND. Add an LED + 470 Ω in parallel for a flashing-light feel.
The alarm time is s — and if the tab stays out, pin 2 stays low and the 555 keeps the alarm on until the tab is put back. Swap R or C to taste.
Arming ritual (kids love ritual): tab in the slot first, then connect the battery. Now the trap is live. Lift the treasure… WEEE-11-seconds-of-alarm.
What to say to the child
“There’s a kind of light our eyes can’t see — but look through my phone camera… see it glowing? This little U-shape has that secret light on one side and a robot eye on the other. The eye always knows if something is standing in between. So here’s the trick: we park this card in the gap and tie it to your treasure. The eye goes blind and everything is calm. But if a sneaky thief moves the treasure — the card pops out, the eye suddenly sees the light, and it yells THIEF for ten whole seconds. Want to be the thief first, or the guard?”
For you — the physics
- Why infrared? The emitter is a GaAs LED at ~940 nm — invisible to the eye (sensitivity dies past ~700 nm) but near the peak response of a silicon detector. Cheap to make, invisible to thieves, easy for silicon to see. Phone cameras see it because silicon sensors are IR-sensitive and front cameras often carry only a weak IR-blocking filter.
- A phototransistor is not an LDR. The LDR is bulk photoconductivity in CdS — light frees carriers throughout the material, and slow trap dynamics make it respond in ~tens–hundreds of milliseconds. The phototransistor is a junction device: photons absorbed near the base–collector junction create electron–hole pairs, the junction field sweeps them apart, and that photocurrent is then multiplied by the transistor’s current gain β. Response in microseconds — 4–5 orders of magnitude faster. Project 9 will make that speed audible. (Full story: the optoelectronics explainer.)
- The pull-up resistor is what makes a voltage. The eye itself is a light-controlled current valve; only by forcing that current through the 10 kΩ does it become a voltage swing at the node. Beam on → transistor saturates → node ≈ 0.2 V; blocked → transistor off → node ≈ 6 V. This resistor-plus-switch trick is the workhorse of all electronics.
- Why doesn’t room light set it off? Geometry is the filter: the eye sits recessed in a black plastic slot, staring straight at its own LED from 5 mm away. Ambient light mostly can’t get in at that angle. (Direct sunlight can — a fun failure to demonstrate.)
- The monostable: pin 2 low sets the internal latch, pin 3 goes high, and C charges through R until it hits ⅔ VCC, which resets it — hence . Same RC physics as Project 4’s fading LED, now used as a stopwatch.
Try next
- Doorway-sized eye: the same circuit works with a separate IR LED and phototransistor facing each other across a whole doorway — that’s exactly the light gate Project 8 builds for the race track.
- Siren instead of a scream: power the Project 6 tone generator from pin 3 of the alarm 555 — the alarm now switches on a whole siren circuit.
- Counting intruders is Project 11’s job.
← Back to Read Me First.