Live data from Hacker News

Building an occupancy sensor with a $5 ESP32 and a serverless DB

matthew.science

171–180 of 221 posts

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#171

I'm wondering how accurate this might prove measuring automobile traffic on a relatively busy street? I've been pondering some way to track the number of vehicles that pass my house each day, and would like (but not ideal) to get their average speed too. Was thinking about computer vision, and even audio doppler approaches, but this seems simpler - if only the bluetooth sensing might work on a device moving at 50mph+…

[dead]

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#172
post #97

> not losing momentum in a nerd snipe like this is CRITICAL This line got me laughing! My nerd brain has tried so many times to convince me to splurge money with this exact line!

It's funny, but it's also true. There are definitely times when I'm more "in the mood" for projects; In the winter particularly, I work more on my electronic projects, and do more gaming (my Gaming "season" just started again last week).

Of course the dramatic shift from "what do I feel like doing today" to "what am I in the mood for / have time for this season" has a lot to do with me being older and having children now, but with such huge gaps between me being willing/able to do such projects, losing momentum could mean coming back to something an entire year later, if ever.

I started an electronics project, at least 10 years ago now. It's "infamous" in my family, particularly when my wife needs something to poke at with my projects, for being the project I started over a decade ago, spent a tidy sum on, and am still adamant I will finish one day!

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#173
> but some don't carry any devices at all (or keep Bluetooth off on their phone).

Exactly. I always had a habit of turning BT off, hoping to conserve the battery. And then our security department advises it - if you don't use it at the moment, turn it off. For security reasons. Flaws in BT sometimes come up and good if a user can get that update.

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#174
post #119

Outstanding write-up! We actually built a business based on this technology (occuspace.io) and have had to address almost all the questions that you brought up. To answer some of them here: Q: How accurate is BLE beacon count, as a proxy for occupancy? A: It's very highly correlated but different dining locations, classrooms and library floors have very different correlation factors. Consider using other, perhaps mor…

Can you do fall detection for the elderly?

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#175

I'm wondering how accurate this might prove measuring automobile traffic on a relatively busy street? I've been pondering some way to track the number of vehicles that pass my house each day, and would like (but not ideal) to get their average speed too. Was thinking about computer vision, and even audio doppler approaches, but this seems simpler - if only the bluetooth sensing might work on a device moving at 50mph+…

I have an unorthodox suggestion: get a bicycle rear radar like the Garmin Varia. They communicate via Bluetooth LE incoming cars, their count, and an average speed (in a set of ranges like 0-15km/h, 15-30km/h, …).

Mount this with a usb cable somewhere, add an ESP32 or anything with Bluetooth somewhere else to accumulate.

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#176

Earlier quoted context omitted.

I have to say, my manual solution was a lot more fun and hands-on and let me learn a lot more skills (C++, Grafana, serverless) than a one-click solution. Though I will be prioritizing maintainability if I decide to go further with it!

Agree with you fully. It's also a lot more easy to program behavior into an esp32 rather than rely on home assistant pre defined modules.

It's more about ESPHome rather than Home Assistant.

But yeah it is more fun to do it bare bones :). However, over time I found myself "upgrading" my hand made IoT devices to more standard solutions. Standard solutions usually work better.

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#177
post #90

Since this was done by a student at a university, and at some level this involves tracking people, that's an opportunity to ask a professor about what human subjects protocols you'd need if this was research. (A professor might be easier to ask than the university human subjects board -- who might refuse to talk with you because this isn't under their jurisdiction, or might get alarmed because you didn't talk with th…

I wonder what the "rules" are for things like tracking beacons. They're being broadcast, and they're almost certainly collected without consent everywhere we go. I happen to live at a junction where my home is regularly surrounded by large numbers of Bluetooth devices; I had considered setting up a BLE tracker purely for "fun" to see what I could collect and discern from the data. For example, one thing I'm certain o…

> So a hidden industry of third-party location-marketing firms has proliferated in response. These companies take their beacon tracking code and bundle it into a toolkit developers can use. The makers of many popular apps, such as those for news or weather updates, insert these toolkits into their apps

> Location marketing aims to understand “online-offline attribution.” If a Starbucks coffee ad is sent to your email, for example, marketers want to know if you actually went there and bought a coffee. The only way to know is to monitor your online and offline habits at all times.

> Beacons are also being used for smart cities initiatives. The location company Gimbal provided beacons for LinkNYC kiosks that provoked privacy concerns about tracking passers-by. Beacon initiatives have been started in other cities, including Amsterdam (in partnership with Google), London and Norwich.

https://web.archive.org/web/20231027211008/https://www.nytim...

It's the wild west. We're illegally surveilled every day and the government uses the same data in product that allow them to track people without warrants

https://en.wikipedia.org/wiki/Fog_Reveal

There are no "rules" against receiving a signal. All you need is a radio that can pick them up. The rules apply to those broadcasting things afaik

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#178
post #173

> but some don't carry any devices at all (or keep Bluetooth off on their phone). Exactly. I always had a habit of turning BT off, hoping to conserve the battery. And then our security department advises it - if you don't use it at the moment, turn it off. For security reasons. Flaws in BT sometimes come up and good if a user can get that update.

Turning bt "off" in your settings likely doesn't actually turn off the radios. It probably just disables connections. If you use lost phone features like findmyiphone, the defaults are to participate in the "find my" network, a mesh network of bt low energy devices for airtags, etc. Most often, even turning off your entire phone won't help, as the incentive to participate in the "find my" network is they give you the feature of tracking your phone even when powered off

https://en.wikipedia.org/wiki/Find_My

https://en.wikipedia.org/wiki/IBeacon

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#179
post #3

> Linux Bluetooth is incredibly painful to handle in a headless way. Binding to DBus requires cross-compiler magic and not even Cross was getting me out of it. That was my experience as well. I was doing something different so ultimately I just decided I'd put both the devices on the same WiFi network and then scan for "pi.local". Do wish I knew how all those other crates work though where it crashes at runtime if yo…

Home assistant does headless bt presence detection in ~200 lines of python I think the author had a painful experience because they wanted to do embedded and had to interface at a much lower level, where it's a long ago solved problem in higher level languages. Considering the tracker ended up in their door next to their computer, they could have stuck with the rpi that ran python and been fine

https://github.com/home-assistant/core/blob/dev/homeassistan...

https://www.home-assistant.io/integrations/bluetooth_tracker...

Re: Building an occupancy sensor with a $5 ESP32 and a serverless DB

#180
post #119

Outstanding write-up! We actually built a business based on this technology (occuspace.io) and have had to address almost all the questions that you brought up. To answer some of them here: Q: How accurate is BLE beacon count, as a proxy for occupancy? A: It's very highly correlated but different dining locations, classrooms and library floors have very different correlation factors. Consider using other, perhaps mor…

Does this type of occupancy tracking work accurately outdoors? I'm assuming it would be difficult because signals would travel further. (My startup needs occupancy tracking for tennis courts.) Maybe I could mount a BT device at a corner of the outdoor space and use its signal strength as the threshold value.

Did you consider using BT or UWB as a radar? On a tennis court you won't have any obstacles to worry about, I suspect it's relatively easy to solve.

UWB in particular is accurate enough to get breathing patterns...

Post reply on HN