Fix spelling mistakes

This commit is contained in:
Joshua Boniface 2024-04-23 17:00:18 -04:00
parent 18ebb4d59d
commit bdef531589
1 changed files with 11 additions and 11 deletions

View File

@ -14,7 +14,7 @@ weight = 1
I've been interested in voice-based home automation for many years now; in fact, it was [one of the first posts on this blog](/self-hosted-voice-control/). For many years I now I've used it to control the lights in my bedroom, for two major reasons: first, the lights I was using were not hardwired, and I had many of them, and thus many little switches on cords; second, I wanted to be able to switch things on and off from wherever I was - be it my bed, my couch, or just outside the room as I was leaving - without having to fiddle with all those switches.
So I went with [Home Assistant](https://www.home-assistant.io/), then and now the de-facto FLOSS standard for home automation. I bought a few smart plugs, from various manufacturers throughout the years (currently settled very nicely on [Athom ESPHome-based ones](https://www.athom.tech/). And I set up [Kalliope](https://github.com/kalliope-project/kalliope) on a Raspberry Pi to do it. And it did work wonderfully.
So I went with [Home Assistant](https://www.home-assistant.io/), then and now the *de facto* FLOSS standard for home automation. I bought a few smart plugs, from various manufacturers throughout the years (currently settled very nicely on [Athom ESPHome-based ones](https://www.athom.tech/). And I set up [Kalliope](https://github.com/kalliope-project/kalliope) on a Raspberry Pi to do it. And it did work wonderfully.
In the middle of 2023 though, I wanted to expand things a bit. Over the years I had added more smart switches in two other main zones: my garage, where they control an infrared heater, several fans, and several lights; and in my basement, where they control again several fans and lights. So I went looking to buy a few more ReSpeakers and Raspberry Pi's to build out a few more voice control nodes.
@ -24,7 +24,7 @@ But then I checked the Home Assistant blog and boy was I in for a treat!
## The Year of the Voice
The Home Assistant project dubbed 2023 "The Year of the Voice". Their goal was to make voice control the primary focus of their development efforts for the year, and by June 2023 they had made excellent progress, landing one of the most critical features: wake word support. I was immediately intrigued and set about trying to set up an ESP32-based satelite device for Home Assistant. Later in 2023, the support got even better. There's still some flaws - at least, I think they're flaws, though others in the project and community disagree - but I'll discuss those my implementation. The point is, it works, pretty damn well.
The Home Assistant project dubbed 2023 "The Year of the Voice". Their goal was to make voice control the primary focus of their development efforts for the year, and by June 2023 they had made excellent progress, landing one of the most critical features: wake word support. I was immediately intrigued and set about trying to set up an ESP32-based satellite device for Home Assistant. Later in 2023, the support got even better. There's still some flaws - at least, I think they're flaws, though others in the project and community disagree - but I'll discuss those my implementation. The point is, it works, pretty damn well.
After some experimenting, I had a working prototype streaming voice to my Home Assistant instance. And then I got an idea.
@ -36,11 +36,11 @@ Based on the EP1, I wanted the combined sensor to have the following parts:
1. A microphone. This is pretty much a given for the voice control portion, but I had to find a good option. Luckily support for the INMP441 MEMS microphone is pretty good in ESPHome, and these are what I had used in my tests, so it seemed like the most obvious solution. [Amazon search link](https://www.amazon.ca/s?k=INMP441), since the vendors change fast and both of my orders were different from each other and from the currently available stock. About $3.00 CAD each.
2. LEDs for visual feedback. I'm not a big fan of voice systems that "talk back", and I really liked the ReSpeaker's LED-based feedback mechamism. So I wanted to use LEDs for that purpose here. After a few prototypes, I settled on a design with two RGB common-cathode LEDs which could be driven directly from the GPIOs of the ESP32. I tried using a transistor power delivery system but due to some missing knowledge on my part, they didn't work, and I found that the ESP's GPIO pins could easily drive both LEDs without issue so I went with that. [Amazon search link](https://www.amazon.ca/s?k=5mm+RGB+LED+common+cathode), same situation as the INMP441's. About $0.14 CAD each. I also added a ~300Ω resistor to limit current, though I had these lying around so add ~$0.10 CAD to buy these.
2. LEDs for visual feedback. I'm not a big fan of voice systems that "talk back", and I really liked the ReSpeaker's LED-based feedback mechanism. So I wanted to use LEDs for that purpose here. After a few prototypes, I settled on a design with two RGB common-cathode LEDs which could be driven directly from the GPIOs of the ESP32. I tried using a transistor power delivery system but due to some missing knowledge on my part, they didn't work, and I found that the ESP's GPIO pins could easily drive both LEDs without issue so I went with that. [Amazon search link](https://www.amazon.ca/s?k=5mm+RGB+LED+common+cathode), same situation as the INMP441's. About $0.14 CAD each. I also added a ~300Ω resistor to limit current, though I had these lying around so add ~$0.10 CAD to buy these.
3. A radar sensor. Millimetre-wave radar is absolutely critical for a presence sensor like this, because it allows continuous tracking without motion. I tried 5 different models, but settled on the HLK LD2510C, since it had the best combination of features, configurability, and ESPHome support. [AliExpress link](https://www.aliexpress.com/item/1005006000579211.html) though ensure you select the "LD2410C-P" out of the options. About $5.27 CAD each (including shipping).
4. A PIR sensor. PIR comes in very handy for detecting quick motion, and as a backup both for and against the Radar for initial presence detection. I tried a few options but the SR602 ended up being both the cheapest, nicest form factor, and also best performing of the various options I tried. [AliExpress link](https://www.aliexpress.com/item/1005001572550300.html) but I did replace the fresnel cover with a cover from [a different sensor](https://www.aliexpress.com/item/1005004518651850.html) that looked nicer and seemed to perform a little better because I had them. About $2.37 CAD each, plus $0.90 CAD each for 10 of the alternates for their covers (including shipping).
4. A PIR sensor. PIR comes in very handy for detecting quick motion, and as a backup both for and against the Radar for initial presence detection. I tried a few options but the SR602 ended up being both the cheapest, nicest form factor, and also best performing of the various options I tried. [AliExpress link](https://www.aliexpress.com/item/1005001572550300.html) but I did replace the Fresnel cover with a cover from [a different sensor](https://www.aliexpress.com/item/1005004518651850.html) that looked nicer and seemed to perform a little better because I had them. About $2.37 CAD each, plus $0.90 CAD each for 10 of the alternates for their covers (including shipping).
5. A light sensor. While the LD2410C does have "light detection" capabilities, it doesn't actually expose this in a useful way. I wanted a separate light sensor for two main reasons: first, it allows more granular control (e.g. trigger only with presence + lights) for things that are not themselves lights, or for lights in a room with natural light; and second, it can be useful to know how bright the room is for other automations. I originally went with the VEML7700 sensor, but at the time its ESPHome support was subpar, requiring an external custom module that was deprecated. While it is a bit more pricey, I wanted a reliable unit with good ESPHome support, so I went instead with the TSL2591 for the final version. One upside here is that it is able to track infrared light separately from visible light, and though I haven't found an actual use for this yet myself, it might come in handy for someone. [AliExpress link](https://www.aliexpress.com/item/1005005514391429.html). About $6.02 CAD each (including shipping).
@ -54,21 +54,21 @@ All together, to build one sensor the non-board parts cost about $36.39 CAD incl
## Part Two: Designing a Board
Of course, just stringing the parts together wouldn't look very nice or fit very well on a wall, so I designed a custom PCB to integrate all the components using the EasyEDA online builder. I went through two prototype designs before finally settling on a final design that I'm quite happy with. This design sits in a horizontal orientation with the power cord exiting the right side (when facing the unit), which suited all my planned installation points nicely. This could also be used as a guide to create a verticial or flipped horizontal orientation should one so choose. The design is open source (GPLv3 along with the following ESPHome code) and is avaliable in [the Git repository](https://github.com/joshuaboniface/supersensor/tree/master/board) in both DXF and EasyEDA JSON formats. Note that all pictures are of my second prototype and the final design does fix a few flaws I had with it such as removing some unneeded transistor elements and improving a couple traces.
Of course, just stringing the parts together wouldn't look very nice or fit very well on a wall, so I designed a custom PCB to integrate all the components using the EasyEDA online builder. I went through two prototype designs before finally settling on a final design that I'm quite happy with. This design sits in a horizontal orientation with the power cord exiting the right side (when facing the unit), which suited all my planned installation points nicely. This could also be used as a guide to create a vertical or flipped horizontal orientation should one so choose. The design is open source (GPLv3 along with the following ESPHome code) and is available in [the Git repository](https://github.com/joshuaboniface/supersensor/tree/master/board) in both DXF and EasyEDA JSON formats. Note that all pictures are of my second prototype and the final design does fix a few flaws I had with it such as removing some unneeded transistor elements and improving a couple traces.
The final result with black silk screening looks fantastic to me, and I love the way the different colours of the individual components are highlighted, as well as hiding the ESP32 behind the unit. In fact, I liked this apperance so much that I abandoned my original plan of designing a case, in favour of the bare board. While this might not suit everyone, I like it in my home, and building a case shouldn't be too hard based on the board dimensions.
The final result with black silk screening looks fantastic to me, and I love the way the different colours of the individual components are highlighted, as well as hiding the ESP32 behind the unit. In fact, I liked this appearance so much that I abandoned my original plan of designing a case, in favour of the bare board. While this might not suit everyone, I like it in my home, and building a case shouldn't be too hard based on the board dimensions.
I was able to order 10 boards for $23.05 CAD shipped, or $2.31 each, bringing the parts total for each Supersensor to $38.70.
I was able to order 10 boards for $23.05 CAD shipped, or $2.31 each, bringing the parts total for each SuperSensor to $38.70.
Assembly was a bit more work, having to solder the various sensors and pin strips to the boards, and took about 30 minutes per sensor once I got going. The result was a sleek unit that could be placed fairly inconspicuously in corners of rooms, and I then used extra-long USB3 cables and stainless steel strapping to hold them up, for a definite DIY look.
## Part Three: The ESPHome Configuration
Lastly, I had to write [the ESPHome configuration to make everything work](https://github.com/joshuaboniface/supersensor). Mostly, this just involved exposing the invididual sensor components, but as I built it I wanted to make this more universal. To that end, I added several configuration options and a full "presence" system.
Lastly, I had to write [the ESPHome configuration to make everything work](https://github.com/joshuaboniface/supersensor). Mostly, this just involved exposing the individual sensor components, but as I built it I wanted to make this more universal. To that end, I added several configuration options and a full "presence" system.
The voice component is pretty straightforward to get working with the sensor, and as long as you have a Home Assistant Assist pipeline working with a speech-to-text and wake word engine going, it should be plug-and-play.
You can select how long a PIR detection is "held" for. This is needed since, unlike most DIY PIR sensors, the SR602 as a fixed ~3 second hold time. This wasn't long enough for me in some situations, so I added a latch timer to output a second template sensor value based on the PIR and the hold time: as long as the sensor fires or continus firing within this time, the result sensor remains active; once the timer expires with no further PIR detections, it will become inactive. Thus you could set the PIR detection between 0 (~3) and 60 seconds, with a default of 15 seconds, a good value for most uses.
You can select how long a PIR detection is "held" for. This is needed since, unlike most DIY PIR sensors, the SR602 as a fixed ~3 second hold time. This wasn't long enough for me in some situations, so I added a latch timer to output a second template sensor value based on the PIR and the hold time: as long as the sensor fires or continues firing within this time, the result sensor remains active; once the timer expires with no further PIR detection, it will become inactive. Thus you could set the PIR detection between 0 (~3) and 60 seconds, with a default of 15 seconds, a good value for most uses.
You can control at what threshold light level "presence" is detected. This is useful to configure the light presence option below based on the actual conditions of the room, the light that falls on the sensor, etc. You can set this anywhere between 0 (always on) and 200 lux, in 5 lux increments, with a default of 30 lux (a decent brightness from a room light).
@ -101,7 +101,7 @@ Here is the blank PCB. As mentioned above this is a prototype board, so while th
![Socketed PCB](/images/supersensor/socketed-pcb.jpg)
As part of testing all the sensors, I made a socketed version. While this makes the unit extremely thick, it might be a good idea to build one of these to test all your sensors before proceeding with the meticulous soldering of all the components to the boards, because desoldering them later is basically impossible (godspeed to the BME680 sensor that did not make it).
As part of testing all the sensors, I made a socketed version. While this makes the unit extremely thick, it might be a good idea to build one of these to test all your sensors before proceeding with the meticulous soldering of all the components to the boards, because de-soldering them later is basically impossible (godspeed to the BME680 sensor that did not make it).
![Completed Board Front](/images/supersensor/front.jpg)
![Completed Board Back](/images/supersensor/back.jpg)
@ -116,7 +116,7 @@ Here is one of the boards in its final mounted location, angled to provide perfe
![Home Assistant Dashboard](/images/supersensor/dashboard.png)
Here is all the information and configuration the SuperSensor provides in Home Assistant. It's quite a lot of information, so in my actual dashboards I usually only show the most relevant parts for that particular usecase, for example:
Here is all the information and configuration the SuperSensor provides in Home Assistant. It's quite a lot of information, so in my actual dashboards I usually only show the most relevant parts for that particular use-case, for example:
![Room Dashboard](/images/supersensor/room.png)