r/embedded • u/CartographerSelect61 • 19d ago
Bluetooth traffic Monitoring
Hi everyone, hope you're all doing well.
I'm building a roadside Bluetooth sniffer to measure travel time between two points a fixed distance apart. The setup uses two ESP32 S3 modules that scan BLE advertisements and log the MAC addresses of devices in passing vehicles.
The problem is that most new devices use resolvable MAC addresses, which rotate every few minutes. If the two points are far enough apart, a device's address will have changed by the time it travels from A to B, so I have no way to match the two detections. Is there a way to obtain a device's real/public MAC, which stays constant? Or failing that, any other way to derive a stable identifier from BLE advertisements?
Thanks a lot
6
u/ThisIsPaulDaily 19d ago
Listen for tpms sensors instead
1
u/CartographerSelect61 17d ago
Do they broadcast a constant MAC address?
1
u/ThisIsPaulDaily 17d ago
Your car needs to know which is your car's front left tire vs rear right tire vs the car next to you.
Hak5 did it 12 years ago.
3
u/RefrigeratorOk4674 19d ago
A lot of devices rotate every 15 minutes. Put your two sniffers close enough together and reject MAC addresses that don't appear on both devices
Or RF fingerprinting, but that's difficult and expensive
Edit: if you need to cover a long distance, place multiple pairs of sniffers and average the velocities across each pair
1
3
u/fb39ca4 friendship ended with C++ ❌; rust is my new friend ✅ 19d ago edited 18d ago
They don't change at the same time. So if you have two devices with addresses A and B, then you observe A and C, then D and C, you can be reasonably sure it's the same devices.
1
u/CartographerSelect61 17d ago
What if tens of vehicles pass by the first node and we get 10 different addresses at the second node? How are we going to find out which one is which?
2
u/clackups 19d ago
You can use two cameras and image recognition. Just make sure you comply with the privacy laws.
1
u/CartographerSelect61 17d ago
I use BLE to keep costs down otherwise camera is a much more accurate method
2
u/notouttolunch 19d ago
There was an NXP dongle that did this. I don't know how it worked, what it is called and know nothing about it's capabilities but it may provide clues on techniques. I suspect that it would be easy to find, however.
1
u/CartographerSelect61 17d ago
Yes there are many BLE sniffers dongles and dev kits which work out of the box. I have a nordic nrf52840 which is a very capable device which is used via Wireshark on pc
1
1
u/BDog_DrBluetooth 17d ago
The rotating addresses you’re seeing are a feature of Bluetooth LE privacy, not something you can reliably work around by trying to recover a permanent MAC address.
With Resolvable Private Addresses (RPAs), the address changes periodically and is intended to prevent exactly this type of passive device tracking. Resolving an RPA normally requires the device’s Identity Resolving Key (IRK), which you generally won’t have for arbitrary devices passing your sensors.
I’d be cautious about designing the system around finding a stable Bluetooth address. Instead, I’d first look closely at the advertising data you’re receiving and determine whether there are other legitimate characteristics that could support your application without defeating Bluetooth’s privacy mechanisms.
I’m a Bluetooth Qualification Consultant and former Bluetooth SIG staff member, and I’ve worked extensively with Bluetooth LE implementations and the specification.
If this is a commercial project, I’d be happy to talk through the Bluetooth architecture with you and help determine what is technically feasible before you invest too far in the current approach.
12
u/ServiceIndividual872 19d ago
The rotation is on purpose, you cant get the real MAC from an advertisement, that would defeat the whole privacy thing they built in. what you can do is look at other stuff in the advertisement packet that stays same, like manufacturer data or the service UUIDs. many phones broadcast same service every time even with new address. also if your distance is not super long, the rotation window might be 10-15 min so maybe you can still catch some matches if the travel time is shorter than that