Inspiration
The inspiration for this project comes from a silly idea I had to freak out my landlord, Cody. I had many IoT devices around the house and I thought it'd be a cool idea to recognise when he comes into the house using his phone's bluetooth ID and have a device automatically say "Hey Cody!" and start flickering the lights or something. However, we adapted the idea to instead be some very valuable technology.
What it does
Pitracker does two things:
- Identifies nearby people by using their phone's bluetooth advertisement and associating their device ID with a list of known people
- Tracks where that phone is by triangulating the bluetooth signal using multiple tracking nodes
How we built it
We built Pitracker by using three raspberry pis which constantly scan for nearby bluetooth devices. When any device is identified, this data is sent to a server for processing. The server logs the data, calculates the location, and sends the information over a websocket to a dashboard.
To calculate the location of the device, we used the RSSI. This is a signal strength indicator that is available over bluetooth, and there has already been research done which correlates RSSI value with a defined distance. By determining the phone's distance from each Pi, we were able to triangulate the location.
Challenges we ran into
The main challenge we ran into was getting bluetooth to work properly using Python on a raspberry pi. This seemed absolutely crazy that such a widely used platform and technology does not have any standard, maintained libraries for python. During this, we fell down a rabbit hole of trying to identify the device name using the advertisement packet. This led us to doing raw GATT requests, monitoring the HCI0 interface and decoding the packets using a tool. However, we eventually realised we don't actually need the device name, only the identifier. Nonetheless, we learnt a huge amount about the protocols and specifications that underpin bluetooth during this, including how to use UUIDs to request information from devices and control them.
The second challenge we ran into was when figuring out how to triangulate devices. This requires time synchronisation when reading the device signals, but we didn't want to require the Raspberry Pis to communicate with each other in order to sync. Therefore, we came up with the strategy of getting data exactly on each 10th second, this ensures the Pis are syncrhonised but without needing them to know what state the others are in.
What's next for BT Device Identifier & Tracker
What's next is to map the user's location based on the triangulation data, currently we can locate users but we have not yet developed a proper UI to map them.
Demo URLs:
- Live locating of nearby bluetooth devices: https://pitracker.helpfulseb.com/
- Live logs of all retrieved nearby bluetooth device signals: https://pitracker.helpfulseb.com/logs
Log in or sign up for Devpost to join the conversation.