Français
← Back to the sheet

A4 or Letter, portrait. Light ink: outlines only.

Tinker Mission · Projects 01

Intrusion alarm

Guard a door with an invisible line. When the door opens, the infrared beam breaks and a buzzer sounds. It runs on batteries, so you can stick it anywhere. Then, if you like, add a phone alert or solder it into a permanent box.

  • Level 1
  • One afternoon (2–3 h (base build). Permanent version: add 2–3 h · estimate)
  • About 50–85 CAD (estimate)
  • Ask for help: steps 5, 6 and 7

Links

  • Online sheettinkermission.com/en/projects/intrusion-alarm/
  • The codetinkermission.com/sketches/01-intrusion-alarm.ino
  • The lesson: Voltage, current, resistancetinkermission.com/en/lessons/voltage-current-resistance/

Scan a code with a phone camera to open the online sheet, download the code or read the lesson.

Safety first

  • 3.3 V logic only. The receiver's output wire goes to GPIO32 and is pulled up to 3V3 only (the code turns on the board's built-in pull-up). The ESP32 uses 3.3 V logic (3.6 V absolute maximum): never connect any ESP32 signal pin to 5 V. The one exception is the board's own 5V power pin, which takes the battery pack and nothing else.
  • The red rail is 3V3 only. The 4×AA pack goes into the 5V pin row and the blue rail (−). Never put its + wire on a red rail.
  • The two packs are not interchangeable. The 4×AA pack (up to 6.4 V) is for the ESP32 only. The emitter is rated 5.5 V at most, so it takes the 3×AA pack, never 4 cells. Put a label on each: “ESP32 4×AA” and “EMITTER 3×AA”.
  • Pack OFF before USB. The board takes one power source at a time. With the pack ON and USB plugged in, current can flow back into the cells. Switch the pack OFF before you plug in the USB cable, and before you move any wire.
  • Batteries: never mix alkaline and rechargeable cells, old and new, or brands in one holder; replace all the cells at once. Follow the + / − marks inside the holder. Never let the bare ends of a pack touch each other or metal. Never recharge alkaline cells; recharge NiMH cells only in a NiMH charger, outside the box. No 9 V battery, no 5- or 6-cell holder, no LiPo for this mission. Take the cells out if the alarm sits unused for a month; white crust on a cell means it leaked, so wear gloves, clean it and dispose of it properly. Recycle used cells at a drop-off point.
  • Keep the beam out of direct sunlight: sunlight contains infrared and can cause false alarms.
  • Small parts and cells: keep small parts, wires and batteries away from pets and from anyone who might put them in their mouth.

Parts · Base build

  • ×1 ESP32 boardESP32-DevKitC V4 or a clone: ESP32-WROOM-32, 38 pins, 3.3 V logic. Check the regulator before you buy or use it (step 2): the 3-legged chip with a big tab near the 5V pin should say AMS1117.
  • 1 pair Infrared break-beam pair, 5 mm5 mm LED version (Adafruit 2168 type): emitter (2 wires, red and black) + receiver (3 wires: red +, black −, white or yellow OUT), open-collector output, supply 3.3–5.5 V. Rated range about 50 cm at 5 V; we use 15–20 cm, so there is margin. Test it.
  • ×1 4×AA battery holder with ON/OFF switch, cover and header-pin endsSwitched 4×AA holder with a snap-on cover and 0.1 in (2.54 mm) pin ends that plug straight into the breadboard (Adafruit 830 type). Fresh alkaline cells give about 6.4 V, flat ones about 4 V. The board needs about 4.4–6.5 V: below that it misbehaves, so change the cells before they get that low.
  • ×1 3×AA battery holder with ON/OFF switch and coverSwitched 3×AA holder, about 4.5 V. Three cells, never four: the emitter takes 5.5 V at most.
  • ×7 AA batteriesAlkaline AA (LR6), or low-self-discharge NiMH AA (the kind sold as “ready to use”). Same type and brand in each holder, never mixed. 4×NiMH only if your regulator is not an AMS1117 (step 2).
  • ×2 WAGO 221-412 lever connectors2-conductor lever connectors, one for red and one for black. If a wire is very thin, strip 11 mm and fold it back on itself so it fills the connector. (Alternative: if both the pack and the emitter have header-pin ends, 2 female-to-female jumpers.)
  • ×1 220 Ω resistor220 Ω, 1/4 W, through-hole
  • ×1 LED5 mm LED, any colour, through-hole
  • ×1 Active buzzer moduleActive (built-in tone) buzzer module, 3 pins S / + / −, 3.3–5 V, sounds when S is HIGH. Test it in step 11: some modules are the other way round.
  • ×1 Push button6 mm tactile switch, 4 legs
  • ×1 BreadboardFull-size 830 points (fits a 38-pin ESP32)
  • 1 set Jumper wiresMale-to-male, about 10–20 cm, 20 wires or more. Only if your 4×AA holder has bare wires instead of pin ends: 10 cm of 22 AWG solid wire, one red and one black.
  • ×1 USB data cableData cable (not charge-only) matching the board's port. Used for programming only: the alarm itself runs on batteries.

Tools

  • Computer with Arduino IDEArduino IDE 2.x + “esp32 by Espressif” 3.3.x (free download from arduino.cc)
  • TapeDouble-sided tape, masking tape or blue tack (removable)
  • Ruler or tape measure (optional)Any
  • Sticky labels and a penAny
  • Multimeter (optional)Any basic digital multimeter

Wiring

Mission 01 wiring, breadboard view (battery power) Full-size breadboard seen from above, row 1 on the left. The ESP32 pins sit in columns i and a, rows 1 to 19, USB port at row 1; column j stays free: each pin on the j side has a free hole. Fifteen numbered wires, numbered as in the sheet. 1 red from 3V3 (j19) to the right red rail, which is 3V3 only; 2 black from GND (j6) to the right blue rail, the GND rail. The ESP32 runs on its own switched 4×AA pack, labelled ESP32 4×AA: wire 3, the pack's red pin end, goes into j1, the hole next to the 5V pin, never into a red rail; wire 4, its black end, into the right blue rail. The IR receiver: 5 red to the 3V3 rail, 6 black to the GND rail, 7 white or yellow (OUT) into j13, next to GPIO32. 8 orange from GPIO25 (j11) to the buzzer S (j39), 9 red from the 3V3 rail to buzzer plus (j40), 10 black from buzzer minus (j41) to the GND rail. 11 green from GPIO26 (j10) to row 26 (b26), the R1 strip: the 220 ohm resistor R1 lies from d26 to d30; the LED's long leg is in b30, its short leg in b31; 12 black from d31 to the left blue rail, near row 34. 13 blue from GPIO27 (j9) to j44; the button straddles the gap in e44, f44, e46 and f46; 14 black from a46 to the left blue rail. 15 black links the left blue rail to the right blue rail. The emitter is not on the breadboard: on the door, its red and black wires join the red and black wires of its own switched 3×AA pack, labelled EMITTER 3×AA, through two lever connectors. No wire goes from the emitter to the ESP32. FIG. 1 — BREADBOARD VIEW (FROM ABOVE)+−−+jihgfedcba+−−+jihgfedcba253035404555ESP325VCMDD3D213GND1214GPIO27GPIO26GPIO2533GPIO323534VNVPEN3V3USB · row 1S+−+AB++++ONOFFESP32 4×AA34j1 = 5VIROUT+−756IR receiveron the frame or wall, wiredOUT wire: white or yellowEmitter: on the door,with its own pack (panel E).8GPIO25 → buzzer S1113GPIO27 → button A12910121415buzzer moduleR1 220 ΩLEDbuttonRight rails (top here): red + = 3V3 only · blue − = GND.Left rails (bottom here): blue − = GND, joined by wire 15 · red + unused.LED: long leg (+) in b30, short leg in b31.Held with row 1 toward you, column j is on the right.Wire list#COLOURFROMTO1redESP32 3V3 (j19)3V3 rail (+), right2blackESP32 GND (j6)GND rail (−), right3redESP32 4×AA pack red (+)j1 (5V row) · not a red rail4blackESP32 4×AA pack black (−)GND rail (−), right5redreceiver red (+)3V3 rail (+)6blackreceiver black (−)GND rail (−)7yellowreceiver OUT (white/yellow)GPIO32 (j13)8orangeESP32 GPIO25 (j11)buzzer S (j39)9red3V3 rail (+)buzzer + (j40)10blackbuzzer − (j41)GND rail (−)11greenESP32 GPIO26 (j10)row 26 (b26), R1 strip12blackLED − row (d31)GND rail (−), left13blueESP32 GPIO27 (j9)button leg A (j44)14blackbutton leg B (a46)GND rail (−), left15blackleft GND rail (−)right GND rail (−)Eemitter red / blackEMITTER 3×AA, 2 WAGO3–7 and E are the parts' own wires. E never goes to the ESP32.EOn the door: emitter + its own pack+++ONOFFEMITTER 3×AAIRIR emitter2 WAGO, red to red, black to blackNo wire to the ESP32 · none across the door gap.Power rulesESP32 4×AA (3, 4): red → j1, the 5V row.Never on a red rail: it is 3V3 only.EMITTER 3×AA (E): the emitter only.Never 4 cells on the emitter (5.5 V max).Receiver OUT (7) → GPIO32 only. Never 5 V.Pack OFF before USB and before moving a wire.
#ColourFromTo
1redESP32 3V3 (hole j19)3V3 rail (right red +)
2blackESP32 GND (hole j6)GND rail (right blue −)
3red4×AA pack red (+)the hole next to the ESP32 5V pin (j1). Never a red rail.
4black4×AA pack black (−)GND rail (right blue −)
5redIR receiver red (+)3V3 rail
6blackIR receiver black (−)GND rail
7yellowIR receiver OUT (white or yellow)GPIO32 (j13; pulled up to 3V3 by the code, never to 5 V)
8orangeESP32 GPIO25 (j11)buzzer S (j39)
9red3V3 railbuzzer + (j40)
10blackbuzzer − (j41)GND rail
11greenESP32 GPIO26 (j10)220 Ω resistor, leg 1 (b26)
12blackLED short leg (−)GND rail
13blueESP32 GPIO27 (j9)button leg A (j44)
14blackbutton leg B (diagonal)GND rail
15blackleft blue railright blue rail (a link of GND)
Ered / blackemitter wires3×AA pack wires, through the two WAGO connectors, on the door. No wire to the ESP32.

Hole names (j19, j6…) assume the board's pins sit in columns a and i of the breadboard, USB end at row 1 (step 3). The resistor's leg 2 and the LED's long leg (+) share the same breadboard row. The red rail on the right is 3V3 only; the left red rail stays unused.

PinGoes toRole
5V4×AA pack + (the only thing that goes here)Power in (about 4.4–6.5 V; below that it misbehaves)
3V33V3 rail: IR receiver +, buzzer +Power out (3.3 V)
GNDGND rail: pack −, IR receiver −, buzzer −, LED, buttonGround
GPIO32IR receiver OUTInput with internal pull-up (LOW = beam broken). Wakes the board from deep sleep.
GPIO25Buzzer SOutput
GPIO26220 Ω → LEDOutput
GPIO27Button (other leg to GND)Input with internal pull-up. Wakes the board from deep sleep.

Build steps · Base build

  1. 1 Lay out your parts.

    Check: Every part in the list is on the table.

  2. 2 Check your board.

    Look at the little 3-legged chip with a big flat tab, next to the 5V pin. Read what is printed on it. If it says AMS1117 (the original board uses it), 4 alkaline cells are fine. If it is tiny, has 5 legs or has no marking, use 4 NiMH cells only (they give a lower voltage). Also read the labels printed on the board next to the pins: on clones the order can differ from this sheet, and your labels win.

    Step 2: check your board Top view of an ESP32 DevKitC, USB port at the left. Next to the 5V pin, near the USB end, sits a small black chip with three legs on one side and a big flat tab on the other: the regulator. A magnifier shows its marking, AMS1117. A second pointer shows the 5V pin and the label 5V printed on the board next to it. Below, two cases: AMS1117 means 4 alkaline or 4 NiMH cells are fine; a tiny chip with 5 legs, or no marking, means 4 NiMH cells only. Always follow the labels printed on your own board: pin order can differ on clones. 2×1USB5VGND272625323V3ESP32AMS11173.3regulator: read its marking5V pin + its printed labelAMS11174 alkaline or 4 NiMH cellsare fine!tiny, 5 legs or no marking4 NiMH cells only(lower voltage)Clones: pin order can differ. Always follow the labels printed on your board.

    Check: You know which chip regulates your board, and you have found the pins 5V, GND, 3V3, 25, 26, 27 and 32 by their printed labels.

  3. 3 Place the ESP32.

    Press the board across the middle gap, so its two rows of pins land in columns a and i, rows 1 to 19. USB port at row 1, antenna toward row 20. Leave rows 20–23 empty: that is where the antenna sits. Each pin on the j side now has a free hole next to it (column j). No cable yet.

    Step 3: place the ESP32 The ESP32 is pressed across the middle gap of the breadboard, its pins in columns a and i, rows 1 to 19, USB port at row 1, antenna toward row 20. The 5V pin lands in i1. Column j stays free: each pin on the j side has a free hole, highlighted. Rows 20 to 23 are hatched: the antenna zone, leave them empty. 3×1×1830+−5VCMD123j: freei: pins5V in i1 · USB at row 1rows 20–23: antenna zone, keep empty

    Check: The board sits flat, no pin is bent, and the pin 5V is in row 1, column i.

  4. 4 Rails.

    Wire the ESP32 pin 3V3 (hole j19) to the right red (+) rail and the pin GND (hole j6) to the right blue (−) rail. Then link the left blue rail to the right blue rail with one wire. The right red rail is now 3V3 only.

    Step 4: rails Three wires. Wire 1 red from the 3V3 pin (j19) to the right red rail, which becomes the 3V3 rail: 3V3 only. Wire 2 black from a GND pin (j6) to the right blue rail, the GND rail. Wire 15 black, near row 50, joins the left blue rail to the right blue rail, so both blue rails are GND. 4×3+−1215red rail: 3V3 only− GND rail− GND rail (left)

    Check: Red wire on the red rail, black wire on the blue rail, and nothing else touches the red rail yet.

  5. 5 Wire the receiver. · Ask for help

    Pack and USB both off. Receiver red wire to the 3V3 rail, black wire to the GND rail, white or yellow wire (OUT) to GPIO32 (hole j13). Not 5 V.

    Step 5: wire the receiver (ask for help) Pack and USB both off. The IR receiver has three wires. Wire 5 red goes into the 3V3 rail, wire 6 black into the GND rail, wire 7 white or yellow (OUT) into j13, the hole next to GPIO32. Nothing goes to 5 V. 5×1OFFIR+−567GPIO32 · j133V3 rail (+)GND rail (−)IR receiverOUT → GPIO32 only · not 5 V

    Check: Someone experienced (or you, twice) has checked that red is on 3V3 and OUT is on GPIO32 only.

  6. 6 Power the ESP32 from its pack. · Ask for help

    Put 4 cells in the 4×AA holder, matching the + / − marks. Switch it OFF. Label it “ESP32 4×AA”. Plug its black pin end into the right blue (−) rail and its red pin end into the hole next to the 5V pin (j1). Never into a red rail. Leave the switch OFF.

    Step 6: power the ESP32 from its pack (ask for help) The ESP32 4×AA pack sits behind the left end of the breadboard, switch OFF. Wire 3, its red pin end, goes into j1: the hole next to the 5V pin, in row 1. Wire 4, its black pin end, goes into the right blue rail. A red cross marks the red rail: the pack's red wire never goes there, it is 3V3 only. A magnifier shows j1 next to the 5V pin. 6×1OFF×4AA×1+++++−34never the red railESP32 4×AAswitch OFF5Vj1i1red → j1, next to 5V

    Check: Red goes to the 5V row, black to the blue rail, the switch is OFF, and someone experienced (or you, twice) has checked it.

  7. 7 Prepare the emitter's pack. · Ask for help

    Put 3 cells in the 3×AA holder, matching the marks. Switch it OFF and label it “EMITTER 3×AA”. Open the lever of a WAGO connector, push in the pack's red wire and the emitter's red wire (strip about 11 mm), close the lever. Same with a second WAGO for the two black wires. Give each wire a gentle tug: it must hold. Red to red, black to black. No wire goes to the ESP32.

    Step 7: prepare the emitter's pack (ask for help) The EMITTER 3×AA pack, switch OFF, labelled. Two WAGO lever connectors join it to the IR emitter. Left connector, lever open: the pack's red wire and the emitter's red wire, stripped about 11 millimetres, are pushed into its two entries, then the lever is closed. Right connector, lever closed: the two black wires, joined the same way. Give each wire a gentle tug. Red to red, black to black. No wire goes to the ESP32. 7×1OFF×3AA×2×1+++ONOFFEMITTER 3×AAIRIR emitterlever open: push inlever closed: tug teststrip about 11 mmEEswitch OFF · cells per the + marksRed with red, black with black · no wire to the ESP32

    Check: Red is joined to red, black to black, the switch is OFF, and nothing from the emitter touches the breadboard or the ESP32.

  8. 8 Upload the code.

    Both packs OFF. Install the board package, open the sketch, plug in the USB cable, choose “ESP32 Dev Module”, upload. Unplug the USB cable when it is done.

    Check: “Done uploading” appears.

  9. 9 Test the beam on the table.

    Emitter and receiver on the table, about 15 cm apart, facing each other. Switch the emitter's pack ON. Plug in the USB cable and open the Serial Monitor at 115200 baud (pack for the ESP32 stays OFF). The board starts in test mode, which lasts 90 seconds after power-on or reset: the monitor prints “clear” or “broken” each time the beam changes. Press EN (reset) to restart the 90 seconds whenever you need. You should see “clear”. Pass your hand between the modules.

    Check: The monitor says “broken” while your hand blocks the beam and “clear” otherwise.

  10. 10 Fix swapped words (only if needed).

    If the monitor shows “broken” when nothing blocks the beam, find const int BROKEN = LOW; in the code, change LOW to HIGH, upload again.

    Check: “clear” with nothing in the way, “broken” with your hand.

  11. 11 Add the buzzer.

    Everything OFF and unplugged. Buzzer S to GPIO25, + to the 3V3 rail, − to the GND rail (follow the labels on your module). Test it: at the end of the 90 s test mode (press EN to start it again) the buzzer gives one short chirp (0.2 s). That chirp is the buzzer test; you hear the real alarm in step 17. If the buzzer is silent at the chirp and sounds the rest of the time, your module works the other way round: change BUZZER_ON in the code.

    Step 11: add the buzzer Everything off and unplugged first. The buzzer module's three pins go into h39 (S), h40 (+) and h41 (−), following the labels on the module. Wire 8 orange goes from GPIO25 (j11) to j39, wire 9 red from the 3V3 rail to j40, wire 10 black from j41 to the GND rail. 11×1×3OFFIR+−8910S · h39+ · h40− · h41

    Check: The buzzer gives one short chirp at the end of test mode and is silent otherwise. A buzzer that sounds all the time would empty the batteries in a night.

  12. 12 Add the LED.

    GPIO26 → 220 Ω resistor → long leg (+) of the LED. Short leg to the GND rail.

    Step 12: add the LED The 220 ohm resistor lies flat from d26 to d30. The LED's long leg goes in b30, its short leg in b31. Wire 11 green joins GPIO26 (j10) to row 26 (b26), the R1 strip; wire 12 black joins d31 to the left GND rail, near row 34. A zoom shows the long leg is plus and the flat side marks the short leg. 12×1220 Ω×1×2OFFIR+−1112+−long leg = + · b30220 Ω · d26–d30

    Check: The long leg faces the resistor side.

  13. 13 Add the arm button.

    One leg to GPIO27, the opposite leg to the GND rail. No resistor needed: the code turns on the board's internal pull-up.

    Step 13: add the arm button The push button straddles the middle gap, legs in e44, f44, e46 and f46. Wire 13 blue joins GPIO27 (j9) to j44, on the same strip as leg A (f44); wire 14 black joins a46, on the strip of leg B (e46), diagonally opposite, to the left GND rail. A zoom shows the button from above with legs A and B on a diagonal. 13×16 mm×2OFFIR+−1314ABwired legs on a diagonalA = f44 · B = e46

    Check: The two wired legs are diagonal from each other (not on the same side).

  14. 14 Stick the emitter, its pack and the receiver on the door.

    Close the door. Stick the emitter and its 3×AA pack on the door leaf and the receiver on the frame or the wall next to it, at the same height, facing each other 15–20 cm apart (use the ruler), with both lenses clear of the door trim or moulding. Keep the pack's switch within reach. No wire may cross the gap of the door. Keep the beam out of direct sunlight. Do not press the tape down for good yet.

    Step 14: stick the emitter, its pack and the receiver on the door Seen from above, two moments. Door closed: the IR emitter and its EMITTER 3×AA pack are taped to the door leaf, near the handle side; the IR receiver is taped to the wall or frame next to it, 15 to 20 centimetres away, lenses facing and lined up. The beam is intact and the Serial Monitor shows clear. Door opens: the leaf swings on its hinge, the emitter moves away, the receiver loses the beam: the monitor shows broken and, if armed, the alarm goes off. Only the receiver is wired to the ESP32; no wire crosses the door gap. Keep the modules out of direct sunlight: it contains infrared and can cause false alarms. The same idea works for a cupboard, a drawer or a box lid. 14×15 mm×15 mm×1×1FROM ABOVEDoor closed: beam intactESP3215–20 cmdoor leafframe / wallDoor opens: beam lost → alarmESP32door leafframe / wallEMITTER 3×AAemitterreceiverhinge115200clearclear115200clearbrokensame height, tape bothKeep out of direct sunlight: it contains infrared and can cause false alarms.Same idea for a cupboard, a drawer or a box lid.

    Check: Both modules face each other at the same height, and the only wires on the door leaf are the emitter's, joined to its own pack.

  15. 15 Align it with the door closed.

    Switch the emitter's pack ON. Plug the ESP32 into USB (its pack stays OFF) and open the Serial Monitor. Test mode runs for 90 seconds, and the LED is lit while the beam is broken (press EN to restart the test). With the door closed you should see “clear”. Nudge the emitter or the receiver slightly in every direction: it should stay “clear” with a little room to spare. Then press the tape down.

    Step 15: align it with the door closed For the alignment the ESP32 runs from USB: a USB cable goes into its port at row 1, from the computer, and the Serial Monitor is open. The ESP32 4×AA pack stays connected but switched OFF: never pack ON and USB at the same time. The emitter's own pack, on the door, is switched ON. 15×1data×1++++IR+−34ESP32 4×AA: OFFUSB in → ESP32 pack OFFEMITTER 3×AA on the door: ON

    Check: “clear” stays steady with the door closed, even when you tap the door gently.

  16. 16 Test by opening the door.

    Press EN to restart the 90 s test mode. Open the door slowly, then close it. Do it three times.

    Check: “broken” appears when the door opens, “clear” returns when it is closed, every time.

  17. 17 Test like a spy.

    Unplug USB. Switch the ESP32's pack ON: the 90 s test mode runs, ends with a short chirp, then the LED blinks twice (disarmed). Press the button: the LED blinks once a second for 10 seconds, so you can leave and close the door behind you. Then one long flash: the alarm is armed. Open the door: the buzzer sounds. Press the button to silence it.

    Step 17: test like a spy Four moments, left to right. 1: USB unplugged, the ESP32 pack is switched ON: the LED blinks twice. 2: press the button: the LED blinks once a second for 10 seconds while you leave and close the door. 3: one long flash: the alarm is armed. 4: the door opens, seen from above: the receiver loses the beam and the buzzer sounds, the LED blinks fast. Press the button: the alarm stops and is disarmed, two short blinks. 17ON1pack ON2press: 10 s to leave3long flash: armedON10 s4door opens: alarmESP32LED fast + buzzer, 30 sPress the button: it stops, two short blinks = disarmed

    Check: The buzzer sounds when the door opens. Press the button: it stops and the alarm is disarmed (two short blinks).

What the LED tells you (deep sleep, in plain words)

What you seeWhat it means
Lit while the beam is broken (first 90 s)Test mode, after switching on or pressing EN. The LED shows what the receiver sees. A short chirp from the buzzer ends it.
Two short blinksBoard just switched on, or alarm disarmed. Nothing is watching.
One blink per second for 10 sArming. You have 10 seconds to leave and close the door. Press the button again to cancel.
One long flashArmed. The beam was clear and the alarm is watching.
One tiny flash every 30 sArmed and asleep. It woke up for a moment and went back to sleep.
Fast blinking for 2 s, and it stays disarmedThe beam is already broken when you press the button: check the emitter (switched on? aimed? door closed?).
One blink per second for up to 60 s, then fast blinking, and it stays disarmedThe door was still open at the end of the 10 s countdown. It waits up to 60 s for you to close it, then gives up.
Fast blinking and the buzzerAlarm! It rings for 30 seconds. Press the button to stop it at once.
One tiny flash every 5 sAfter an alarm, waiting for the door to close: the board checks every 5 s whether the beam is back.

Make it permanent

Soldering safety

  • Lead-free solder with a flux core (0.8 mm is easy to use).
  • Iron with a stand and a temperature setting, at 325–375 °C. Turn it down if the solder smokes.
  • Ventilation: open a window, or use a small fan with a filter that draws the smoke away from your face.
  • Safety glasses: clipped wire ends and solder can fly.
  • The iron lives in its stand whenever you are not using it. Never touch the tip or the metal shaft. Work on a heat-proof mat. Unplug the iron when you stop. A burn: cool running water for at least 10 minutes.
  • Hold the board with a clamp (“helping hands”), not your fingers.
  • Nothing powered while you solder: batteries out of the holder, ESP32 unplugged from its sockets, USB unplugged.
  • Wash your hands afterwards, and keep food away from the bench.
  • Ask someone who has soldered before to watch your first five joints.

Parts for the permanent version

  • ×1 Breadboard-pattern perfboard, full sizeFull-size, same rows, 5-hole strips and rails as the breadboard (Adafruit Perma-Proto Full-sized 1606 type: 157 × 51 mm, 3 mounting holes). Full size, not half, so the layout copies 1:1.
  • 2 strips: 1×40 + 1×20 Female header, 2.54 mmSingle row, 2.54 mm pitch, long pins. The 1×40 gives the two 19-socket rows for the ESP32, the 1×20 gives the 3-socket row for the buzzer (H3). Cut with a flush cutter; you lose one socket at each cut.
  • 1 × 2-pole, 1 × 3-pole Screw terminals, 5.0 / 5.08 mm pitchPCB-mount, wire entry facing out (KF301 / DG301 type).
  • 1 set Solid hook-up wire, 22 AWG, several coloursInsulated, red, black, yellow, orange, green, blue.
  • 1 reel Lead-free solder, flux core0.8 mm, for example Sn99.3/Cu0.7 or SAC305.
  • 6 flat-head M3 × 10, 3 pan-head M3 × 6–8 M3 screwsFlat-head (countersunk): 4 for the lid, 2 for the battery hatch. Pan-head: 3 to hold the board on its printed standoffs (M2.5 also works).

Tools for the permanent version

  • Soldering iron with stand and temperature control
  • Multimeter
  • Safety glasses
  • Helping-hands clamp or board holder
  • Flush cutter and wire stripper
  • Small fan with a filter (or an open window) (optional)
Mission 01, soldered version: perfboard layout Top view of a full-size breadboard-pattern perfboard, 157 by 51 millimetres, row 1 at the USB edge on the left, right rails at the top. Two 19-socket female headers, H1 in a1 to a19 and H2 in i1 to i19, take the ESP32, which plugs in and stays removable; its outline is dashed. J1, a 2-pole screw terminal for the ESP32 4×AA pack, plus at h25 and minus at h27. J2, a 3-pole screw terminal for the IR receiver, plus at h31, minus at h33, OUT at h35. Their openings face the right edge. H3, a 3-socket female header for the buzzer module, S at h39, plus at h40, minus at h41. R1, 220 ohms, lies flat from d26 to d30. D1, the LED, long leg in b30, short leg in b31. SW1, the button, straddles the middle gap in e44, f44, e46 and f46. Fifteen insulated wires on the top side: W1 red f1 to f25; W2 black j27 to the right minus rail; W3 red j19 to the right plus rail; W4 black j6 to the right minus rail; W5 red j31 to the plus rail; W6 black j33 to the minus rail; W7 yellow g13 to f35; W8 orange h11 to f39; W9 red j40 to the plus rail; W10 black j41 to the minus rail; W11 green g10 to row 26 (b26), the R1 strip; W12 black d31 to the left minus rail near row 34; W13 blue f9 to h44; W14 black a46 to the left minus rail; W15 black links the left minus rail to the right minus rail at row 52. Keep-outs, dashed: rows 20 to 23 for the antenna, and a 6 millimetre circle around each of the three mounting holes in the middle gap. FIG. 3 — PERFBOARD LAYOUT, TOP VIEW (SOLDERED VERSION)++−−−−++jihgfedcba1102030405060W1W2W3W4W5W6W7W8W9W10W11W12W13W14W15H2H1J1J2H3R1D1SW1antenna: rows 20–23 freeDashed outline: the ESP32 plugs into H1/H2, USB at the row-1 edge.Orange dashed circles: 6 mm keep-out around each mounting hole. Rows 20–23: antenna, keep free.Parts and wires on the top side, joints soldered from below. Solder all wires before plugging in the ESP32.PartsH1, H22 × female header 1×19a1–a19 · i1–i19J12-pole screw terminal, ESP32 4×AA+ h25 · − h27J23-pole screw terminal, receiver+ h31 · − h33 · OUT h35H3female header 1×3, buzzerS h39 · + h40 · − h41R1220 Ω, flatd26 → d30D15 mm LED, flat on the board+ b30 · − b31SW16 mm buttone44 f44 e46 f46Wires (22 AWG solid, insulated)W1f1 → f255V pin → J1 +W2j27 → − railJ1 − → GNDW3j19 → + rail3V3 railW4j6 → − railGND railW5j31 → + railreceiver +W6j33 → − railreceiver −W7g13 → f35GPIO32 → receiver OUTW8h11 → f39GPIO25 → buzzer SW9j40 → + railbuzzer +W10j41 → − railbuzzer −W11g10 → b26GPIO26 → row 26 (b26), R1 stripW12d31 → left − railLED −W13f9 → h44GPIO27 → button (f44)W14a46 → left − railbutton (e46) → GNDW15left − rail → right − railGND link, row 52Rails: + at the top = 3V3 only. The 5V line (W1, J1 +)must never touch it: check with the multimeter.Board: Perma-Proto full-size type, 157 × 51 mm. Mounting-holepositions derived from the datasheet: measure your board.

Row 1 is at the USB edge of the perfboard. Rows run along the long side. Columns a–e and f–j are on either side of the middle gap, like the breadboard. Solder from the underside; the parts sit on the top.

Soldering steps

  1. P1 Set up a safe bench. · Ask for help

    Read the soldering safety list. Window open or fan on, glasses on, iron in its stand on a heat-proof mat, board in the clamp. Ask someone who has soldered before to be there for your first five joints.

    Check: Someone experienced is with you, and the iron is hot only when you need it.

  2. P2 Fit the ESP32 sockets.

    Plug the two 1×19 female headers onto the pins of the ESP32 (this keeps them lined up). Drop the board and headers onto the perfboard: one header in column a, rows 1–19, the other in column i, rows 1–19, with the USB end at row 1. Turn the whole thing over and solder one pin at each end of each header. Check it sits flat and straight, then solder the remaining pins. Pull the ESP32 out and put it aside.

    Permanent P2: fit the ESP32 sockets Two panels. Left, seen from the side: the two 1×19 female headers are plugged onto the ESP32's pins and the whole thing sits on the perfboard, headers in columns a and i, USB at the row-1 edge; a strip of tape holds it in place, then an arrow shows the board being turned over. Right, the perfboard seen from below: 38 pins poke through in two rows, and each one gets a small shiny cone of solder. Solder one pin at each end of each header first, check it is flat and straight, then the rest. A good joint is a small cone; a ball of solder is a bad joint. P2×21×19×1×1×1USBtape holds itESP32 + headers on the board, USB at row 1turn it overSEEN FROM BELOWaifirst: one pin at each endUSB end = row 1small coneball: redoNothing powered while soldering

    Check: The sockets stand straight, and each pin is a small shiny cone of solder, not a blob.

  3. P3 Solder the terminals and the buzzer socket.

    J1 (2-pole): + at h25, − at h27. J2 (3-pole, for the receiver): + at h31, − at h33, OUT at h35. All openings face the right edge. H3 (1×3 female header, for the buzzer): h39 = S, h40 = +, h41 = − (match the order printed on your module).

    Permanent P3: solder the terminals and the buzzer socket Top view of the perfboard, rows 21 to 45. Highlighted: J1, the 2-pole screw terminal, plus at h25, minus at h27; J2, the 3-pole screw terminal, plus at h31, minus at h33, OUT at h35; H3, the 1×3 female header, S at h39, plus at h40, minus at h41. The terminal openings face the right edge, toward the rails. P3×22 · 3×11×3×1++−−−−++jihgfedcba1102030405060+ h25− h27+ h31− h33OUT h35S h39+ h40− h41J1J2H3Openings face the right edge (the rails)Each part sits flat. Solder from below.

    Check: Each terminal sits flat on the board with its openings facing the right edge.

  4. P4 Solder the resistor, the LED and the button.

    R1 (220 Ω), lying flat: from d26 to d30. D1 (LED): long leg (+) in b30, short leg (−) in b31. Leave a30, a31, c30 and c31 empty. SW1 (button): straddling the middle gap, legs in e44, f44, e46, f46. Clip the extra leg length after soldering.

    Permanent P4: solder the resistor, the LED and the button Top view of the perfboard, rows 23 to 49. Highlighted: R1, 220 ohms, lying flat from d26 to d30; D1, the LED, long leg (plus) in b30, short leg (minus) in b31, flat side toward b31, pushed flat on the board; W12 later leaves from d31; SW1, the button, straddling the middle gap with legs in e44, f44, e46 and f46. Clip the extra leg length after soldering. P4×1220 Ω×15 mm×16 mm×1++−−−−++jihgfedcba1102030405060d26d30+ b30− b31d31f44f46e44e46R1D1SW1LED: long leg (+) in b30, flat on the board · button flatClip the extra legs after soldering (glasses on).Keep the dashed circle around the mounting hole free.

    Check: The LED's long leg is in b30, and the button sits flat.

  5. P5 Solder the power wires (W1 to W4).

    Insulated 22 AWG wire, flat on the top, soldered from the underside. W1 red: f1 → f25 (the 5V pin to J1 +). W2 black: j27 → right − rail (J1 − to GND). W3 red: j19 → right + rail (3V3 rail). W4 black: j6 → right − rail (GND rail). Wires may cross over each other: they are insulated.

    Permanent P5: solder the power wires (W1 to W4) Top view of the perfboard, rows 1 to 30. Highlighted wires: W1 red from f1 to f25, the 5V pin to J1 plus, running in the middle gap away from the mounting hole; W2 black from j27 to the right minus rail; W3 red from j19 to the right plus rail, the 3V3 rail; W4 black from j6 to the right minus rail. W1 stays far from the plus rail. P5×422 AWG×1++−−−−++jihgfedcba1102030405060W1W2W3W4W1 (5V) goes to J1 + only, never near the + railInsulated wire, flat on top, soldered from below.

    Check: W1 goes to J1 + and nowhere near the + rail.

  6. P6 Solder the receiver wires (W5 to W7).

    W5 red: j31 → right + rail. W6 black: j33 → right − rail. W7 yellow: g13 → f35 (GPIO32 to receiver OUT).

    Permanent P6: solder the receiver wires (W5 to W7) Top view of the perfboard, rows 10 to 40. Highlighted wires: W5 red from j31 to the right plus rail; W6 black from j33 to the right minus rail; W7 yellow from g13, the GPIO32 row, to f35, the OUT terminal of J2, running between rows g and f. P6×322 AWG++−−−−++jihgfedcba1102030405060W5W6W7W7: g13 (GPIO32) → f35 (J2 OUT)

    Check: Three wires, three colours, each in the holes listed.

  7. P7 Solder the buzzer wires (W8 to W10).

    W8 orange: h11 → f39 (GPIO25 to buzzer S). W9 red: j40 → right + rail. W10 black: j41 → right − rail.

    Permanent P7: solder the buzzer wires (W8 to W10) Top view of the perfboard, rows 8 to 44. Highlighted wires: W8 orange from h11, the GPIO25 row, to f39, the S socket strip of H3, running between rows d and c; W9 red from j40 to the right plus rail; W10 black from j41 to the right minus rail. P7×322 AWG++−−−−++jihgfedcba1102030405060W8W9W10S has its own wire; + and − go to the rails

    Check: S has its own wire; + and − go to the rails.

  8. P8 Solder the LED and button wires (W11 to W15).

    W11 green: g10 → b26 (GPIO26 to row 26, the R1 strip). W12 black: d31 → left − rail, around row 34 (LED −). W13 blue: f9 → h44 (GPIO27 to the button, diagonal leg f44). W14 black: a46 → left − rail (button's other diagonal leg e46). W15 black: left − rail → right − rail, around row 52.

    Permanent P8: solder the LED and button wires (W11 to W15) Top view of the whole perfboard. Highlighted wires: W11 green from g10, the GPIO26 row, to row 26 (b26), the R1 strip; W12 black from d31 to the left minus rail near row 34, angled away from the LED; W13 blue from f9, the GPIO27 row, to h44, the strip of the button leg f44; W14 black from a46, the strip of the button leg e46, to the left minus rail; W15 black links the left minus rail to the right minus rail at row 52. All fifteen wires are now in; the dashed keep-outs stay free. P8×522 AWG++−−−−++jihgfedcba1102030405060W11W12W13W14W15All 15 wires in · dashed circles and rows 20–23 free

    Check: All 15 wires are in. Keep a 6 mm circle around each mounting hole free of wires and parts, and rows 20–23 free.

  9. P9 Look at the underside.

    In good light, look for a blob of solder that joins two strips, or a strip and a rail. Remove any blob with the iron (and desoldering braid if you have it).

    Check: No bridge between neighbouring joints.

  10. P10 Multimeter checks, packs OFF and ESP32 not plugged in. · Ask for help

    Continuity (beep) mode. Must NOT beep: right + rail to right − rail; socket i1 (5V) to the + rail; socket i1 to the − rail; neighbouring sockets i1 to i19 with each other (only i6 may beep to GND parts). Must beep: J1 + to socket i1; J1 − to socket i6 and to a19; socket i19 to the + rail; i13 to J2 OUT; i11 to H3 S; i10 to R1 (row 26). The button: socket i9 to the − rail beeps only while pressed (if it beeps all the time, look for a solder bridge on rows 44–46). LED: diode test, red probe on row 30, black on the − rail: it glows faintly, and a red LED reads about 1.6–2.0 V (blue or white 2.6–3.2 V, or OL).

    Permanent P10: multimeter checks before power-on (ask for help) Packs OFF, ESP32 not plugged in. Left: the multimeter in continuity (beep) mode, red probe in socket i1, the 5V socket, black probe on the right plus rail: it must NOT beep. Right, the key test: pack switched ON, ESP32 still unplugged, the multimeter on DC volts between the plus rail and the minus rail must read 0 volts. If it shows the pack voltage, STOP: the 5V line touches the 3V3 rail and would destroy the ESP32. P10×1++−−−−++jihgfedcba1102030405060i1 (5V)- - -))NO BEEPi1 (5V) ↔ + rail+ rail ↔ − rail: no beep tooKey testPack ON · ESP32 still unplugged0.00V+ rail ↔ − rail0 V= correctPack voltage? STOP.5V touches the 3V3 rail:it would destroy the ESP32.Switch OFF, find the bridge, fix it.

    Check: Every “no beep” is silent and every “beep” beeps.

  11. P11 Check the packs, then the key test. · Ask for help

    Put the cells in the ESP32 holder, switch ON and read the DC voltage on its wires: +5.6 to +6.5 V (alkaline) or +5.0 to +5.6 V (NiMH). A minus sign means the wires are swapped. Switch OFF and screw the wires into J1 (red = +). Now the key test, with the ESP32 still unplugged: switch the pack ON, then measure the socket i1 to GND: you read the pack voltage. Measure the + rail to GND: it must read 0 V.

    Check: The + rail reads 0 V. If it shows the pack voltage: STOP. The 5V line touches the 3V3 rail, and it would destroy the ESP32. Switch OFF, find the bridge, fix it.

  12. P12 Plug in the ESP32.

    Pack OFF. Plug the ESP32 into its sockets, USB end at row 1, pin 5V in socket i1. Switch the pack ON: the red power LED on the board lights, and the + rail reads 3.2–3.4 V. Check the emitter pack too: 4.0–4.8 V, before you join it to the emitter.

    Check: Power LED on, 3V3 rail at about 3.3 V.

  13. P13 Run the tests again.

    Repeat steps 9 to 17 of the base build (beam, buzzer, LED, button, door) on your soldered board.

    Check: It behaves exactly like the breadboard version.

  14. P14 Put it in the box.

    Print the perfboard box, its lid, the battery hatch, the long button pusher and the emitter holder (files: see “3D files” below). Settings in Bambu Studio: Bambu Lab X1 Carbon 0.4 mm nozzle, Bambu PLA Basic, 0.20 mm Standard, 4 walls, 15 % gyroid, supports off, no brim; each file opens as one plate. Estimated time: about 9 hours in all (box 5 h 20, lid 1 h 40, emitter holder 1 h 05, hatch 40 min, pusher 8 min), from another slicer; the parts are not test-printed yet. The board sits on 3 printed standoffs (3 pan-head screws), the lid takes 4 flat-head M3 × 10 screws, and the battery hatch 2 more, so you change the cells without opening the lid. The 4×AA pack lies in its own bay with its switch reachable through a window in the hatch (measure your holder first: sizes vary by a few mm). The box also has a slot for the micro-USB port, with “PACK OFF” embossed next to it (pack OFF first), a window and light tube for the LED, the long pusher over SW1, sound holes for the buzzer, and a cable exit for the receiver wires. It is not airtight: leave the vent slots open. The emitter goes in its own printed holder on the door: it snaps in, and the 3×AA pack sits in a cradle held by a hook-and-loop strap (20 mm wide, about 25 cm). If you stay on the breadboard, a box exists for the 830 board too.

    Permanent P15: put it in the box Exploded view of the 3D-printed box, seen from above at an angle, parts lifted off in assembly order. Bottom: the box, with the electronics bay in front and the battery bay behind it at the USB end; three conical standoffs on its floor, a U-shaped USB slot in the end wall with PACK OFF embossed next to it, vent slots in the battery bay wall. Above it: the soldered perfboard, ESP32 plugged into its sockets with the USB port toward the end wall, held by three M3 screws on the standoffs. Behind: the switched 4×AA pack, labelled ESP32 4×AA, lid up, switch at the USB end; its red and black leads pass through a notch in the divider into the J1 screw terminal. Above the pack: the battery hatch with a window over the pack switch and vent slots, two screws. Top: the lid with the LED window over the LED, sound holes over the buzzer and the long pusher dropping into its guide tube over the button; four screws. The box is not airtight: keep the vent slots open. The emitter and its 3×AA pack stay on the door, outside this box. P15×9M3×14×AA×1ESP32 4×AAlid: 4 screwslong pusher → buttonLED windowsound holeshatch: switch window, 2 screwspack: switch at the USB endleads → J1 (notch)board: 3 M3 screws on the standoffsUSB slot · PACK OFF firstvents: keep openNot airtight: never cover the vents

    Check: The pack's switch (through the hatch window), the button and the USB port are reachable, and the vent slots are open.

3D files

PartPrinted sizePrint time · filamentFiles
Breadboard box (solder-free 830-point version)216 × 130 × 32 mm~4 h 25 · ~123 gtm01_box_breadboard (.3mf, .stl)
Lid of the breadboard box216 × 60 mm~1 h 15 · ~35 gtm01_lid_breadboard (.3mf, .stl)
Button pusher (breadboard box)Ø6 × 4.7 mm2 mintm01_pusher_breadboard (.3mf, .stl)
Perfboard box (permanent version)188 × 144 × 38 mm5 h 20 · 144 gtm01_box_perfboard (.3mf, .stl)
Lid of the perfboard box188 × 75 mm1 h 40 · 38 gtm01_lid_perfboard (.3mf, .stl)
Long button pusher (perfboard box)Ø4 × 27.9 mm8 min (×2)tm01_pusher_perfboard (.3mf, .stl)
Battery hatch (both boxes)86 × 69 × 2 mm37 min · 12 gtm01_hatch (.3mf, .stl)
Emitter holder for the door119 × 55 × 18.6 mm1 h 05 · 25 gtm01_emitter (.3mf, .stl)

Bambu Studio settings: Bambu Lab X1 Carbon 0.4 nozzle · Bambu PLA Basic · 0.20 mm Standard · 4 walls · 15 % gyroid infill · supports off · no brim. Print each part in the orientation of the file. Two colours: if the text loads merged into the part, right-click it, Split, To parts, and give the text part filament 2.

Measure first: Before printing, measure your own parts with a ruler or calipers: both battery holders (size and where the switch is), the breadboard or perfboard, the USB plug and the buzzer. Listings vary by a few millimetres. If one is different, change its size in the OpenSCAD file, or print a small test corner first. Too tight: clearance 0.4 mm; too loose: 0.2 mm.

My notes

Regulator chip says: AMS1117 / other

Words on my module (“clear” / “broken”)

BROKEN = LOW or HIGH; BUZZER_ON = HIGH or LOW

Emitter to receiver distance (cm)

Date I put in new batteries