What it is
Playground Sentinel is a playful perimeter alarm for a garden or a kid’s room. A tiny ATtiny202 monitors a PIR sensor and, when triggered, wakes a 433 MHz OOK transmitter to send a short burst. A matching receiver counts signal edges in a 10 ms window and lights LEDs for the detected alarm bins.
Hardware at a glance
Transmitter
- ATtiny202 @ 20 MHz (internal oscillator, prescaler disabled).
- SEN-HC-SR501 PIR on PA4 (output pulled low internally).
- FS1000A DATA on PA1, supply from the battery rail.
- PA2 LED mirrors each RF burst.
Receiver
- ATtiny202 + XY-MK-5V ASK module feeding PA1.
- PA2 and PA3 drive LEDs for the active bands.
- Other bands are defined for future use.
Power
- Runs directly from a 3×AA/AAA rail.
- Idle current in µA range.
- linear regulators for components included.
Signaling
Every 500 ms the transmitter emits a 10 ms burst of a square wave. The carrier frequency encodes the alarm ID. The receiver starts a 10 ms window on the first edge, counts transitions, and compares the total to per-alarm ranges.
| Carrier | Edges in 10 ms (ideal) | Notes |
|---|---|---|
| 1 kHz | 20 | Reserved (future) |
| 2 kHz | 40 | Alarm 2 (PA2) |
| 3 kHz | 60 | Alarm 3 (PA3) |
| 4 kHz | 80 | Reserved (future) |
| 5–10 kHz | 100–200 | Reserved; practical ceiling near 10 kHz |
Firmware architecture
Transmitter
- TCA0 in single-slope mode with /16 prescaler.
CARRIER_FREQ_HZ(default 3000) defines burst frequency.send_burst()aligns to TCA overflow and emits an exact-cycle 10 ms burst.- PA2 LED mirrors burst activity.
Receiver
- PORTA interrupt on PA1 (both edges) counts transitions.
- First edge arms a 10 ms window; counts accumulate until timeout.
- Counts are compared to per-band ranges; matching bands latch LEDs for 200 ms.
- Higher bands (beyond PA2/PA3) are defined but currently unused.
Build & flash
sudo apt install gcc-avr avr-libc avrdude # once
./build.sh # builds receiver + transmitter
./flash.sh transmitter # flash build/transmitter/transmitter.hex
./flash.sh receiver # flash build/receiver/receiver.hex
flash.sh requires you to name the image explicitly to avoid accidentally flashing the wrong device.
Default port is /dev/ttyUSB0; override via AVR_PORT=/dev/ttyUSB1 ./flash.sh transmitter.
Repository layout
firmware/receiver,firmware/transmitter— C firmware for each ATtiny202.build.sh,Makefile,flash.sh— helper scripts to build and flash.pcb/PlaygroundSentinel_sender,pcb/PlaygroundSentinel_receiver— KiCad designs.datasheet/— PDFs and notes for ATtiny202, PIR, XY-MK, etc.case/— mechanical and enclosure assets.
Extending the system
- Add more alarm IDs by defining additional frequency bins and matching thresholds.
- Replace the fixed 500 ms cadence with PIR-triggered bursts once enclosure wiring is set.
- Consider envelope modulation (e.g., double bursts) if more coding gain is needed without raising carrier frequency.