Download data via Bluetooth (BLE) using an ESP32 and iPhone

ESP32: https://github.com/ryanrdetzel/BLE-Data-Dump-ESP32
iOS: https://github.com/ryanrdetzel/BLE-Data-Dump-iOS


Storing data is easy, getting it off is more difficult especially on battery powered devices that are not in wifi range. I want to see if BLE provides an easy way to pull data off micro-controllers so I can use it on future projects. The plan for this is to use an ESP32 as it already has built BLE and my iPhone because I always have it on me, it works over cellular and can easily hold and process data.

Plan

Simple BLE programming running on the ESP32 that responds to various BLE commands. The first command would ask the device how much data it has to send over and the other would trigger the BLE device to start sending the data. The iPhone would be the other device issuing the commands and waiting for the data. The phone will collect all the data in a buffer and verify it.

Hardware

  • ESP32 – Because it has BLE builtin so I won't need to use another IC. I'll store data on the flash or external eeprom
  • 24LC256 I2C EEPROM 256kbit – not required but it will allow me to test sending from an external memory store too
  • iPhone – We'll use this as the primary way to extract data but any BLE device would work as a client.

Results

It takes about 27 seconds to transfer 32KB, about 1200 bytes/second which isn't great BUT I was able to get data off the device. I could probably improve the bandwidth if I wasn't reading off the eeprom, better buffering could help. I did run into some random errors sometimes which meant missed data, if I move forward with this project I'll have to add some data protection logic. Retries at the very least.

The app doesn't really check for BLE errors well, the basics are there though.

An example of what the iOS app looks like. Very basic but gets the job done. Simple status label and progress bar.

Conclusion

This is exactly what I wanted. I plan on using this for an upcoming project where I want to store temperature data and be able to later download and send it to the cloud. I might use this for GPS tracking later too where WiFi isn't available and if I ever get around to it I'll use it as an altimeter for model rockets.