This is an old revision of the document!


Walkie Talkie With Print Verification

Introduction

The Walkie Talkie With Print Verification project is a fully digital, hardware-secured wireless communication terminal. Unlike a classic radio station, the device allows real-time voice capture, P2P transmission, and playback only if the user passes a biometric authentication filter. The system integrates a permission-based access hierarchy (Admin vs. User) and is controlled by an ESP32 microcontroller.

What is its purpose: The main goal is to build a robust physical product, a sort of industrial prototype, capable of combining modern access control technologies (fingerprint sensor) with high-fidelity digital audio processing. At a technical level, the project demonstrates mastery of microcontroller architectures through the simultaneous integration of several studied complex protocols (UART, I2C, I2S) and the efficient use of hardware interrupts for the system's state machine.

What was the starting idea: The idea stemmed from the main vulnerability of conventional analog radio stations: lack of security. Anyone owning a station on the same frequency can listen or transmit. I thought about how I could implement a fundamental principle of cybersecurity (*Access Control* based on “Something you are”) directly into the physical environment, transforming a simple communication station into a strictly restricted data terminal.

General Design

To illustrate the architecture of the Walkie-Talkie with Print Verification, I have created a block diagram highlighting the hardware components and the data flow (communication protocols) between the peripherals and the central processing unit.

User Roles & Access Control

The Walkie-Talkie supports two types of users: Admin and General User.

  • The Admin fingerprint is permanently stored and cannot be modified or overwritten.
  • Only the Admin has the authority to enroll or remove a General User's fingerprint.
  • Add User: The Admin authenticates by scanning their fingerprint, presses the action button briefly, and then the new user introduces their fingerprint.
  • Remove User: The Admin authenticates and long-presses the action button for 5 seconds to wipe the General User from the database.

Usage & Communication Flow

The OLED screen acts as the main interface, displaying the current communication status. During an incoming wireless transmission, an 'Incoming Transmission' message is shown on the screen.

If the device is unlocked (a user is logged in), the incoming audio is actively played through the speaker. Once authenticated, the user can receive and transmit freely for a 2-minute session before the system automatically times out, locks itself, and requires re-authentication.

The reset button must be held for 5 seconds to perform a full reset of the system. The user data is lost upon resetting.

Hardware Design

Component Quantity Description Interface
ESP32 DevKit V1 2 Main Microcontroller (WROOM-32) -
AS608 Sensor 2 Optical Biometric Fingerprint Sensor UART
INMP441 Mic 2 Digital Omnidirectional Microphone I2S0
MAX98357A Amp 2 I2S DAC + Class D Audio Amplifier I2S1
SSD1306 OLED 2 0.96” Monochrome Display (128×64) I2C
Mini Speaker 2 20x30mm Rectangular Speaker (1W) Analog
Tactile Buttons 6 PTT, Admin Mode, Reset GPIO
Battery Holder 2 4 x AA (for 4.8V NiMH Rechargeable) Power

System Architecture & Power Management: The hardware architecture centers on the ESP32, managing biometric security via UART and real-time audio through concurrent I2S buses. A critical design decision was made to ensure portability and prevent brownout resets during high-current audio playback.

The system is powered by a 4-cell AA battery holder utilizing NiMH rechargeable batteries (providing a stable ~4.8V). This power source is connected directly to the ESP32's VIN pin and the MAX98357A amplifier. This maximizes the audio output volume (staying safely below the amplifier's 5.5V absolute maximum rating) while allowing the ESP32's internal 3.3V regulator to safely power the logic-level peripherals (OLED, Mic, Fingerprint Sensor) without being overloaded by audio transients.

Detailed Pin Mapping & Motivation:

Component Peripheral Pin ESP32 Pin Signal Type Design Motivation
Power Supply Plus (+) Bat. VIN Power (4.8V) System power. Feeds Amp directly and ESP32 regulator.
Minus (-) Bat. GND Ground Common reference ground.
Fingerprint (AS608) Pin 3 (Green) 3V3 Power (3.3V) Safe operating voltage for the sensor.
Pin 4 (Yellow) D16 (RX2) UART TX Dedicated hardware UART2 for reliable biometric data.
Pin 5 (Black) D17 (TX2) UART RX Dedicated hardware UART2.
Microphone (INMP441) VDD 3V3 Power (3.3V) Native digital power.
L/R GND Config Tied to GND to configure transmission on the Left Channel (Mono).
WS D25 I2S Clock Allocated to standard output-capable pins for I2S0 Master mode.
SCK D32 I2S BClock
SD D33 I2S Data
Amplifier (MAX98357A) VIN VIN Power (4.8V) Powered directly from batteries to prevent ESP32 brownouts.
LRC / WS D14 I2S Clock Allocated to the secondary I2S1 bus for independent audio output streaming.
BCLK D26 I2S BClock
DIN D27 I2S Data
OLED (SSD1306) VCC 3V3 Power (3.3V) Standard logic power.
SDA D21 I2C Data Native hardware I2C pins for maximum compatibility with the Wire library.
SCL D22 I2C Clock

Software Design

Software-ul proiectului este construit in jurul unei arhitecturi robuste de tip Finite State Machine (FSM), facand uz de capabilitatile FreeRTOS pentru multitasking si procesare asincrona a intreruperilor. Codul integreaza direct functionalitati avansate de gestiune a timpului (Timere), intreruperi hardware (ISR) si magistrale multiple (I2C, I2S, UART).

Biblioteci Utilizate

* esp_now.h: Aleasa in detrimentul Wi-Fi-ului clasic sau Bluetooth pentru a elimina dependenta de un router si pentru a asigura o latenta ultra-scazuta, esentiala in transmisiile de voce (Voice-over-Radio). * driver/i2s_std.h (ESP32 IDF): Utilizata pentru controlul direct al magistralei I2S. Spre deosebire de un ADC/DAC analogic, I2S permite citirea pur digitala a microfonului (INMP441) si comanda digitala a amplificatorului (MAX98357A), asigurand o calitate audio net superioara si lipsita de interferente. * Adafruit_Fingerprint.h: Aleasa pentru abstractizarea eficienta a comunicarii UART cu senzorul AS608, simplificand enorm operatiunile matematice complexe de stocare si comparare a matricilor biometrice. * freertos/queue.h: Vitala pentru decoupling. Permite separarea procesului de receptie radio (ISR) de cel de redare audio, folosind o coada de asteptare in memorie pentru a garanta redarea continua a vocii fara a se bloca atunci cand procesorul este ocupat cu alte operatiuni.

Masina de Stari (FSM) si Logica de Executie

Scheletul aplicatiei ruleaza prin tranzitii intre 4 stari clare:

* STATE_LOCKED: Sistemul este complet izolat (Zero-Trust hardware). Nu primeste si nu transmite date. Doar validarea biometrica a unui utilizator inregistrat deblocheaza aparatul. * STATE_WAIT_ADMIN: Stare intermediara apelata prin butonul Admin. Asteapta validarea exclusiva a amprentei cu ID-ul 1. * STATE_ADMIN_MENU: Meniul de gestiune. Permite operatiuni de inrolare (apasare scurta > 50ms) a unui nou user prin rutina software in 3 pasi (Citire → Ridicare deget → Confirmare) sau stergerea acestuia (apasare lunga > 3000ms). Dispune de timeout automat de 5 minute pentru a preveni lasarea sistemului vulnerabil. * STATE_LIVE_STREAM: Modul de comunicare “Walkie-Talkie”. Prin actionarea butonului PTT (configurat ca INPUT_PULLUP), statia comuta instantaneu intre regimul de Receptor si cel de Emitator (Half-Duplex).

Calibrarea Fluxului Audio si ESP-NOW

O provocare tehnica majora a fost limitarea protocolului hardware ESP-NOW, care suporta strict 250 bytes per payload. Calibrarea sistemului s-a realizat prin citirea fluxului de pe microfon (care nativ este pe 32-bit) si decuparea/impachetarea intr-un buffer de exact 120 de mostre de 16-bit. Rezultatul este un pachet de exact 240 bytes, care maximizeaza latimea de banda audio disponibila fara a atinge plafonul ce ar genera pierderi de pachete (packet loss) in retea.

Pachetele receptionate sunt captate printr-o rutina de intrerupere (OnDataRecv) declansata asincron de hardware, folosind comanda xQueueSendFromISR pentru a plasa datele in siguranta in buffer-ul de redare.

Optimizari Critice de Sistem

* Unde: Pe magistrala I2C (Display OLED). * Cum: Comanda display.display() a fost restrictionata exclusiv la momentele in care aparatul schimba starea (ex: tranzitia din TX in RX). * De ce: I2C este o magistrala prea lenta comparativ cu frecventa pachetelor radio (zeci pe secunda). O actualizare per pachet ar fi dus la fenomenul de “CPU starvation”, fragmentand grav cursivitatea redarii audio.

* Unde: Feedback Loop Audio (Anulare Sidetone). * Cum: Redarea locala a microfonului in propriul difuzor a fost suprimata din cod in timpul emisiei. * De ce: Proximitatea fizica dintre componentele INMP441 si MAX98357A din interiorul carcasei genera instantaneu microfonie si distorsiuni acustice.

* Unde: Gestionarea zgomotului de fond (Difuzor I2S). * Cum: In absenta unui semnal radio valid in coada FreeRTOS, sistemul injecteaza constant un array de zerouri in amplificator. * De ce: Aceasta metoda hardware elimina complet “fasaitul” electrostatic si zgomotul alb in starea de stand-by, mentinand o “liniste digitala” absoluta pana la urmatoarea transmisie.

Software Design

The software is built on a multi-tasking architecture using the FreeRTOS kernel available on the ESP32. This allows us to separate time-critical tasks (audio streaming) from low-priority tasks (UI updates).

Execution Logic & State Machine

The system operates based on a Finite State Machine (FSM) with the following states:

  • ST_LOCKED: Default state. The I2S output is muted. The system polls the AS608 sensor via UART.
  • ST_UNLOCKED: Reached after a valid fingerprint match. A timer is started (2 minutes).
  • ST_TRANSMIT: Triggered by the PTT button (GPIO Interrupt). Audio is sampled via I2S and sent through ESP-NOW.
  • ST_ADMIN: Triggered when the Admin ID is recognized. Enables 'Enroll' and 'Delete' functions via the Action Button.

Logic Flow for Admin Actions

To avoid needing 6 buttons, we use temporal multiplexing for the Action Button:

  • Short Press (< 2s): If in ST_ADMIN, it triggers the `fingerprintEnroll()` function to add the General User.
  • Long Press (> 5s): If in ST_ADMIN, it triggers `fingerprintDelete(USER_ID)` to wipe the database.

Task Distribution (Dual-Core)

To ensure “zero-latency” audio, the software is split between the two cores of the ESP32:

  • Core 0 (Communication Task): Handles the ESP-NOW stack, packet encryption (if implemented), and sending/receiving audio buffers.
  • Core 1 (System Task): Handles the Fingerprint UART polling, OLED I2C updates, and monitoring the GPIO buttons.

Communication Protocol (ESP-NOW)

We use ESP-NOW instead of standard Wi-Fi because it eliminates the handshake overhead.

  • Payload: Each packet contains a 250-byte audio chunk (PCM, 16-bit, 16kHz).
  • Security: Although the device is locked biometrically, ESP-NOW packets can be encrypted using a Pre-Shared Key (PSK) for hardware-level security.

Results

TBD

Conclusions

TBD

Download

O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-).

Fişierele se încarcă pe wiki folosind facilitatea Add Images or other files. Namespace-ul în care se încarcă fişierele este de tipul :pm:prj20??:c? sau :pm:prj20??:c?:nume_student (dacă este cazul). Exemplu: Dumitru Alin, 331CC → :pm:prj2009:cc:dumitru_alin.

Journal

Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului.

Bibliography/Resources

pm/prj2026/theodor_ioan.buliga/catalin.manole1211.1779482221.txt.gz · Last modified: 2026/05/22 23:37 by catalin.manole1211
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0