Skip to content

Kiosk Main Hub (ESP32) 🤖

The REward kiosk is powered by an ESP32 DevKit V1, acting as the central "brain" that coordinates sensors, displays, and cloud communication.


🛠️ Modular Hardware Testing

The firmware is developed using a modular approach. Instead of one giant, complex file, the project includes specific test scripts to verify each component individually. This ensures high reliability and easier maintenance.

1. Object Detection (IR & Inductive)

  • Path: esp32_kiosk/tests/02_Test_Sensors.ino
  • Logic: Uses digital pins with INPUT_PULLUP.
    • IR Sensor: Detects plastic bottles.
    • Inductive Sensor: Detects metal cans (requires a voltage divider for 12V industrial sensors).
  • Behavior: Interrupt-style polling that identifies when an object passes through the recycling chute.

2. User Interface (Keypad & Display)

  • Keypad: esp32_kiosk/tests/03_Test_Keypad/
    • Uses a 4x4 Matrix Keypad for manual ID entry if QR scanning fails.
    • Logic handled by the Keypad.h library.
  • TFT Display: esp32_kiosk/tests/04_Test_Display/
    • Powered by an ST7789 1.14" RGB screen.
    • Displays real-time point updates and recycling progress using the Adafruit_GFX library.

📡 Communication Architecture

The main hub handles two types of communication:

  1. Local (Serial): Listens to the ESP32-CAM via Serial2 (Hardware Serial) on GPIO 16 (RX) and 17 (TX). It receives the decoded User ID payloads from the camera.
  2. Cloud (WiFi + REST): Connects to the REward PHP API to submit transactions and update machine status.

🔌 Pin Mapping (Core)

Component Pin (GPIO) Mode
IR Sensor 25 Input
Inductive Sensor 26 Input
TFT CS 5 SPI
TFT DC 19 SPI
TFT Reset 21 SPI
Keypad Rows 32, 33, 27, 14 Matrix
Keypad Cols 4, 0, 2, 15 Matrix
Serial RX2 16 Serial (from CAM)