ᛡᛒ BLE Scanner + Data persistence on SD Card for M5Stack, Odroid-Go, ESP32-Wrover-Kit and other models
A BLE Scanner with persistence.
BLECollector is just a passive BLE scanner with a fancy UI. All BLE data found by the BLE Scanner is collected into a sqlite3 format on the SD Card.
Public Mac addresses are compared against OUI list, while Vendor names are compared against BLE Device list.
Those two database files are provided in a db format (mac-oui-light.db and ble-oui.db).
On first run, a default
blemacs.dbfile is created, this is where BLE data will be stored. When a BLE device is found by the scanner, it is populated with the matching oui/vendor name (if any) and eventually inserted in the
blemasc.dbfile.
⚠️ This sketch is big! Use the "No OTA (Large Apps)" or "Minimal SPIFFS (Large APPS with OTA)" partition scheme to compile it. The memory cost of using sqlite and BLE libraries is quite high.
⚠️ Builds using ESP32-Wrover can eventually choose the 3.6MB SPIFFS partition scheme, and have the BLECollector working without the SD Card. Experimental support only since SPIFFS tends to get slower and buggy when the partition becomes full.
#define HAS_EXTERNAL_RTCin Settings.h)
#define HAS_GPSin Settings.h)
#define WITH_WIFIin
Settings.h
Settings.hor
Display.hto override)
#define HAS_EXTERNAL_RTC truein Settings.h
Minimal SPIFFS (Large APPS with OTA)
GPS_RXand
GPS_TXin GPS.h
#define HAS_GPS truein Settings.h
Minimal SPIFFS (Large APPS with OTA)
gpstimein the serial console
HID_XPad.hto override)
Display.h:
#define hasXPaxShield() (bool) true
Sending the
DownloadDBcommand will:
Available Commands:
01) help : Print this list 02) halp : Same as help except it doesn't print anything 03) start : Start/resume scan 04) stop : Stop scan 05) toggleFilter : Toggle vendor filter on the TFT (persistent) 06) toggleEcho : Toggle BLECards in the Serial Console (persistent) 07) setTimeZone : Set the timezone for next NTP Sync (persistent) 08) setSummerTime : Toggle CEST / CET for next NTP Sync (persistent) 09) dump : Dump returning BLE devices to the display and updates DB 10) setBrightness : Set brightness to [value] (0-255) (persistent) 11) ls : Show [dir] Content on the SD 12) rm : Delete [file] from the SD 13) restart : Restart BLECollector ('restart now' to skip replication) 14) screenshot : Make a screenshot and save it on the SD 15) screenshow : Show screenshot 16) toggle : toggle a bool value 17) resetDB : Hard Reset DB + forced restart 18) pruneDB : Soft Reset DB without restarting (hopefully) 19) bleclock : Broadcast time to another BLE Device (implicit) 20) bletime : Get time from another BLE Device (explicit) 21) gpstime : Sync time from GPS 22) latlng : Print the GPS lat/lng 23) stopBLE : Stop BLE (use 'restart' command to re-enable) 24) startWiFi : Start WiFi (will stop BLE) 25) setPoolZone : Set NTP Pool Zone for next NTP Sync (persistent) 26) NTPSync : Update time from NTP (will start WiFi) 27) DownloadDB : Download or update db files (will start WiFi and update NTP first) 28) setWiFiSSID : Set WiFi SSID 29) setWiFiPASS : Set WiFi Password
Contributions are welcome :-)
Implementing both LovyanGFX and Nimble-Arduino was such a huge optimization that none of the previous blockers exist any more!
Some ideas I'll try to implement in the upcoming changes: