Hacker News new | ask | show | jobs
by scrose 954 days ago
It's great seeing all the different approaches people can come up with to do similar things!

I recently worked on a similar side project but took a very different approach. It pretty much was just:

1. A bash script in a Raspberry Pi W that ran `bluetoothctl` once per minute and wrote the raw output for that minute to a file.

2. A systemd process that would ensure the script would get re-run if the process crashed or machine rebooted

3. A separate script that parsed the logs and pushed them to a local sqlite DB that tracked the minute the bluetooth id was found.

4. A daily push to my backup server that stored the sqlite DB

I decided to use systemd and a simple(10loc) bash script since I faced a similar issue to the OP where my pi would crash(although it was purely my fault for messing with a bunch of cables) and I wanted a way to get it running again with the lowest overhead. I also wanted as few dependencies as possible.

I went with SQLite because it made querying for trends and building dashboards simpler and more interesting(and because the real project was the sqlite interface I was building :) )

One thing I learned from running this which also may answer a couple of OPs questions: Apple devices like hiding themselves. The only way I could get my Apple laptops and phones to show up was to keep the bluetooth settings menu open on them. Otherwise, they wouldn't appear to the bluetooth scanner. I can't speak much to whether android devices are 'noisier', but the lack of bluetooth feeds for Apple devices alone cuts out a significant part of the value of bluetooth scanning for crowd sensing, given the market share for Apple devices.