QR Scanner Module (ESP32-CAM) 📸
The "Eyes" of the REward kiosk are provided by an AI-Thinker ESP32-CAM module, dedicated entirely to high-speed QR code recognition.
⚙️ Operation Logic
The CAM module runs as a secondary "Vision Processor" to avoid blocking the main kiosk logic during image processing.
Key Responsibilities:
- Continuous Scan: Uses the
ESP32QRCodeReaderlibrary to process camera frames in real-time. - Dual-Core Execution: The scanning task is pinned to Core 1, ensuring that the camera feed remains smooth without interrupting the serial handler.
- Visual Feedback: Every successful scan triggers the built-in LED Flash (GPIO 4) to let the user know their ID has been accepted.
🔗 Data Transfer
Once a valid QR code is detected: 1. The raw payload (User ID) is extracted. 2. The payload is sent via Standard Serial at 115200 baud. 3. The main ESP32 hub receives this string, validates the user with the API, and starts the recycling session.
🛠️ Setup & Deployment
- Library:
ESP32QRCodeReaderby alvarowolfx. - Baud Rate: 115200.
- Flash Pin: GPIO 4.
- Hardware Serial: Note that GPIO 1 (TX) and GPIO 3 (RX) are used for both flashing and the final communication with the main hub.
[!IMPORTANT] Ensure the ESP32-CAM is powered by a stable 5V supply capable of providing at least 2A during flash bursts to prevent "Brownout" resets.