Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork31
ᛡᛒ BLE Scanner + Data persistence on SD Card for M5Stack, M5Core2, Odroid-Go, ESP32-Wrover-Kit and other models
License
tobozo/ESP32-BLECollector
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 asqlite3 format on the SD Card.
Public Mac addresses are compared againstOUI list, while Vendor names are compared againstBLE Device list.
Those two database files are provided in a db format (mac-oui-light.db andble-oui.db).
On first run, a defaultblemacs.db
file 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 theblemasc.db
file.
- [mandatory] ESP32-Wroom or ESP32-Wrover (Wrover is recommended)
- [mandatory] SD Card (breakout or bundled in Wrover-Kit, M5Stack, Odroid-Go, LoLinD32 Pro)
- [mandatory] Micro SD (FAT32 formatted,max 4GB)
- [mandatory]mac-oui-light.db andble-oui.db files copied on the Micro SD Card root
- [mandatory] ST7789/ILI9341 320x240 TFT (or bundled in Wrover-Kit, M5Stack, Odroid-Go, LoLinD32 Pro, D-Duino32-XS)
- [optional] (but recommended) I2C RTC Module (see
#define HAS_EXTERNAL_RTC
in Settings.h) - [optional] Serial GPS Module (see
#define HAS_GPS
in Settings.h) - [⚠ NEW][optional]XPad Buttons Shield fromRadomir Dopieralski
- [mandatory] Arduino IDE
- [mandatory]ESP32-Chimera-Core (get it from the Arduino Library Manager)
- [mandatory]LovyanGFX (get it from the Arduino Library Manager)
- [mandatory]M5Stack-SD-Updater (get it from the Arduino Library Manager)
- [mandatory]NimBLE Library supersedes the BLE (legacy or custom) library versions, install it manually in the Arduino/Libraries folder.
- [mandatory]PaulStoffregen's Time library (get it from the Arduino Library Manager)
- [mandatory]esp32_arduino_sqlite3_lib (get it from the Arduino Library Manager)
- [optional]TinyGPSPlus
- Hobo: when no TinyRTC module exists in your build, only uptime will be displayed
- Rogue: TinyRTC module adjusted after flashing (build DateTime), shares time over BLE
- Chronomaniac: TinyRTC module adjusts itself via GPS, shares time over BLE
- With WiFi: Temporary dual BLE/WiFi mode to allow downloading or serving .db files, see
#define WITH_WIFI
inSettings.h
- Wire your TinyRTC to RTC_SDA/RTC_SCL (see
Settings.h
orDisplay.h
to override) - Insert the SD Card
- Set
#define HAS_EXTERNAL_RTC true
inSettings.h - Flash the ESP with partition scheme
Minimal SPIFFS (Large APPS with OTA)
- Wire your GPS module to TX1/RX1 (edit
GPS_RX
andGPS_TX
in GPS.h - Set
#define HAS_GPS true
inSettings.h - Flash the ESP with partition scheme
Minimal SPIFFS (Large APPS with OTA)
- Wait for the GPS to find a fix
- issue the command
gpstime
in the serial console
- Wire your XPad Buttons Shield to XPAD_SDA/XPAD_SCL (see
HID_XPad.h
to override) - Enable the module in
Display.h
:#define hasXPaxShield() (bool) true
- Controls are:
- Down / Up : brightness
- Right / Left : unassigned (yet)
- A : start/stop scan
- B / C : toggle mac filter
- D : unassigned (yet)
- Once the time is set using RTC, GPS or NTP, the BLECollector may start the TimeSharing service and advertise a DateTime characteristic for other BLECollectors to sync with.
- Builds with no RTC/GPS will try to identify this service during their scan duty cycle and subscribe for notifications.
Sending theDownloadDB
command will:
- Stop BLE
- Start WiFi
- Synchronize time to a nearby NTP server
- Download the latest oui/vendors database from github
Available Commands:
01) help : Print this list02) halp : Same as help except it doesn't print anything03) start : Start/resume scan04) stop : Stop scan05) 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 DB10) setBrightness : Set brightness to [value] (0-255) (persistent)11) ls : Show [dir] Content on the SD12) rm : Delete [file] from the SD13) restart : Restart BLECollector ('restart now' to skip replication)14) screenshot : Make a screenshot and save it on the SD15) screenshow : Show screenshot16) toggle : toggle a bool value17) resetDB : Hard Reset DB + forced restart18) 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 GPS22) latlng : Print the GPS lat/lng23) 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 SSID29) setWiFiPASS : Set WiFi Password
Contributions are welcome :-)
Implementing bothLovyanGFX andNimble-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:
- Add GPS Coords to entries for better pruningas suggested by /u/playaspect
- Better Analysis of ServiceData (see @reelyactive'sadvlib)
- Extended logging (SDCard-less meshed builds)
- https://github.com/cyberman54/ESP32-Paxcounter
- https://github.com/G4lile0/ESP32-WiFi-Hash-Monster
- https://github.com/justcallmekoko/ESP32Marauder
- @Lovyan03 for integrating hisLovyanGFX into theESP32-Chimera-Core thus saving an enormous amount of sram and flash space
- @h2zero for sharingNimBLE Library and brillantly proving that BLE can work with WiFi on Arduino without eating all sram/flash space
- https://github.com/siara-cc/esp32_arduino_sqlite3_lib
- huge thanks tohttps://github.com/chegewara for maintaining the initialBLE library that made this project possible
About
ᛡᛒ BLE Scanner + Data persistence on SD Card for M5Stack, M5Core2, Odroid-Go, ESP32-Wrover-Kit and other models
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.