This project includes the source code for a Bluetooth-based localization and proximity detection system using ESP32-C3 modules, designed to work with the Arduino IDE.
The system comprises two types of devices:
- Beacons: ESP32s that broadcast BLE advertisements.
- Tag: A mobile ESP32 that scans for beacons and processes their signals.
- Device Type: π‘ Beacon
- Purpose:
- Periodically sends out Bluetooth Low Energy (BLE) advertisements.
- Acts as a fixed-location identifier to be detected by the tag.
- Features:
- Configurable broadcast name or ID.
- Minimal resource useβideal for battery operation.
- Device Type: πΆ Tag (Scanner)
- Purpose:
- Continuously scans for nearby BLE beacons.
- Measures RSSI (signal strength) to estimate distance or presence.
- Can trigger actions like logging, alerts, or communication.
- ESP32-C3 development boards (e.g., NodeMCU-C3, D1 Mini ESP32-C3)
- Arduino IDE installed
- ESP32 board package installed in Arduino IDE
- BLE support via
BLEDevicelibrary (usually included with ESP32 core)
- Open Arduino IDE
- Go to File > Preferences, and add the following URL under Additional Board Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Go to Tools > Board > Boards Manager, search for "esp32" and install it.
- Select
ESP32C3 Dev Modulefrom the board list. - Open one of the following:
esp32_c3_beacon.inofor beacon devicesesp32_c3_tag.inofor the scanning tag
- Connect your ESP32-C3 and upload the code.
- You can deploy multiple ESP32s as beacons using
esp32_c3_beacon.ino. - The tag, running
esp32_c3_tag.ino, listens for those beacons and can: - Filter based on MAC addresses or advertisement data
- React to signal strength thresholds (RSSI)
- Customize the code to fit your logic:
- Beacon broadcast interval
- Scan frequency
- Filtering logic (e.g., whitelist of beacons)
This code is meant to integrate with a Raspberry Pi system that:
- Listens for the tagβs output
- Collects and transmits beacon interaction data
- Manages services related to Bluetooth communication and logging