Live data from Hacker News

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

matthew.science

111–120 of 221 posts

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

#111
post #52
post #49

Earlier quoted context omitted.

There are lots of options. Most of what you see they don't: this is a one off project for the hacker and if others find it useful great, but not the goal. As such packaging isn't needed, sometimes you shove it in a box. If you want something nice, that can be done, now you need to pay someone (could be yourself!) to design a package. ESP32 is designed to be easy to put into your own products, this means design a circ…

I'm not really talking about producing something at scale, just the bare minimum of not having a board with wires coming out of it. Say I want to do some one-off project and put it outside somewhere, out of the weather, with some batteries to power it. Or an indoor thing with an AC hookup of some kind. Doesn't have to be perfect or beautiful or as tiny as possible; just sort of a complete package.

I mentioned M5Stack above. An alternative is to buy an off the shelf display, e.g., from Polycase -- an outfit I've used a lot and mount your board inside.

There are literally tens of thousands of off the shelf electronics enclosures for every likely possibility. From massive control panel boxes measured in multiple feet, to watch-sized enclosures with straps for items designed to be worn on your wrist. You'll find something suitable no matter what.

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

#112
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

Not everything is going to be sold @ qty 100,000. I deal with the other end of the spectrum: 1 unit to maybe 25/year. At those quantities, speed of development and assembly is the most important criteria. Unit price is not.

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

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

Yep, I’m talking to a professor about exactly this. Didn’t want to include that in case it doesn’t work out though!

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

#114

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…

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.

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

#115
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 am a huge fan of M5Stack. Take a look at the Tough or Core units. You get an ESP32 with couple of peripherals (speaker, buzzer, real-time clock) and a TFT touchscreen all in a case. Water-resistant in the case of the M5Stack Tough. I've shipped a couple of consulting products based on them and it really cuts down on the work I need to do in order to build product.

That's exactly the kind of thing I'm talking about. You could take those and plug them together and be basically ready to go, rather than "just" investing in a bunch of 3D printing and soldering and lord only knows what else. Maybe it costs a bit more, but that's fine - you get something that you can use somewhere besides sitting on your desk with a bunch of exposed wires.

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

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

What was your stack like for data collection and visualization?

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

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

Usually a black abs box will do

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

#118
post #52

Earlier quoted context omitted.

I'm not really talking about producing something at scale, just the bare minimum of not having a board with wires coming out of it. Say I want to do some one-off project and put it outside somewhere, out of the weather, with some batteries to power it. Or an indoor thing with an AC hookup of some kind. Doesn't have to be perfect or beautiful or as tiny as possible; just sort of a complete package.

You can buy project boxes. Some of them come with breadboards/perfboard that properly fit with screws (e.g. https://discountbloc.ru/archive/products/xwzz1130z33x.html ). Alternative is to 3D print a box. Altoids box is a classic. Food plastic boxes also works depending how hot the components run.

AliExpress has a number of companies selling the "generic black rectangle" that looks a bit like an Apple TV now. I've been meaning to buy a couple and see what they're like to work with, because that's the overall effect I really want - something that looks like a router or generic company product.

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

#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 more complex features, as well.

Q: How accurate is BLE beacon availability time, as a proxy for dwell time?

A: We don't believe it is very accurate given that BT MAC's randomize every 8-20 mins depending on manufacturer.

Q: Can we improve the accuracy by setting an RSSI minimum, for which devices weaker than it do not count, to ensure only those who are really nearby get counted?

A: That's a great idea. It's worth noting that different types of spaces and depending on where you installed your sensor, will have different threshold levels.

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

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

What was your stack like for data collection and visualization?

Ditto! I’d also love to know what is being used for the visualizations.
Post reply on HN