Live data from Hacker News

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

matthew.science

91–100 of 221 posts

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

#91
Bluetooth is fun.

A while ago I was playing around with libble++[0] to read the data from some cheap temp/humidity sensors which broadcast their data as an advertising packet. Pretty simple, considering.

Did some other playing to turn my laptop into a BLE beacon (which worked pretty well with some random app on my phone) and also tried (IIRC successfully) to emulate one of those apple airtags though that code is lost somewhere on said laptop.

A quick glance at my temperature reading code and I'd say that counting the number of seen advertisements would be trivial using that library, I'm currently letting it do all the real work and just filtering the results to the devices I'm interested in.

[0] https://github.com/edrosten/libblepp

--edit--

I also seem to have started writing a python C wrapper around libble++ but obviously never followed through so its completeness is doubtful.

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

#92
post #43

How do people "productize" their ESP32 projects? (Edit: not talking about mass-producing something, I just want a self-contained unit rather than a board with a bunch of wires sticking out) I see a lot of pages where they show some bare-looking board, but in the real world you want to package that up. If you're a software guy like me, you would likely prefer to pay a bit extra to just have that tidied up for you rath…

I mount the board on some nylon standoffs through a takeaway box lid. The rest of the takeaway box is the enclosure. I drill some holes through the takeaway box for wire ingress and egress.

I use a tupperware container if I'm feeling fancy.

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

#93
post #86
post #43

How do people "productize" their ESP32 projects? (Edit: not talking about mass-producing something, I just want a self-contained unit rather than a board with a bunch of wires sticking out) I see a lot of pages where they show some bare-looking board, but in the real world you want to package that up. If you're a software guy like me, you would likely prefer to pay a bit extra to just have that tidied up for you rath…

You shouldn't productise anything with ESP32, its just an overprized bloated hobby pcb, very unprofessional. See my comment below on how to productize this: use a 4 cent off the shelf microcontroller on a 10 cent pcb or much better: make a custom chip with all the sensors on board but with $25K minimum Capex but tiny Opex

[deleted]

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

#94
post #86
post #43

How do people "productize" their ESP32 projects? (Edit: not talking about mass-producing something, I just want a self-contained unit rather than a board with a bunch of wires sticking out) I see a lot of pages where they show some bare-looking board, but in the real world you want to package that up. If you're a software guy like me, you would likely prefer to pay a bit extra to just have that tidied up for you rath…

You shouldn't productise anything with ESP32, its just an overprized bloated hobby pcb, very unprofessional. See my comment below on how to productize this: use a 4 cent off the shelf microcontroller on a 10 cent pcb or much better: make a custom chip with all the sensors on board but with $25K minimum Capex but tiny Opex

The esp is a cheap microcontroller.

You shouldn't productionize an esp32 dev kit but you should absolutely productionize an esp32 on a board you've designed that has the specif features to do your thing (whatever that is).

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

#95

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 chased a reliability problem with an RPi3 for a while before figuring out it was a poor quality USB cable that I was using for power.

Not saying that’s your issue obviously, but I spent a couple more hours than I really should have swapping USB power bricks but not the cable (because it was threaded through the printer enclosure and laziness prevailed).

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

#96
post #86

Earlier quoted context omitted.

You shouldn't productise anything with ESP32, its just an overprized bloated hobby pcb, very unprofessional. See my comment below on how to productize this: use a 4 cent off the shelf microcontroller on a 10 cent pcb or much better: make a custom chip with all the sensors on board but with $25K minimum Capex but tiny Opex

The esp is a cheap microcontroller. You shouldn't productionize an esp32 dev kit but you should absolutely productionize an esp32 on a board you've designed that has the specif features to do your thing (whatever that is).

no, the ESP32 is a SoC, a bunch of chips in a package on a PCB. not a bare microcontroller chip. It is already a product with several resellers: ip, fab, packaging, exporter, distributor, retailer and a very high profit overhead of at least 2.7 times the costprice

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

#98

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 chased a reliability problem with an RPi3 for a while before figuring out it was a poor quality USB cable that I was using for power. Not saying that’s your issue obviously, but I spent a couple more hours than I really should have swapping USB power bricks but not the cable (because it was threaded through the printer enclosure and laziness prevailed).

I didn’t consider that as highly as the outlet adapter since that’s what pushes the amperage and wattage, but thanks, I’ll definitely be investigating that next!

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

#99
post #15

I've heard talks of the toll tag companies wanting to be able to detect occupants in a car so they can properly charge the correct amount of fees when the occupancy changes the amount. I never looked into how that might happen, but I'm guessing Bluetooth would not be a solve here as it's too easy to circumvent if passengers disable bluetooth

Or (shudder) have more or less than the requisite single phone.

Obviously a soccer mom taking her bus load of kids somewhere would ruin the bluetooth use case. I never did hear more about how they would actually do it. I just met someone randomly at a holiday gathering a couple of years ago that said that was something his company was working on. The conversation just didn't allow for follow up.

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

#100
There are some very good frameworks out there for doing things like these:

   - ESPHome
   - Home Assistant
You can a build a device like this, often without writing one line of code, with ESP32 firmware updates over the air from a web UI.

I wish those ESP chips/mini boards had Zigbee. You can get much better connectivity on a Zigbee network than on wifi in a typical deployment, where every mains powered Zigbee device also acts as a router.

Post reply on HN