[HN Gopher] Building an occupancy sensor with a $5 ESP32 and a s... ___________________________________________________________________ Building an occupancy sensor with a $5 ESP32 and a serverless DB Author : sodality2 Score : 299 points Date : 2023-11-13 17:17 UTC (5 hours ago) (HTM) web link (matthew.science) (TXT) w3m dump (matthew.science) | filterfiber wrote: | 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. | sodality2 wrote: | 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. | filterfiber wrote: | > 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. | londons_explore wrote: | 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. | sodality2 wrote: | 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! | londons_explore wrote: | I live in a very wifi-busy area (hundreds of networks), | and I suspect that the wifi logic somehow hangs itself | waiting for some packet/message/state which gets lost and | never comes. | sokoloff wrote: | 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). | sodality2 wrote: | 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! | jetbalsa wrote: | I'm a huge fan of using Alpine with the RPi due to reducing | writes to the SDCard. it will only save data to disk with a lbu | commit -d and by default boots into a kind of tempfs. | lesuorac wrote: | > 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. | Animats wrote: | 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 | sodality2 wrote: | 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 | michaelmior wrote: | Just skimming that paper, it doesn't look like they made use | of any kind of fingerprinting. The paper below shows how BLE | devices can be profiled to extract a potentially unique | fingerprint. I don't know how well this would scale to large | numbers of devices, but I'd imagine if you used such a | fingerprint, you could dramatically improve the association | between randomized MAC addresses even if the fingerprint is | not 100% unique. | | https://inria.hal.science/hal-02359914/document | reidjs wrote: | is something like this possible for an outdoor setting like a | beach? | sodality2 wrote: | Definitely, if there's a solar panel and a battery hooked up + | some sort of internet connection. Though I would worry about | durability outdoors, probably needs to be sealed pretty tightly | dylan604 wrote: | 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 | kurthr wrote: | Or (shudder) have more or less than the requisite single phone. | dylan604 wrote: | 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. | HumblyTossed wrote: | Cameras work well for front occupants. They're already being | used to check if commercial drivers are wearing seat belts. | dylan604 wrote: | if a toll tag required me to power it and allow it to record | video of the interior of my car at all times, then FUCK THAT | NONSENSE!!!! even if they had it setup so that the camera was | only turned on briefly by a signal as you approached and then | turned off again as you passed the gates, that's still a hard | no from me. | sodality2 wrote: | That's much worse of an automobile usage case than the ones I | read about (measuring vehicle travel speeds to improve travel | time estimates)! | | Occupancy based pricing for vehicles seems too hard to enforce | anyway, change the pricing scheme to something more practical | IMO | Dowwie wrote: | This would be an interesting way to measure crowds in general-- | in concerts, attending political rallies, attending protests, | etc. A handful of journalists attending an event could spread out | and share their max value. | Smoosh wrote: | This makes me wonder if phone companies would have the ability | to provide figures for mass gatherings. Would they only be able | to count devices on their own network, or do they "see" all | phones in range and then filter out the other-network ones? | SCUSKU wrote: | Awesome write up, I liked how accessible the writing is, as well | as the fun tone. | | 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! | mwint wrote: | Do you need an ESP32 vs an 8266? I believe the 8266's are more | energy efficient. | | 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. | SCUSKU wrote: | I think I am largely MCU agnostic, although preferably | something where I can use Arduino since I am familiar with | that. Good to know that ESP8266 is more energy efficient. I | have seen this video which demonstrates that the ESP8266 can | run off 2 AA batteries for 425 days [1]. | | 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 | sodality2 wrote: | Another option would be LoRa - it's pretty long range. The | problem would be that could add a lot to power usage. | Though 6h should be plenty of time - wake up, send a small | packet, sleep for 6 hours. | | 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). | SCUSKU wrote: | The trees are all pretty close to each other, about 3-4 | city block radius (map of trees [1]). The issue is that | as far as I can tell there is no existing LoraWAN gateway | on The Things Network I can tap into [2], which means I | will have to setup my own gateway. Which is fine, but it | may prove to be difficult to get this onto a tall | building since I am just an apartment dweller. At the | very least I can put the gateway in my apartment window. | | [1] -- https://www.google.com/maps/d/u/0/viewer?mid=1e7K_ | VdEEYkxuAy... [2] -- | https://www.thethingsnetwork.org/community/san-francisco/ | filterfiber wrote: | There are esp-lora boards including lipo power management you | can start with. | | 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. | SCUSKU wrote: | So my thought was to utilize the capacitive soil moisture | sensor and then coat the sides of the PCB with a | waterproofing epoxy as Andreas recommended. My hope being | that even if it craps out, I can just swap out the sensor, | and since they are so cheap it won't be a big deal. | | Also, great to know that there esp-lora board w/ lipo power | included! | morphle wrote: | If it is only 20 trees, you could use off the shelf sensors. | | 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 | SCUSKU wrote: | That's a great point. I have experience w/ Arduino and have | made a carrier board one time [1], but am not familiar with | full custom PCB + MCU designs. Do you have any suggestions on | where to get started for someone with my medium level of | experience here? And also, how difficult would you anticipate | a custom MCU to be? | | [1] -- https://zachbellay.com/projects/odaf/#iteration-3-phas | e-2-wi... | morphle wrote: | A custom MCU+pcb is at least 3 months work: downloading an | design for an FPGA, testing it, using openlane to make an | custom chip, taping it out, writting boot code and the main | loop ( I would do that in assembly, much simpler than using | C and some vendors library). The big issue is taping it out | to a chip FAB, around $25K, see my comment below. | | 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 | morphle wrote: | I designed my own chip for EUR,03 , a 180nm 8 core | microcontroller with builtin moisture and other sensors. | Minimal volume is 800.000 chips. | Kevin09210 wrote: | check this out | | https://dynamax.com/products | antoniuschan99 wrote: | Either a dfrobot: https://www.dfrobot.com/product-1385.html or | M5Stack: https://shop.m5stack.com/products/earth-sensor-unit | https://shop.m5stack.com/products/watering-unit-with-mositur... | chasd00 wrote: | look at Adafruit's Feather line up. they have lipo support + | charging and then an easy connector to use for i2c which you'll | probably be using to interface to the sensor. You can probably | find one with Lora included. | mariocesar wrote: | Interesting DIY project! It reminds me of a startup called | OccuSpace (https://occuspace.io/), which offers a similar | occupancy solution but as a service. They may be leveraging | similar technologies to provide real-time occupancy data, which | is incredibly useful for managing space in offices, public | venues, etc. It's a good example of how these concepts are | scaling up commercially. | | 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? | me_again wrote: | Cool! | | 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 | sodality2 wrote: | That's a really good point. I've been meaning to go to a | football game recently and bring it, to stress test it with the | largest gathering I can quickly access. If it can easily scan a | couple thousand without a sweat, I'd consider it pretty solid | anyway. But a fixed-size estimating data structure would be | really cool to research. I will surely look into it, thank you | for the suggestion! | | 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. | lormayna wrote: | Can you use the variation of RSSI to track movement? I know thst | it's multipath and cannot be really reliable, but maybe it can | provide some useful information. Or maybe using 2 tracking | devices and correlate the results. | sodality2 wrote: | Instead of triangulation like that, which could get real | complicated, you could also simply place enough in the areas | you're counting and limit the RSSI cut-off enough to measure | those right next to it. That would work for specific areas you | want to measure trends in, instead of general 3d spatial | triangulation. | | 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! | fullstop wrote: | ESPresence [1] is an interesting project, and it works with the | ESP32-C3. | | It is more designed to figure out which room you are in. | | 1. https://espresense.com/ | summm wrote: | Theres this using ESP32 and LoRa, where you can order readymade | hardware: https://cyberman54.github.io/ESP32-Paxcounter/ | Havoc wrote: | You can also get pretty check 24ghz radar that does reliable | sensing till like 3m. Much much more accurate than the IR based | stuff | epcoa wrote: | > and heap thrashing since we're allocating and deallocating the | result structure every single callback. | | 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. | sodality2 wrote: | I figure the internal data structure that already exists in the | BT library probably uses something similar to a hash table, so | I emulated it with less of the data being saved (just a MAC). | You're right though, there are smaller choices for data | structures. I ended up upgrading to a better board with more | memory, and just used the existing structure in the BT library. | It fixed a number of other problems at the same time. | davidw wrote: | 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 rather than | fiddle around with stuff. | lostapathy wrote: | 3d printed enclosure? | davidw wrote: | That sounds like one of those "I have a problem... now I have | two problems" jokes. | | 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? | krasin wrote: | JLCPCB would 3d print high-quality enclosures from a | variety of UV resins: https://3d.jlcpcb.com/ and decently | cheap. | | 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). | Zetobal wrote: | You can also pay someone to do it. | lostapathy wrote: | As somebody else mentioned, you can hire it out. | | 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. | davidw wrote: | Do people not just sell like "complete package" things? | | 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". | kps wrote: | There are things like M5Stack (also ESP32-based) that | suit some purposes. | davidw wrote: | Yes! That looks pretty cool and more like what I'm | talking about. | kube-system wrote: | The thing about enclosures is that they are pretty design | dependent. Nobody knows what you are hooking up to your | board or what the intended purpose is. Some boards do | have generic type cases, e.g. raspberry pi cases. | szundi wrote: | $99 is just enough to jump into the hobby of fixing your | printer all the time - and that's what hobbyists are | actually looking for | | solving something would be like $700 calibrated out of | the box, like the old prusa 3 something or the bambu | p1something. | lostapathy wrote: | I'm well aware. I think of the $99 printer as a filter - | either it's going to catch your interest enough to | justify jumping to a $600+ printer, or 3d printing isn't | for you and you aren't out much. | bluGill wrote: | That is why so many amateur projects look ugly: making a | pretty package is a whole new skill set. 3d printing is the | easiest acceptable solution, but it isn't the best. Best | would be a custom designed injection molded housing, but | that is even more work to design. | | 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. | davidw wrote: | I don't care if it's "beautiful" or ultra-compact or | looks as nice as some Apple device. All I want is to buy | one thing without wires and an exposed board. | fnordpiglet wrote: | There are plenty of enclosures available on AliExpress and | Amazon. But a cheap reprap 3d printer is a general tool | like a screw driver or hammer, albeit more complex for | sure. But the learning curve isn't absurd, it's basically | buying something plugging it in and loading filament then | printing a downloaded STL. It gets harder when it needs | calibration and maintaining, but it's not an unknown dark | art - there are a billion helpful discord groups. | | 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. | Johnny555 wrote: | If you're looking for an enclosure for your hobby ESP32 | project, there are lots of off the shelf, small enclosures | available: | | 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) | bluGill wrote: | 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 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) | davidw wrote: | 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. | qwertox wrote: | I just buy new small breadboards and jumper wires and make | it so that it looks nice. Jumper wires of the proper | length, not jumper cables. | amenghra wrote: | You can buy project boxes. Some of them come with | breadboards/perfboard that properly fit with screws (e.g. h | ttps://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. | XorNot wrote: | 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. | HeyLaughingBoy wrote: | 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. | mikub wrote: | I look if if I can find some already assembled things and try | to build an project around it. For example I used an | pictureframe to build a nice neopixel thing, I also documented | it on my website, https://mikub.me/post/(1)/ | | So what I do is I usually look around what everyday objects | could become nice enclosures for microcontrollers and such | things. | morphle wrote: | You shouldn't productise anything with ESP32, its just an | overprized bloated hobby pcb. | | 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 | chpatrick wrote: | There are thousands of ESP32-based IoT devices on AliExpress | that would disagree with you. It's an SoC chip not a "pcb". | morphle wrote: | As others point out: you could hire someone to do it. Based | on my custom 1 cent ASIC (custom chip) I would design, test | and build your (moisture or other) sensor for EUR3000 | excluding tax and price of all the needed tools. Usually more | like $6000 because they want to outsource all the problems | (like mass production and sales) to me | | morphle@ziggo.nl if you want me to design it | szundi wrote: | Mine would be 0.3 cent per chip and would need $50k | investment. | | Jokes aside, if you know how to design a custom chip for 3k | USD, I would like to know about it. | morphle wrote: | it is not a joke, you can do as low as 1.10870 cent per | custom chip or 2 cent per off the shelf chip. 0.03 cent | is impossible, the minimum size of a chip is .625 mm2 and | that sets the minimum price. | | 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 | morphle wrote: | if you like to know more about it: morphle at ziggo dot | nl to make a video conf appointment and get a demo. Or | ask email questions, but that takes more effort for us | both. | serial_dev wrote: | You get a "product designer" (?) who designs a case. If your | product is "standard enough", you might skip this step. | | 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. | greggsy wrote: | Smaller dev boards and shrink wrap. | _jal wrote: | I like wood. It is pretty much everything you want for | something like this - super durable, very easy to work with, | and depending on what you pick, cheap and pretty, too. | | 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. | morphle wrote: | 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 | AnotherGoodName wrote: | 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). | morphle wrote: | 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 | k0k0 wrote: | You're absolutely wrong on a number of points. A SoC | stands for "system on a chip", it refers to a single die | (if you want to get pedantic, there are multi-die | packages but this does not apply here) package, a "bare | chip" if you will. | | 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://en.wikipedia.org/wiki/ESP32 | morphle wrote: | You should call the company, order a few million units, | negotiate and sign their NDA and then they will tell you | it is not a single bare die | k0k0 wrote: | Why would you need to sign an NDA? There are decaps | readily available. Most ESP32 models have a separate die | for the flash memory, but everything but the flash (that | is uC, WiFi, BLE, and peripherals) is on a single die, | which sounds like a SoC to me (The definition of SoC | devices have always included devices with off-die RAM and | Flash). These aren't "a bunch of components on printed | circuit boards" as you initially claimed. | | https://electronupdate.blogspot.com/2018/08/espressif- | esp32-... | HeyLaughingBoy wrote: | 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. | mkingston wrote: | 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. | boustrophedon wrote: | There are a lot of companies that make electronics enclosures. | Some of them are waterproof. Usually they have a couple pre- | drilled mounting flanges to screw in the board as well, and | then you'd drill your own external holes for input/output as | necessary. Here's a couple manufacturers, and you can usually | find stuff on e.g. adafruit and digikey as well to save on | shipping if you're buying dev boards or other parts from them | already. | | https://www.hammfg.com/ https://www.budind.com/ http://takachi- | enclosure.com/ https://www.adafruit.com/product/903 | HeyLaughingBoy wrote: | 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. | davidw wrote: | 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. | jpcfl wrote: | You can design both a circuit board and a case with Fusion360, | which is free for personal use. Use JLCPCB to assemble the | board for you. You can 3D print the case yourself. | | It took me about 20hr to learn how to use Fusion360 and make a | simple circuit and case this way. | martinsnow wrote: | Usually a black abs box will do | barkingcat wrote: | I like the inclusion of the bibliography. I should do that with | all my blog posts too (even if it's links to other posts, etc, | the references still help to understand the post) | post_break wrote: | This paired with a TPMS scanner would be great for occupancy for | the entire campus. Scan the TPMS at the major traffic zones, then | compare with bluetooth signatures. | fnordpiglet wrote: | 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 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. | sodality2 wrote: | 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 easiest to get off the ground with, believe it or not, | just because I have experience flashing Arduino boards. | j1elo wrote: | Always surprised to see people running around with their | Bluetooth needlessly enabled. | | 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. | szundi wrote: | Google/Apple obfuscating these mac addresses do not help | anymore? | ThrowAway1922A wrote: | I have a smartwatch and airpods, turning off Bluetooth would | cause both not to work. | | 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. | landemva wrote: | I use Bluetooth maybe once or twice a year because I don't | want to be tracked everwhere. Wired headphones. Phone in | airplane mode much of the day. I suppose I am a privacy | outlier, and I'm also not a slave responding to calls/texts. | greggsy wrote: | I feel like you're an extreme outlier. It's not at all | surprising, given the convenience in a range of modern day | activities like driving a car, listening to music, being in a | workplace, or simply being at home. | gyf304 wrote: | Did something very similar years ago - | https://blog.yifangu.com/tag/library-occupancy-project/ | qwertox wrote: | 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 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) | picture wrote: | What was your stack like for data collection and visualization? | caycep wrote: | applications for cities w/ housing availability issues and vacant | "investor properties" to apply/enforce a vacancy tax? | neilv wrote: | 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 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. | sodality2 wrote: | Yep, I'm talking to a professor about exactly this. Didn't want | to include that in case it doesn't work out though! | UncleEntity wrote: | 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. | raajg wrote: | > 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! | H8crilA wrote: | 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. | sodality2 wrote: | 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! | martinsnow wrote: | 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. | hmottestad wrote: | Ultra wide band can be used to detect tiny movements of humans in | a room. It can detect a finger twitching from several meters | away. | | https://www.eenewseurope.com/en/uwb-human-sensor-uses-impuls... ___________________________________________________________________ (page generated 2023-11-13 23:00 UTC)