--- title: Built an RF fingerprint door lock date: 2025-06-05 layout: post project: true thumbnail: thumb_sm.jpeg --- Wanted to unlock the door with fingerprint, wirelessly to avoid drilling. 2024-11: Started with basic 433MHz RF modules and two Arduinos. Connected data lines of the transceivers to UART RXD/TXDs of the MCUs. Unreliable—constant packet loss. 2025-01: Switched to RFM69 modules. Complete ball-ache to program. Followed the datasheet as well as I could, audited the code multiple times, cross-checked with RadioHead and RFM69 drivers. No luck. The ATmega328P runs at 5V and the RFM69 at 3.3V. Suspect logic-level converter (LLC) issues. Not enough swing? 2025-04: Ditched the RFM69s. Switched to NRF24L01+ modules. Data pins 5V tolerant, no LLC required. Spent six weekends writing a clean-room driver. Finally some success. Implemented a simple XOR cipher for the RF channel—good enough for my threat model. The Key is cycled to resist replay attacks: ``` static inline void keygen(char *buf, uint8_t n) { int i, imax; uint8_t sreg; uint16_t seed; sreg = SREG; cli(); seed = TCNT1; SREG = sreg; for (i = 0, imax = n - 1; i < imax; i++, seed++) buf[i] = tab[(seed % tablen)]; buf[imax] = '\0'; } ``` Protocol: FPM sends SYN. Servo responds with a session key. Both xor-ed with a static key. Session key is used thereafter. Command set is kept private—serves as an authentication layer for the endpoints. 2025-05: Wrote drivers for R503 and FPM10A sensors. UART RX sequence was tricky—adopted the Adafruit C++ implementation to C. Chose the R503 for the lock due to its built-in LEDs and better form factor. 2025-06: Two PCBs for FPM (front) and servo (back) controllers.
Footprint (front) |
PCB (front) |
Footprint (back) |
PCB (back) |