diff --git a/src/assets/images/dehumid/alert.png b/src/assets/images/dehumid/alert.png new file mode 100644 index 0000000..5a7bc6c Binary files /dev/null and b/src/assets/images/dehumid/alert.png differ diff --git a/src/assets/images/dehumid/beetle.jpg b/src/assets/images/dehumid/beetle.jpg new file mode 100644 index 0000000..287e710 Binary files /dev/null and b/src/assets/images/dehumid/beetle.jpg differ diff --git a/src/assets/images/dehumid/circuit.svg b/src/assets/images/dehumid/circuit.svg new file mode 100644 index 0000000..85788b8 --- /dev/null +++ b/src/assets/images/dehumid/circuit.svg @@ -0,0 +1,87 @@ + + + + + + power + full + 5v regulator + + + + + + M + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +9V + + 0V + + +5V + + + + + + + \ No newline at end of file diff --git a/src/assets/images/dehumid/closeup.jpg b/src/assets/images/dehumid/closeup.jpg new file mode 100644 index 0000000..6c559d5 Binary files /dev/null and b/src/assets/images/dehumid/closeup.jpg differ diff --git a/src/assets/images/dehumid/dehumid.jpg b/src/assets/images/dehumid/dehumid.jpg new file mode 100644 index 0000000..7e370d9 Binary files /dev/null and b/src/assets/images/dehumid/dehumid.jpg differ diff --git a/src/assets/images/dehumid/has.png b/src/assets/images/dehumid/has.png new file mode 100644 index 0000000..76091e3 Binary files /dev/null and b/src/assets/images/dehumid/has.png differ diff --git a/src/assets/images/dehumid/overview.jpg b/src/assets/images/dehumid/overview.jpg new file mode 100644 index 0000000..8cc12e6 Binary files /dev/null and b/src/assets/images/dehumid/overview.jpg differ diff --git a/src/assets/images/dehumid/schematic.jpg b/src/assets/images/dehumid/schematic.jpg new file mode 100644 index 0000000..c1cdb15 Binary files /dev/null and b/src/assets/images/dehumid/schematic.jpg differ diff --git a/src/config.ts b/src/config.ts index ac55730..9f35f98 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,7 +9,7 @@ export const SITE: Site = { ogImage: "astropaper-og.jpg", lightAndDarkMode: true, postPerIndex: 4, - postPerPage: 3, + postPerPage: 5, scheduledPostMargin: 15 * 60 * 1000, // 15 minutes showArchives: true, }; diff --git a/src/content/blog/smart-dehumidifier.md b/src/content/blog/smart-dehumidifier.md new file mode 100644 index 0000000..fefae10 --- /dev/null +++ b/src/content/blog/smart-dehumidifier.md @@ -0,0 +1,75 @@ +--- +pubDatetime: 2025-09-28T00:00:00Z +title: Adding Smarts to a Dehumidifier +draft: false +tags: + - code + - esphome + - homeAssistant + - electronics +description: Adding notifications to our dehumidifier +--- + +Recently we bought a small dehumidifier to try and keep the moisture levels under control in our basement. We went with a fairly cheap one just to see how we'd get on with it. Amazon let us know that it was a frequently returned item, so that really inspired confidence. + +![](../../assets/images/dehumid/dehumid.jpg) + +It's been running for a few weeks now, slurping up moisture out of the air, and it seems to be working perfectly. The only issue we have is that we tend not to notice once it fills with water and shuts itself off as we don't use the basement that frequently. + +Obviously this is the sort of issue that could be solved by just checking on it more frequently, but I've been wanted to get my soldering iron out again and this seemed like the perfect oppurtunity. + +## Hardware + +I rummaged through my drawers to find something suitable and came across a Beetle-esp32-c3 that I had left over from another project. I knew that the software side would be fairly simple with ESPHome and Home Assistant, and I thought the hardware would be similarly easy. + +![](../../assets/images/dehumid/beetle.jpg) + +The hardware side of things took a little longer than I thought it would. There are two leds on top of the unit, one for power and one for 'tank full'. I was assuming that the circuit would look something like the following and that I could just tap off some nice logic signals from the leds. + +![What I hoped](../../assets/images/dehumid/circuit.svg) + +Unfortunately, that's not how it was designed. Most of the logic is at 9v - high enough to damage my little Beetle. There wasn't even a suitable power supply that I could use. Fortunately, I had some spare buck regulators from the same previous project that could safely take the 9v power down to 5v for the Beetle, but that still left the issue of figuring out how best to tap in to the circuit... + +In the end I took inspriration from Big Clive and drew myself a schematic as I beeped out the circuit, and rummaged through online datasheets. + +![](../../assets/images/dehumid/schematic.jpg) + +I left out a lot of the wiring that wasn't relevant - like how the momentary switch latches the power, and how it won't do anything unless the bucket is inserted - but eventually I understood roughly how it worked, and how I could interact with it. + +The VCC output of the microcontroller was only high when the machine was running, and it was ~4.5V - a nice level for the Beetle to read. The tank full light was switched on the low side when activated. This meant that I could use a pin on the Beetle with a built-in pullup resistor to stay high normally, and be pulled to ground with the led when activated. Nice! + +![](../../assets/images/dehumid/closeup.jpg) +![](../../assets/images/dehumid/overview.jpg) + +## Software + +As I mentioned earlier ESPHome makes this really super simple. The config for the Beetle is as follows (standard wifi stuff removed): + +```yaml +binary_sensor: + - platform: gpio + pin: + number: 7 + inverted: true + mode: + input: true + pullup: true + filters: + - delayed_on: 2s + name: "Tank full" + - platform: gpio + pin: 2 + name: "Running" +``` + +That's it. That's all it takes for this to appear in Home Assistant + +![](../../assets/images/dehumid/has.png) + +From there it's a simple matter to set up some automations to get alerted once the bucket is full + +![](../../assets/images/dehumid/alert.png) + +## Conclusion + +It's really wonderful to see how easy it's become to do this sort of thing. diff --git a/src/utils/getSortedPosts.ts b/src/utils/getSortedPosts.ts index 8fa5266..83bf7e8 100644 --- a/src/utils/getSortedPosts.ts +++ b/src/utils/getSortedPosts.ts @@ -7,10 +7,10 @@ const getSortedPosts = (posts: CollectionEntry<"blog">[]) => { .sort( (a, b) => Math.floor( - new Date(b.data.modDatetime ?? b.data.pubDatetime).getTime() / 1000 + new Date(a.data.modDatetime ?? a.data.pubDatetime).getTime() / 1000 ) - Math.floor( - new Date(a.data.modDatetime ?? a.data.pubDatetime).getTime() / 1000 + new Date(b.data.modDatetime ?? b.data.pubDatetime).getTime() / 1000 ) ); }; diff --git a/yarn.lock b/yarn.lock index 7202c29..71a4d0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2454,17 +2454,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001646, caniuse-lite@npm:^1.0.30001688": - version: 1.0.30001692 - resolution: "caniuse-lite@npm:1.0.30001692" - checksum: 10c0/fca5105561ea12f3de593f3b0f062af82f7d07519e8dbcb97f34e7fd23349bcef1b1622a9a6cd2164d98e3d2f20059ef7e271edae46567aef88caf4c16c7708a - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001663": - version: 1.0.30001667 - resolution: "caniuse-lite@npm:1.0.30001667" - checksum: 10c0/6bc8555a47603e1e76eaef9b185d6fdeeca7d9c20a283f7c32c971eb1b52ea3a80e6ec086920f088f06abe619240f1023a2d3a08b5b1f2f11df1475695e9f71c +"caniuse-lite@npm:^1.0.30001646, caniuse-lite@npm:^1.0.30001663, caniuse-lite@npm:^1.0.30001688": + version: 1.0.30001745 + resolution: "caniuse-lite@npm:1.0.30001745" + checksum: 10c0/646ca4b57baaa7a835cf7204c8a257490ee8e36364c04638212e3750c5e8ef45c39f352307e6205114487bcc179d42f5216f6dac146641b16a60b20b29d6f2a6 languageName: node linkType: hard