Bluetooth Low Energy everywhere!
coding python ble bluetooth rasperry pi zero w
Written on October 4, 2019
Bluetooth device are very talkative in the street.
Here is some code and results of the noise in my street from cars, cars accessories, fitness tracker, bikes (rent), what else?
It is just crazy that so many devices broadcast so much through Bluetooth Low Energy!
Inspired by a thread on Hacker News: Retail stores use Bluetooth beacons to track customers.
4 millions recording laterβ¦
Setup: database + raspberry pi zero W
T4 (PostgreSQL) β RPI0W
Bluepy
- NOTE that LE scanning must be run as root. :warning:
- and loop aroundβ¦
References:
from bluepy.btle import Scanner, DefaultDelegate
class ScanDelegate(DefaultDelegate):
def __init__(self):
DefaultDelegate.__init__(self)
def handleDiscovery(self, dev, isNewDev, isNewData):
if isNewDev:
print "Discovered device", dev.addr
elif isNewData:
print "Received new data from", dev.addr
scanner = Scanner().withDelegate(ScanDelegate())
devices = scanner.scan(10.0)
for dev in devices:
print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)
for (adtype, desc, value) in dev.getScanData():
print " %s = %s" % (desc, value)
Code on GitHub
Coming soon
- sensor : https://github.com/sebastien-ferry/ble_sensor
- database : https://github.com/sebastien-ferry/ble_database
- flask web access : https://github.com/sebastien-ferry/ble_flask
Some result
Name cloud
Manufacturer cloud
App screenshot
Next
(?)
Also, RF with TPMS