Live data from Hacker News

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

matthew.science

1–10 of 221 posts

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

#2
This is an excellent write up!

> Seeed Studio XIAO ESP32S3/C3, WaveShare ESP32S3 Zero, Unbranded ESP32-WROOM with OLED, Orange Pi Zero W (untouched), Raspberry Pi Zero W (L->R, T->D) After testing all of these, the only one reliable to work for long periods of time (one month currently) was the XIAO ESP32C3/S3.

I suspect they may be having power issues? For the ESP32's specifically I highly recommend adding a beefy capacitor over the power rails, as those can be rather sensitive to voltage fluctuations especially when transmitting. Both the RPi and ESP's can be finicky depending on the power supply/cable/cable length too, and the RPi's sdcard does tend to fail from sudden power loss. They should all be capable of at least a month, my pi's and esp's have gone several months.

I'd be curious to see the results from other ESP32's (or even the pi) with a larger capacitor added.

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

#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 you don't have a library instead of refusing to build.

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

#4

This is an excellent write up! > Seeed Studio XIAO ESP32S3/C3, WaveShare ESP32S3 Zero, Unbranded ESP32-WROOM with OLED, Orange Pi Zero W (untouched), Raspberry Pi Zero W (L->R, T->D) After testing all of these, the only one reliable to work for long periods of time (one month currently) was the XIAO ESP32C3/S3. I suspect they may be having power issues? For the ESP32's specifically I highly recommend adding a beefy c…

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 tried to shoehorn way too much complexity in and manage too many things. It’s just a BT scan and a HTTP call.

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. Though that’s definitely something I need to look into, as the Xiao ESP32-S3 I have also had intermittent issues, and IIRC the XTensa cores are more power-hungry than its RISC-V based sibling, the ESP32-C3.

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

#6

This is an excellent write up! > Seeed Studio XIAO ESP32S3/C3, WaveShare ESP32S3 Zero, Unbranded ESP32-WROOM with OLED, Orange Pi Zero W (untouched), Raspberry Pi Zero W (L->R, T->D) After testing all of these, the only one reliable to work for long periods of time (one month currently) was the XIAO ESP32C3/S3. I suspect they may be having power issues? For the ESP32's specifically I highly recommend adding a beefy c…

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 very MASSIVELY in quality (I'd suggest an apple one for testing if you have one handy).

I think you're right that the RISC-V processor is either better behaved and draws power more consistently, or the board has shorter traces to it's bypass capacitor or a larger bypass capacitor.

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

#7

This is an excellent write up! > Seeed Studio XIAO ESP32S3/C3, WaveShare ESP32S3 Zero, Unbranded ESP32-WROOM with OLED, Orange Pi Zero W (untouched), Raspberry Pi Zero W (L->R, T->D) After testing all of these, the only one reliable to work for long periods of time (one month currently) was the XIAO ESP32C3/S3. I suspect they may be having power issues? For the ESP32's specifically I highly recommend adding a beefy c…

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…

Are you sure that the system isn't still running, but it has just disconnected from wifi and is failing to reconnect? I have a few status LED's flashing to show the main CPU is still running, and it often is, even when the device has fallen off the network.

I find that happens fairly frequently unfortunately, and haven't managed to track down the cause.

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

#8
post #5

And with more of these, you could track where everyone is all the time! Here's a camera based video people counter.[1] This is a bit less intrusive. [1] https://github.com/saimj7/People-Counting-in-Real-Time

Given manufacturer’s trends of enabling the privacy feature of randomizing the MAC address every n minutes, it would take some serious effort and analysis to reverse these general trends into individuals. I’ve linked a relevant article in the bibliography about these kinds of attacks [1] but in general, at least with user numbers in the hundreds, it would be very difficult.

[1]: https://ieeexplore.ieee.org/document/9369628

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

#9

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…

Are you sure that the system isn't still running, but it has just disconnected from wifi and is failing to reconnect? I have a few status LED's flashing to show the main CPU is still running, and it often is, even when the device has fallen off the network. I find that happens fairly frequently unfortunately, and haven't managed to track down the cause.

Hm, that’s a good call. I have a callback on the connection dropped to reconnect but it’s possible it needs a full reboot? I’m going to have to sit in on the serial monitor and wait until something happens and see. Thanks for the tip!

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

#10

This is an excellent write up! > Seeed Studio XIAO ESP32S3/C3, WaveShare ESP32S3 Zero, Unbranded ESP32-WROOM with OLED, Orange Pi Zero W (untouched), Raspberry Pi Zero W (L->R, T->D) After testing all of these, the only one reliable to work for long periods of time (one month currently) was the XIAO ESP32C3/S3. I suspect they may be having power issues? For the ESP32's specifically I highly recommend adding a beefy c…

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…

[deleted]
Post reply on HN