Live data from Hacker News

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

matthew.science

191–200 of 221 posts

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

#191
post #154

Earlier quoted context omitted.

If you want to get really spicy, you can use two antennas and an SDR to compute angle of arrival using nothing but a BLE advertisement's data . This is different from BLE AoA as it doesn't require a cooperative transmitter.

If you want to get really, really spicy, use three devices/antennas and you can roughly track in three-dimensional space.

there are wifi setups that allow you to do this already.

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

#192

Earlier quoted context omitted.

If you want to get really, really spicy, use three devices/antennas and you can roughly track in three-dimensional space.

there are wifi setups that allow you to do this already.

I would like to subscribe to this API.

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

#193

While I don’t discourage learning a new language the immediate toss aside of rust on esp32 was perplexing. It sounds like a lot of the memory issues would have been mitigated by sticking with a language better understood. Rust’s esp32c3 support is pretty good IMO, that’s all I use. Writing in C++ makes me feel dirty in ways that even COBOL doesn’t. I also think I would have implemented presence by TTL, updating the T…

The hash map was definitely not robust enough, that’s why I ultimately switched back to the default behavior and increased the memory available on the board! Also, I am a Rust fanatic. I do nearly everything in it! I gave a talk on it at our last hackathon! I even wear a Rust t-shirt regularly! So rest assured I will be exploring my options with Rust. I would love to get rid of my dependence on Arduino. But C++ was e…

Is it possible to program this device without the espresso SDK and the arduino stuff?

Whether I'll use C++ or Rust for my next project depends on which one I can first get working on this board with the standard toolchain (GCC and Rustc respectively)

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

#194

Earlier quoted context omitted.

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…

While I feel like the beacon tracking SDKs in apps are as slimy as going the other way round, those SDKs aren’t watching for your device’s beacon. They listen for BLE beacons with known addresses the company has place on their premises and use that to determine you’ve been to that particular location. I’m sure some of them are doing it at a larger scale and tracking all the beacons you see to provide a view on all the places you’ve been.

Almost all devices you’re carrying with you will regularly rotate the ID they transmit in order to avoid correlation, so reading those beacons in a location can’t really be used for much beyond rough numbers of devices.

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

#195
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…

I can relate a lot. Having the momentum on your side is the main force that pushes such a project forward. Especially if you have family duties that ususally consume most of your free time.

As long as children are smaller even things like scheduling time for your projects don't work very well. Usually because unexpected things happen that need to be handled. Sickness, children waking up early or taking longer to go to sleep, etc..

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

#196

Earlier quoted context omitted.

This is correct, I thought it wasn't and was going crazy trying to debug my Pi 3 resetting my 3D printer every time, with any of ten power supplies I tried, including a configurable bench PSU. I switched to the official Pi PSU after someone said "trust me on this" online, and yep, zero issues in all the years since.

It's voltage for Pi 3. They forgot to account for voltage drop due to protection or something. Official as well as third-party Pi 3 specific adapters are rated at 5.1V to mitigate that problem.

Early alexa devices also have power supplies that are rated at 5.2V, those could be an alternative. I also had a good experience with a 30W oneplus warp charger after some power issues with cheap 5V2A ones.

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

#197
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/hom…

I don't know the author's code but mine was at the same level as home assistant's. I believe I was using Bluer (BlueZ) [1] and afaik the problem is that the dependency needs an armv7 version of DBUS when it compiles which my non-armv7 laptop did not provide.

If I do the home assistant route and just copy my source code over to the raspi and build the binary there it all compiles+runs fine. Except for the part where I can't compile it locally and so I don't know of a build issue until its been transferred + built.

[1]: https://github.com/bluez/bluer

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

#198

Earlier quoted context omitted.

It’s definitely not a reliability issue, with the platform - ESP32 in general is very popular so it’s surely an issue with my usage. I’m fairly certain it’s just a cheap manufacturer issue I ran into. I bought essentially a no-name ESP32 at first and that’s the one that refused to last. Proper manufacturer solved that issue for me and now ESP32 works just fine. The raspberry pi actually never worked, largely because…

> I don’t think it’s a power issue as it’s getting 5V1A from a power outlet directly to USB-C into the device. It's not the total voltage/wattage the PSU can provide, but the voltage at the processor. The ESP's varying current draw notoriously causes too much noise and a lot of boards don't have large enough decoupling capacitors so the voltage drops too much and it glitches out. Also a warning that USB PSU's can ver…

>don't have large enough decoupling capacitors

Is this something you can eyeball to guess at quality?

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

#199
post #74

My alarm clock consists of an ESP32 and has a somewhat big LED-array connected to it (powered by a transistor), a buzzer and a PIR sensor. It doesn't show the time, but buzzes (and flashes) and takes care of slowly brightening the room, or at night slowly dimming it into darkness some time after all the lights have been turned off. One added benefit I discovered afterwards is that even though the AP is not between me…

Very cool! Thank you for sharing this. I would love to see a picture the aforementioned alarm clock setup as well.

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

#200
post #154

Earlier quoted context omitted.

If you want to get really spicy, you can use two antennas and an SDR to compute angle of arrival using nothing but a BLE advertisement's data . This is different from BLE AoA as it doesn't require a cooperative transmitter.

If you want to get really, really spicy, use three devices/antennas and you can roughly track in three-dimensional space.

Wouldn’t three dimensional tracking need four antennas?
Post reply on HN