BLE communication system
Lead developer on the first semester of the Egalitarian project — an ESP32 to React Native BLE bridge for offline field data collection by waste pickers in Brasília.
The first semester of the Egalitarian project focused on a specific problem: waste pickers in Brasilia collect on routes far from connectivity. We needed a way to log collection data in the field and sync it back to the backend when back in range.
The solution
A two-part system:
- An ESP32 microcontroller worn or mounted on the collection cart, running a BLE GATT server. It logs collection events locally and exposes them over BLE.
- A React Native mobile app that connects to the ESP32 over BLE, reads the collection data, and syncs it to the Egalitarian backend when internet is available.
Technical details
The ESP32 firmware handles BLE advertisement and GATT service definition, local storage of collection events in flash, and a simple protocol for the mobile app to request and acknowledge records.
The React Native app uses the react-native-ble-plx library for BLE communication. I wrote a custom service layer that abstracts the raw BLE characteristic reads/writes into a clean API that the rest of the app could use without knowing anything about Bluetooth.
What I learned
BLE is genuinely finicky. Connection management, reconnection logic, and handling the differences between iOS and Android BLE stacks ate more time than the actual data transfer protocol. The most valuable thing I did was write a small test harness early — a CLI script that could connect to the ESP32 and run the full transfer protocol — so I could iterate quickly without needing to build the full React Native UI.
As lead developer, I also coordinated with the University of Brasilia team who owned the backend. We agreed on a simple JSON format for collection events early, which made integration straightforward when we had a working system.