Building an occupancy sensor with a $5 ESP32 and a serverless DB
matthew.science
matthew.science
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.
Maybe I could mount a BT device at a corner of the outdoor space and use its signal strength as the threshold value.
But using two of the above in different, known locations would allow you to compute the intersection to a 3D location.
UWB in particular is accurate enough to get breathing patterns...
But how often is an accurate count needed? The initial requirement of the project was just for the OP to "avoid crowds in the dining hall", and for that all one needs is a general idea of highs and lows.
In your business, do customers expect high accuracy? All of them, or some of them?
Also, regarding MAC address, even if they're randomized, isn't there a way to know what kind of device it is? (to count only phones for example, and discard headphones, etc.)
Just letting you know of one of your potential competitors.
> 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.
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.
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.
I switched to the official Pi PSU after someone said "trust me on this" online, and yep, zero issues in all the years since.
Is this something you can eyeball to guess at quality?
I find that happens fairly frequently unfortunately, and haven't managed to track down the cause.
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 haven't had major issues with ESP devices but I try to keep them on <30cm cables of decent quality and ensure they're shielded. Though I haven't tested experimentally, I'd expect low quality, poorly shielded cables to have some effect on the signal quality.
At the moment, I'm looking for a way to make my storage more resilient on a Pi I'm using to host Hashicorp Vault, for secrets in Filesystem mode.
First I looked at high-resilience SD cards, but I don't really want them stored on the OS card anyway, also considered just getting a high-quality USB stick and mounting the secrets storage to that; It sounds like a combination of one of these (or perhaps another, similar option) alongside Alpine to reduce writes to the OS SD could be the ticket.
I have a couple of Pis on my network edge running things like WireGuard, with the root mounted read-only to try and help with the issue of SD card resilience; I've killed dozens upon dozens of SD cards in Pis over the years.
Some of them perform multiple tasks, e.g. one of them is Bluetooth proxy in my home office, but it also runs the light strip along my Skadis wall boards.
I'm using some random brand ones from a company called "AZDelivery" on Amazon.
I haven't done anything special to them; they sit in 3D printed cases, and are plugged in with relatively short cables (usually <30cm where outlets allow) into at least 5V/1A adapters.
(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 them sooner.)
There might also be campus IT privacy&security policies that apply. Of course people are getting violated much harder by ordinary Web sites, apps, and IoT devices, but sometimes universities aspire to be better than the outer world.
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 of, is a correlation between poor air quality in my home and the arrival of these Bluetooth devices in the area.
> 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
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.
Maybe that's true for those devices, but it doesn't protect you if your apps are tracking beacons as you encounter them in the wild. Your mac changing doesn't change that it saw a beacon somewhere, and attached that to your account in the app you're signed in.
Turns out, that's exactly what they do...
> But these apps may also be tracking you in less obvious ways. As the New York Times noted last June, many retailers deploy Bluetooth “beacons” throughout stores. If you have the store’s app installed on your device, the beacons send it signals. The app then knows where in the store you are and sends you information (like coupons or store maps) specific to that location. *But this also means the app can track your movements as you pass by the beacons. Depending on where and how the beacons are placed, your location can be measured in inches.* Some device manufacturers have wised up to this practice; for instance, the iPhone’s newest operating system requires apps to get your permission to use Bluetooth.
https://www.vox.com/recode/2019/12/19/21011527/retail-tracki...
> Retailers can send that data to services like LiveRamp to match it with your online identity
But I think the point made in GP is tracking people, although indirectly, could qualify as `human subject research`, the same technical category as Stanford prison experiment, MKULTRA project, standard website A/B testing, etc. I don't think it's going to be a problem per se, but can be an opportunity to discuss and learn about ethics and processes.
This line got me laughing! My nerd brain has tried so many times to convince me to splurge money with this exact line!
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!
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..
I was talking to my wife about this over dinner the other day. At one point, early after the kids came along, this really bothered me, not being able to do my projects/hobbies, but I came to a realisation, once things had settled down a bit.
Even though I _want_ to do these things, I want to spend time with my kids, my family, more, and these other things are inconsequential whether they happen or not.
I'm never likely to look back and think "I regret not building X with an ESP32", and I don't intend to look back and wish I'd spent more time with my kids, they grow up quick.
Don't get me wrong, I still find time for hobbies, and little projects; much less so than I did, but now I just find I need/want to spend less of my time building/tinkering with things that no longer have the same value to me that they used to, my brain is slowly catching up with that realisation.
I once read that about 80% of the whole time you spent together with your children is spent before they are 10 years old. So your are right when you say your want to spent the time with your children now.
One added benefit I discovered afterwards is that even though the AP is not between me and the ESP, I seem to reflect enough RF so that logging the RSSI provides information not only about when I'm in the bed, but also when I change position at night.
https://imgur.com/a/VixOlu5 (edit: no erotic content despite the warning)
The green one in the middle is the RSSI, the yellow at the bottom the PIR sensor, the top one a mix of the data from my Mi Band 3 plus an annotation of when I was in bed (yes I did spend a lot of time reading news before falling asleep and before getting up)
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 rather than fiddle around with stuff.
I wanted something simple and cheap and now I need to go deal with this whole other thing I don't know much about and either rent or buy into it?
The next best option is injection molding with PCBWay (or other similar provider): https://www.pcbway.com/rapid-prototyping/manufacture/?type=4...
An alternative is a sheet metal enclosure: https://www.pcbway.com/rapid-prototyping/manufacture/?type=4...
But 3d printing with JLCPCB is really the most convenient way unless you need a lot of parts (thousands) or the material properties of the UV resins would not be enough (high-temperature, outdoors, etc).
There's a lot of files running around with existing models for common projects, so you probably don't need to design your own enclosures a lot of the time unless you want to.
And printers have gotten cheap, like $99 gets you a jumping off point into the hobby.
The board in the article is $13.49 ( https://www.amazon.com/dp/B072HBW53G ). If you could get an enclosed, complete thing for $20, including the board and whatever you need for it to run, that'd be much less of a PITA than "brand new hobby" or "find someone to 3D print stuff for me locally and deal with that whole hassle".
solving something would be like $700 calibrated out of the box, like the old prusa 3 something or the bambu p1something.
Nothing about making a nice presentation is beyond what amateurs can do. However it is a lot more effort and so most decide it isn't worth it.
But once you have it and know how to maintain it, anything where you’re like “man wouldn’t it be nice if I had a physical object like X” becomes a relatively solvable problem. There are lot of materials with many different properties. When you skip into a zone of material or print you can’t afford the equipment for, there are a bazillion print shops.
The harder skill frankly is the 3d modeling. But I find openscad is sufficient for almost everything and then for the rest I use Build123. They’re both parametric code driven design tools so fit well inside a software project (better than GUI tools, and more easy to be precise with). Openscad is absurdly easy, build123 is more advanced and requires Python skills as well as effort to learn the conceptual model.
I sort of felt the way you seem to once upon a time until I said screw it and figured it out one day. Now I feel like I lived most my life hobbled for want of this tool.
So, yeah, overkill for printing an esp32 enclosure. But doing so unlocks a lifetime of possibilities.
https://www.amazon.com/s?k=esp32+enclosure
If you want to sell a more finished commercial quality project and don't want to print your own, there are places that will fabricate one for you (but in low quantities, having them 3d print it probably cheaper)
If you take the time to make the holes nicely, the result often looks good enough that non-makers will think you are a god of manufacturing.
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 circuit board and case to fit each other, and so on. Then you buy the ESP32 chips in bulk and assemble them onto the circuit board. The board you buy for a prototype is officially only a reference board and not what they expect you to ship (though shipping the board is common: they are small, cheap, and someone else did the hard board design)
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.
Altoids box is a classic. Food plastic boxes also works depending how hot the components run.
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.
I don't work for them, I just really like their products and own about 10 of them. Downside, the documentation is rudimentary so you should enjoy steep learning curves (but not too steep - The ESP-IDF and MicroPython docs will get you through most problems).
So what I do is I usually look around what everyday objects could become nice enclosures for microcontrollers and such things.
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
morphle@ziggo.nl if you want me to design it
Jokes aside, if you know how to design a custom chip for 3k USD, I would like to know about it.
Designing one for $3K is possible because I already have a tested chip design that I just have to modify for you.
A master student project is usually a free design with a free tapeout at Google MPW, Mosys of Europractice.
I also design bigger chips and $500 wafer scale integration with 10000 cores : https://vimeo.com/731037615
I have to say you are hurting yourself with your communication style, because it comes off as very dismissive and arrogant. I bookmarked your presentation in case I need it in the future, but a 4 hour video is not a great way to hook people who are not sure if they are interested or not.
In some cases, you may luck out and find that a widely available dev board is actually a really good match for your needs, in which case, run with it. You'll cut out a lot of NRE and get your product in customers hands faster. Once you've shown that you can sell in volume, do a DFM pass for V2 to minimize cost. OP probably fits this case, as all they need is Wi-Fi and Bluetooth, depending on their eventual power solution.
If you find that you're taking a dev board and soldering a lot of extra components to it, then I agree, you want to move to a custom PCB before doing any real volume. But you still might make a dozen first cuts with this and a 3d printed case to see how some product beta testers respond.
Using an off the shelf MCU and off the shelf sensors saves you all those headaches.
Also, ESP32 is not a "pcb".
Then, you reach out to local manufacturers and ones from bigger markets. You get some samples, you check if things work like they should. If you like it, order a smaller batch. Design a quality assurance workflow, or find a specialist who can help you with that so that the manufacturer doesn't ship you 20% faulty products.
Get your products onto the shelves of a brick and mortar store, and/or create a website, sell on Amazon and other portals.
Talk to your customers, listen to their feedback, improve every step a little.
It sounds overwhelming.
I worked for a small smart home startup, and I learned that, for example, in Shenzhen, there is a whole industry ready to help entrepreneurs realize their dream products, and at every step of the way, you can contract someone to help you. In our experience, the Chinese service was both much better, cheaper, faster than European offers.
Plus, woodworking is very satisfying by itself. And also easy to get started with - for small box-like things like this you only need a few cheap hand tools.
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
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).
https://www.espressif.com/en/products/socs/esp32
The ESP32 is a SoC. It's available in QFN packaging (Quad Flat Pak No Lead).
The ESP32 is available included with a number of "modules" (and of course devkits). These modules are designed for production use and it can be economical to do so. You clearly don't have the foggiest idea about these product lines so don't seem to be in a good position to comment on the economics.
https://electronupdate.blogspot.com/2018/08/espressif-esp32-...
I use a tupperware container if I'm feeling fancy.
https://www.hammfg.com/ https://www.budind.com/ http://takachi-enclosure.com/ https://www.adafruit.com/product/903
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.
It took me about 20hr to learn how to use Fusion360 and make a simple circuit and case this way.
If you've got a 3d printer, you make a 3d print.
If you're more of a acrylic guy, then you take your laser-cutter, cut out some shapes, drill a few holes and bam you've got a box.
If you got none of these and just want a bare-necessities box, you use an Altoids Tin that costs about $25 for 12 tins... and they have these kinda useless mints in them though. So you buy those boxes, then you throw away the mints and shove your project in there.
If you want slightly better than the Altoids tin, you buy a Hammon Enclosure. (https://www.hammfg.com/electronics/small-case).
If you're like me, you wrap it in electrical tape, and then wrap that in duct tape or something. Maybe color on it with permanent marker.
example: https://www.printables.com/model/72839-stable-and-waterproof.... If I am using screw terminals, wires are terminated with ferrules.
For some projects that use 120V AC directly, I've purchased nice receptacle with fuse, and grounded the metal casing. But I don't feel comfortable distributing those.
I have also been known to encase an entire project in clear epoxy (the first "maker" project I did, thanks to an enlightened shop teacher in the 1980s, was a nightlight using only 3 components, encased in epoxy; they work some 35 years later!)
Some things I can think of to go further: designing my own PCB instead of using perma-proto. FInding better temporary connectors (duponts are not reliable). Eliminating the ESP32, replacing it with simpler logic circuits when possible.
I didn't totally follow the issues with keeping the data in memory, and it sounds like it is solved now - but you could probably use a cardinality estimation algorithm to estimate the number of unique beacon IDs while only using constant space. https://en.wikipedia.org/wiki/Count-distinct_problem
Side note: Definitely one of my favorite parts of this project, that I get to investigate more in-depth and interesting CS concepts without having to worry about doing the easiest solution. I’m scratching an itch, not developing a solution to deliver ASAP.
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.
https://github.com/home-assistant/core/blob/dev/homeassistan...
https://www.home-assistant.io/integrations/bluetooth_tracker...
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.
Also, ESP32 Rx sensitivity is kinda poor: -94 dBm, most devices are pushing -100, -102 and even -104 dBm. Makes a big difference.
It is more designed to figure out which room you are in.
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.
I wonder How well can your DIY sensor or OccuSpace figure out what kind of devices are in the room or who's using them. Can they tell different users or gadgets apart?
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+ at a distance of maybe 20 to 100 yards.
Mount this with a usb cable somewhere, add an ESP32 or anything with Bluetooth somewhere else to accumulate.
- 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.
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.
I recently worked on a similar side project but took a very different approach. It pretty much was just:
1. A bash script in a Raspberry Pi W that ran `bluetoothctl` once per minute and wrote the raw output for that minute to a file.
2. A systemd process that would ensure the script would get re-run if the process crashed or machine rebooted
3. A separate script that parsed the logs and pushed them to a local sqlite DB that tracked the minute the bluetooth id was found.
4. A daily push to my backup server that stored the sqlite DB
I decided to use systemd and a simple(10loc) bash script since I faced a similar issue to the OP where my pi would crash(although it was purely my fault for messing with a bunch of cables) and I wanted a way to get it running again with the lowest overhead. I also wanted as few dependencies as possible.
I went with SQLite because it made querying for trends and building dashboards simpler and more interesting(and because the real project was the sqlite interface I was building :) )
One thing I learned from running this which also may answer a couple of OPs questions: Apple devices like hiding themselves. The only way I could get my Apple laptops and phones to show up was to keep the bluetooth settings menu open on them. Otherwise, they wouldn't appear to the bluetooth scanner. I can't speak much to whether android devices are 'noisier', but the lack of bluetooth feeds for Apple devices alone cuts out a significant part of the value of bluetooth scanning for crowd sensing, given the market share for Apple devices.
I have a problem where I will need to monitor the soil moisture of 20 trees in San Francisco. My current thought is to strap an ESP32, Lora module, battery, and capacitive soil moisture sensor and to send data once every 6 hours or so.
I was wondering if off the cuff you have any suggestions or pointers on how to best approach this. Thanks and once again, thank you for sharing this!
In either case, you can put them in a deep sleep that uses minuscule amounts of energy and can wake back up on a timer. I’d start there.
Another thought I was having was to write a mobile app that as volunteers walk by the sensor would send data to their phone, which would then forward it to my backend. I suppose this is a mesh network of sorts? Not sure if this is feasible or a good idea though :/
[1] - https://youtu.be/IYuYTfO6iOs?si=oLuJiGxdQ8VHyu29&t=837
You would have a central LoRa receiver in a place that can reach all of the sensors. How far apart are the trees?
Other than that, I would suggest testing out lots of different hardware. I bought several different boards before any decisions were made, and I’m glad I didn’t stick to just one. Costed me maybe $30 to buy a gamut of devices and now I’ve settled on a single one that does what I need.
Also, make sure you’re flashing with the largest image size you can, if your code becomes too large. For me I had to enable an option in the board settings to use the full memory space.
Lastly, one thing you should do is the low power option. See which board supports it the best. Then, what I would do at startup is turn on all the sensors, collect and send data right away, then turn all your sensors off. Do ultra deep sleep for 6 hours. then when it wakes up, don’t bother doing any kind of loop to the beginning - hard reboot. That avoids any problems with memory allocation becoming too large somehow over the course of the program, since it always starts fresh (which is all you need!). I’m not sure the trade off here but for me, I reboot every 12 hours and it works great. (I would do it after every scan but I don’t delay between scans for more constant data, so it would be a lot of set up every single minute).
[1] -- https://www.google.com/maps/d/u/0/viewer?mid=1e7K_VdEEYkxuAy... [2] -- https://www.thethingsnetwork.org/community/san-francisco/
The ESP has a few deep sleep modes, and there's a lot you can do to optimize them.
I highly recommend Andreas Spiess on youtube.
EDIT: Heads up that moisture sensors have reliability issues, Andreas's video 463 talks about them.
Also, great to know that there esp-lora board w/ lipo power included!
Its much better and cheaper to design from scatch, use an $0.04 ultra-low power Arm microcontroller with ADC or a Padauk, add a single layer pcb with two well proportioned pcb traces in a plastic bag as a capacitive moisture censor (better than resistive sensor) and a $0.12 solar cell or rechargable battery. Single sensor cost around $0.41 excluding labor, mass produced $0.08 including labor and sensor network
[1] -- https://zachbellay.com/projects/odaf/#iteration-3-phase-2-wi...
I would get started with an off the shelf MCU with good documentation, writing the software on a good development platform with the same assembly as the final microcontroller. For the $0,04 ARM microcontroller I mentioned above as final target with analog to digital controller (ADC) I would first write the program (the main loop) on a Mac on a high level language like Squeak or Python and use the $4 raspberry pi pico as ADC. I would then rewrite the working software in ARM assembly and test it directly on the pi pico. Then I would flash it on the $0.04 arm microcontroller wired on a breadboard to the moisture sensor. Then I would debug it again, with simple flashing leds to see where your software goes wrong. morphle at ziggo dot nl for more questions like how to find a 4 cent arm chip. I would start at lcsc.com , use their sister company and eda tool to design the pcb only with lcsc.com parts and order it fully assembled. Then I would open source it so others can directly order assembled boards
I would avoid Arduino like the plaque, in essence its just a precanned overpriced bloated C library on an overpriced microcontroller. You always get better results writing from scratch. See 'is it complex or did we make it complicated', a lecture by Alan Kay at Quallcom on Vimeo or Youtube, on designing systems from scratch or buy vendor stuff: https://vimeo.com/82301919
grab that, a pi pico, and some batteries (which should last months they claim), and set up an MQTT for data.
It is pretty expensive at scale. But if you want "no fuss" I think it would do the trick for you.
Way at the bottom: Think this was cool? Hiring software engineering interns for Summer 2024? Check out my resume here: https://docs.google.com/document/d/1EN2k5ZUOLTvMs_NZtUq8tKVK...
> I asked campus IT to whitelist the MAC address
Back at my uni this would have been a multi week endeavour with a number of forms and likely a denial. This was 15 years ago so hopefully things have changed there now.
This should not an issue. It is entirely possible to write this without any dynamic allocation (other than stack) at all, or it could be done be done with an arena. Consider with something as powerful as an esp32 a hash table is not even strictly necessary, surely for a single purpose use case like this.
Regarding the ESP32's reliability, it's likely power supply related. I've seen exactly this before. I run ESP32 devices with a 1A 3v3 linear regulator with a little smoothing, and zero issues.
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.
https://www.eenewseurope.com/en/uwb-human-sensor-uses-impuls...
"Best mmWave Presence Sensors for Home Assistant!" https://www.youtube.com/watch?v=Kt1FpRM8R18
Occupancy based pricing for vehicles seems too hard to enforce anyway, change the pricing scheme to something more practical IMO
Here's a camera based video people counter.[1] This is a bit less intrusive.
Maybe I worry to much about battery usage, but I just got used to always enable WiFi, Bluetooth, or NFC, only at the moment of usage, and disabled afterwards.
I'm more surprised that anyone ever turns it off, battery use is negligible compared to the cellular modem as I browse the web/listen to music.
You do you, but I enjoy talking with my friends and family and I don't see responding to them as "slavery".
Of course if you got a smartwatch you'll want to leave BT enabled to get calls messages and such. At least that's a good reason to leave it on.
To me it sounds like leaving home and keeping WiFi enabled. It eats battery because it's still sending beacons and trying to find some known device to connect to.
though some of the papers I read did this via measuring the time of flight of BT packets and how they were changed when people walked between them, and that really blew my mind!
They've been able to do that long before invasive solutions like this, or computers, even existed --- turnstiles.
There are a few companies offering it as a commercial product, and yes there are people that want to buy it. The value is not just knowing how many people are in a store, but where they are going, what they are spending their time looking at.
I also think I would have implemented presence by TTL, updating the TTL for each MAC when I see it and purging a TTL heap before updating my remote statistics. I didn’t fully grok the approach taken for maintaining the hash map, in a taxi off a long flight, but it didn’t seem super robust on my quick read.
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 easiest to get off the ground with, believe it or not, just because I have experience flashing Arduino boards.
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)
"What espup Installs
...
Espressif Rust fork with support for Espressif targets
... LLVM fork with support for Xtensa targets"
:( ?That said, for my use, it’s entirely transparent this is happening under the covers. Things work as they should in your ESP32 cargo projects as don’t interfere with other targets, and I’ve not found any weird edges. I do however use the c3 boards.
I think the original use case is not to know whether a dining hall is occupied at all but about how occupied it is (and if he should go to lunch now or wait another 20 minutes).