Friday, June 19, 2026

The Evolution of My Hot Water System - Part 1

Hot water isn't usually thought of as a problem in the rural Arizona desert, but to my household, it actually is. During the summer, we get lukewarm water out of the tap running around 80° - 90° because the ground heats up to that temperature. The water right out of the well runs cooler, but it sits in a tank and travels through a PVC pipe to the house. One would think that just heating it up to the standard 130° - 140°F would be cheap. Not true.

Incessantly rising power company charges and the energy it takes to raise the temperature of water 50 degrees make for a noticeable expense. Then let's compound that with "Peak Demand Billing" and an uncontrolled water heater can really tack on the charges. In fact, this exact thing is what got me started in Home Automation. I was surprised by a huge power bill and wanted to understand why; then after hours of research, trying to find a way to prevent it became a large part of my free time. This blog is filled with my various methods of control. 

Specific to the water heater, first I had a solar-assisted water heater installed. That was wonderful and did a lot for my power consumption. Suppose on a normal clear day of our usual 100+° sunshine, I only get one tank of hot water from the solar system. Going from 85°F up to 135°F in an 80 gallon tank is actually 667 lbs x 50°F = 33,360 BTUs. Using one of the internet calculators to convert to kWh, 33,360 / 3,412 = 9.78 kWh using only sunshine and a few watts from the circulation pump. That leads to around $1.20 to $1.50 a day savings. Taking that on an average monthly bill, I'm saving about $36; in a year that's over $430!! 

I'm saving money that I don't have to give to the power company's lawyers so they can lobby for higher rates with the local regulators.

Unfortunately, that doesn't address the peak billing problem. Back then the peak period was from 3 PM until 8 PM, and that period held some of the largest uses of hot water, like the evening meal (supper to some, dinner to others), dishes, and after-work showers, normal stuff. That led me to installing a power shutoff timer to keep the helper heating element in the hot water heater shut off during that period. 



I added stops in the timer to control the heater from 10 PM to 6 AM also since I didn't need hot water during those times. Everything was great until the power went off (happened often back then) and the timer was off. Those mechanical devices, while extremely reliable, had nothing to keep the time correct. When I got a power bill for an extra $40 in demand charges because I forgot to reset the timer clock, I started looking for another solution. That initial solution (this was in 2011) was an X10 relay and a timer clock in the house that had a battery in it. That failed me as well <link>, and another $40 down the drain... literally. 

It was time to create something that actually worked. Grabbing an Arduino and ordering an SSR from China, I built my own controller that had the time from an XBee network that I already had running and controlled the SSR that interrupted the power to the water heater. Note that I tried a contactor first, but those things are noisy unless you spend tons of money on them <link>. SSR devices cost a lot less and are easier to control. That little device <link> actually worked really well for a long time until I decided to measure the power usage of the heater. This ability to measure the power usage was mostly just me investigating because, at the time, I really didn't need to know the water heater used 4500 watts; that was written right on the label. What I wanted to know was how often it kicked on and why.

My SSR Water Heater Controller

That meant another device and a bunch of changes. I built up a pretty sophisticated combination of an Arduino hooked to an XBee that read power from a Modbus-based power measuring and display device <link>. This transmitted the state of the water heater and the temperature of the top vs. the bottom of the heater. I was really cooking now. I had temperature measurements, power measurements, remote control, and it wouldn't fail because the time changed. It looked cool on the wall over the water heater and was great for showing off to the neighbors <link>.

Oddly, it didn't impress the girls though

Man, I was right up there with a fully controlled water heater that provided wireless telemetering and autonomously controlled activity to avoid peak demand charges. A home automation dream, BUT there was still that problem of not enough hot water on cloudy days. What should I do about that?

The answer was right in front of me for years. The solar-assisted water heater had a circulation pump that pumped antifreeze-conditioned water from the heating coils at the bottom of the heater to the array on the roof. That's how they avoid damage from freezing weather: isolate the potable water with a radiator in the water heater and send it through the heating array on the roof. Suppose I put another one in that pumps the water from the bottom of the water heater to the top. I have water fittings on both ends, one is the exit for hot water to the house (top) and the other is the drain at the bottom. That would force mixing the water to equalize the temperature, and the helper element would take up any slack to give me the entire volume of the heater as a reserve. With an 80 gallon capacity, that would serve any reasonable purpose during cloudy days. However, this wouldn't be a simple task; one inch plumbing fittings are a real pain to deal with, and sweat joints are NOT as easy as the YouTube videos pretend.

But this series of adventures is getting too long, and I know you're approaching TL;DR, so in part 2 I'll get into the trials of a destratification pump.

Thursday, June 18, 2026

More Adventures With My Pool

 Way back over a decade ago (2013), I installed a Waterco Multicyclone Filter on my pool <link>, and it worked pretty well. Then in 2015 I had a problem when one of the fittings broke, <link> which was annoying because nothing else broke when my pool flooded during a downpour. Well, it happened again and was a little bit exciting at the time.

I was sitting on the patio enjoying a fine sunny day (103F) over a cup of coffee when I noticed the pool level had dropped. A little bit concerned, I checked to see if the autofill was working; it was. So I went to the equipment, and the area was flooded, and water was shooting everywhere. I waded through the mud and spray to the controls and shut the pump off. The union fitting on the Waterco had split in half and was the source of a high-pressure leak right at the pump. The first time this happened, it was the top fitting; this time it was the bottom fitting. After a heavy sigh, I decided it would be necessary to do some plumbing work.

A little background here: my area requires a cartridge filter on swimming pools to conserve water. The thinking is that backwashing a sand filter wastes water and a cartridge filter solves that problem. The engineer that came up with that suggestion was an idiot. The person didn't think about the fact that cleaning a large cartridge filter takes a ton of water to clean. I actually used a pressure washer, and it took an hour or more to clean all four filters in the enclosure. Then, it would fill up with desert sand in a week during the summer, and here in Arizona, we have roughly nine months of summer. So it was almost a weekly task of taking out the cartridges, putting in a spare set, cleaning the dirty ones, and putting everything back in service. Cleaning the darn things took a whole lot more water than my neighbor's sand filter, plus the time and effort of doing it. When the cartridges wore out from incessant cleaning, they cost around $100 each; four filters in use and 4 on standby for changing, roughly $800 invested in paper. 

Now, keep it to yourself, but I bought a sand filter and replaced that hunk of junk cartridge filter. The straw that broke the camel's back was when the assembly inside the cartridge filter failed and needed replacement. I looked at the cost of Hayward parts and decided it was time. After changing to a sand filter, the water looked just as good, backwashing took about 6 minutes, and I was done for at least three weeks before it needed it again. Much less work, much less water wasted, no cartridges to worry about replacing. A little bit of heaven for a change. 

Getting back to the recent problem, the last time I replaced the fitting on the Waterco, it took over a week to get it, and that would mean a green pool. Additionally, the failure was exactly the same as the last time; the ring split in half.


I decided that over a full decade of good service while I was fighting the cartridge filter's problems was enough for this device and decided to eliminate it. Mostly because I realized that it really wasn't overpressure that destroyed the fitting; it was vibration. Years of motor start-stops, pressure changes, and constant vibration just wore the darn fitting out. That combined with the ease of cleaning the sand filter and its much better filtration meant that I really didn't need the extra filtration any more.

Time to simplify and eliminate another thing to take care of.

However, it was a bigger job than I first expected, actually much bigger. The darn concrete platform the equipment was sitting on was broken and starting to fall apart. Yes, the people that manufactured that piece of concrete for pool companies to install had left some of the rebar reinforcement outside the concrete and water infitrated causing the rebar to rust. When rebar rusts, it expands and cracks the concrete. I had a broken mess supporting my pool equipment. But pulling all the above ground plumbing, tearing out the broken slab, pouring a new slab, waiting for it to cure, putting everything back would take at least a couple of weeks. 

What to do? I decided to take it in two steps. First, I would just get the pool back in service because it is June in the middle of Arizona and we only get half a day of active work before the heat drives us into the shade or under an air conditioner. Second, it's Summer, that's when you want a pool. Third, to support the weight of the filter, the concrete should cure for at least three weeks before you put weight on it like a sand filter and a heavy motor. Those three reasons made enough sense to me to do something different. After I got it in service with the broken slab and some inventive plumbing, I would cast the slab out in the back on a piece of plywood, let it cure for a few weeks, then dismantle the plumbing and move the new slab into place where it needed to be. Yes, the new slab would be heavy and hard to move, but I have a small skid steer, a small excavator, a Jeep with a winch on it, and pipes. I should be able to get that thing in place with all that stuff to play with. 

Now to fix the plumbing and get the pool back in service so I can work on the second stage.

Well, it wasn't as easy as I made it sound. There simply wasn't enough room between the existing fittings to just put in a pipe with a couple of couplers on each end. 


The arrow shows one spot that might have worked, but it was covered in glue and the surface was pitted pretty bad. I decided to replace the entire piece from the motor to the union up on top. That didn't seem too bad, but I would have to order the Hayward motor union part. It seems that Hayward is true to form in that they make everything custom to them. The motor coupler on the Hayward is different from a union that you can buy at Home Depot; it's different from a Pentair. It doesn't match anything one would expect it to. No, it has to be made special. 

The price of the real Hayward replacement was over three times an aftermarket equivalent. So I got the less expensive (cheap!) one, and after waiting a day (Amazon Prime) for the part and then getting some common fittings, I went to work. 

I had to replace the top union and all the fittings down to and including the special Hayward motor connection. So I spent a couple of hours lining things up and glueing them together. It really wasn't a huge amount of work; most of it was measuring pipe and cutting it. I got it all back together and gave the entire assembly an extra half hour before testing it for leaks. I turned on the motor in low speed and got it all primed up and working; everything looked fine. So I kicked it to high speed.

And it blew up.

The aftermarket (cheap) Hayward replacement fitting literally blew apart. Water shot up in a 2" fountain and soaked me and everything around me. In a real rush, I shut off the motor and looked at the damage. This is the part that failed:


No, the pipe didn't leak at the joint, nor did the union leak, The cener part actually blew out of the collar that holds the pipe to the motor and seals the connection. These things are two pieces, a female pipe connection with a flange that the collar pulls tight to a rubber washer on the motor fitting.



The centerpiece that connects to the pipe from the motor literally blew right through the collar and allowed that 2" stream of water to shoot right up in the air. Over time, I did a post-mortem on it. There were two factors that led to the failure. First, there was almost a 1.5 mm gap between the top of the collar and the pipe, where the original Hayward had less than a millimeter. Second, the plastic was softer and a tiny bit pliant instead of hard as a rock like the Hayward original. This is called 'durometer' if you want to look it up.


It's really hard to see in the picture because of the color and wear marks, but feeling the gap and the softer plastic, the problem became obvious. So, when the pressure increased, the plastic flexed a bit, and the larger opening allowed the entire female part of the fitting to shoot right through the hole in the collar. Sigh... Now, what to do about it? Well, the obvious choice was to just get a real Hayward fitting and bite the bullet. 

This time I decided to put a union in the middle of my vertical run so I could dismantle the plumbing a little better and not have so many fittings to buy if something else happened. It was a good idea in theory. When I repeated the same test of running it on low, then switching to high, the Hayward fitting (real one this time) held up and didn't leak. I thought I was home free until I noticed a leak at the top of the new union. Glued fittings don't leave any room for error; you can't take them apart and fix them, but I was sick of messing with this. So, out came the J B Weld Water Weld.


If you've never used this stuff, it's great for this kind of thing. It can set up underwater and is actually sticky enough to hold things in place. I use it a lot because plastic fittings in the sun deteriorate over time and sometimes leak. This stuff can fix that. I let the pool run on high speed for a few hours to prove it would hold together.

So, the temporary plumbing repair was done. I could test it a bit more to get comfortable and then start on the new concrete slab for the equipment. Since I wasn't totally confident that everything was perfect and wanted to hedge my bet a bit, I turned off the pool automation and left everything for the next morning when the area would be in the shade. 

The next morning, I went out near the equipment and turned on the pool motor... nothing. Walked over to the equipment, and the motor was not running at all. I checked the power; it was on. So, I tried it again and got that tell-tale buzz from the motor before it shut off. The most likely culprit was the capacitor. Off I went to get more tools for the pile by the gate, took the cap off, and checked it with a multimeter. That thing was a pure open circuit; something inside had actually broken. 

Of course none of the local stores had one in stock, but Amazon Prime came through the next day before sundown, and I got it installed and tested. Although I had to wear gloves because by the time the part arrived, the area had been in the sun for a couple of hours. 

Finally, I was done with this simple, easy repair job ... at least the easy part.

Wednesday, June 17, 2026

Chasing a Moving Target.

One thing I didn't have a problem with when I first got into home monitoring and control was the software changing underneath me. I fully realize that software changes over time and that we need to adapt if we want to keep up with the industry, but MONTHLY? REALLY??

Home Assistant has a monthly release schedule, and many of their releases cause changes in the various add-ons and integrations. Dashboards you spent a week getting "just right" change. New features don't work the way you expected. Plus, each of those custom items (especially cards) has its own updates that change the way they work. It makes one (me especially) reluctant to update anything once we get it working. But, for me, the real annoyance is changes to our toolset to create new things.

Espressif (the folks that created the ESP32 series) is especially harrowing to people like me that build their own stuff to control and monitor things. Their libraries change often, and code we compiled and worked with yesterday fails to compile when we update to get the latest new capability or bug fix. I had that happen too often. Then, you have to hunt for the release documentation and hope you find a clue to fixing the source that worked yesterday.

Between the tools and underlying system changing as we work on things and then waiting for bugs to be fixed, it's hard not to just stick with whatever works right now and simply ignore any changes because there's usually some teeth-grinding involved in using the 'latest' of anything. I've seen users complain that a lot more emphasis should be put on making things work than on piling feature on top of feature that most of us won't even use. 

Such was the case with my little Xiao ESP32C6 Zigbee temperature and contact sensor that was actively measuring the air temperature and watching the septic float. I installed a new release of ESPHome, and suddenly my cool little CYDs wouldn't work. Seems they changed some names of things I used. 

This was a royal pain chasing down which things changed to what. I just gave up and turned the task over to an AI. It prowled through my code, looked at the new errors, and gave me the new names I needed to put it. That trick saved me a ton of time prowling through forums loaded with ads and chasing my tail to get what I needed.

Remember this trick when you run into the same problem.

However, I still hold with not letting it write code for me. Especially when you have something that involves a lot of details. What happens to me is that I tell it what I want to do, and it does well until we're chasing a bug; then the conversation gets so long that the AI starts to confuse what worked and what didn't. It seems to get trapped in a loop where it simply confuses itself and can't recover. 

I'm all for using whatever help I can get putting something together, and would proudly use AI to overcome syntax errors I just can't see or get a new way to shift some bits around to meet some obscure spec, but be really careful doing it. In a couple of instances it told me to remove files that were causing problems. DON'T do that. 

If you do want to see just how well it does with code, be sure to back up everything in sight just to be sure it doesn't convince you that this is the best way to go and you delete a week's work.

And, as some of you probably noticed, I'm anthropomorphizing it already. Currently, I consider it a quirky research assistant of indeterminate sex. It's a co-worker that makes mistakes and gets lost in detail but is great at gathering information from obscure sites and putting it in words that I can understand. I can see a real danger though.

It's really good at finding things and telling me where to look for answers; how will that threaten future workers that aggregate data and present it in things like newsletters of new ideas and processes? Will we need humans to organize ideas and specifications for use? There are a huge number of people out there that are preaching the future of AI, and the Terminator movies didn't help us base our fears, real or imagined, on reality. People are already claiming it helps them with the stock market.

That kind of thing is for people that are far better than I at predicting the future of a new technology; I just want to use it as it applies to me. It saved me lots of time making the changes I inherited from the ESPHome codebase "update."
 

Sunday, May 17, 2026

Controlling an Air Handler with Home Assistant.

In a previous post <Link>, I described how I put together a 'thermostat' using the EspBuilder integration in Home Assistant. That project was fun, but it relied on my old thermostat from years back that was actually wired into the Air Handler. Since I still have ties to actual code, and was familiar with Zigbee, I thought I'd put together a controller that directly wired into the actual Air Handler and lived on top of it up in the attic and out in the garage using the Arduino IDE. I saw this as a fun Zigbee project that I could tailor over time.

Sadly, that didn't work out. I started by creating a Zigbee device with one control, the fan. That worked well on the second try. I had the usual problem with setting it low instead of high. Then I added the reversing switch, that worked also. As I added things reporting and being controlled, I hit the magic number of seven. It seems the Arduino IDE Zigbee interface to the Esp Zigbee library had trouble with more than seven endpoints on a single device. That kind of sucks because to finish my plans for this new device I needed more than that. 

I thought about combining sensors by sending data encoded in numbers and such because text is a real pain using zigbee. Then I thought about my experience with EspBuilder. Maybe that would work...

There I was deep into YAML again, dropping into  lambdas of C code where necessary and spending hours looking for the exact right indentation needed to make this idea real. Coming from C originally, putting up with having indentation be the determining factor for nesting really is a space alien concept, but with the help of AI, I stumbled through it. 

I took a XIAO ESP32C6, another of those little expansion boards and a cheap four relay board and slapped them together.



I've learned that actually mounting things keeps the wires from one piece to another safer. I got really tired of hooking things back up and trying to keep track of pieces when prototyping. Now, all I had to do was wire up the relays, and using the EspBuilder code I had created, test this thing until I was comfortable that it might do the job.

So after some time with EspBuilder, I trotted this out to my garage where the Air Handler lives and used some sophisticated mounting devices to place it in actual operation.

Yes, duct tape

I just drilled a hole in the top of the Air Handler cabinet and stuck the device on top. It lived there for over a week taped down and actually doing its new job while I converted that AC unit over. I changed the device assignments in Home Assistant and disconnected the old DIY thermostat completely. Here's my previous thermostat that actually did everything resting in it's new retirement area:


That long USB cable was part of the actual installation. I would pull that out and plug it into my laptop to make code changes, then put it back inside the wall for next time. Notice the Arduino stack upper left? The model A Arduino, then the next layer is the ethernet board, then double stacked to allow for the ethernet plug to a board that held a buck converter to convert 24vac from the Air Handler to 5vdc for everything, and all the wires for the display, control buttons, and even the temperature sensor. 

Ah, the good old days ...

Of course there was wiring that had to be done inside the Air Handler. Have you ever looked inside one of those? They're a nicely laid out area where the factory put things together, then the place I needed to get to to connect my controls. On simple AC units, without fancy variable speed motors, semi intelligent control systems and such that we're starting to see, it's pretty basic. There are three controls, the fan, compressor and reversing switch. The reversing switch is what switches from heating to cooling by controlling which expansion valve is active, the one inside, or the one outside. Air conditioning is really simple until you get into the refrigerant handling. This is the wire bundle that leads out to the compressor beside the house:


The compressor and reversing wires are in there somewhere, "refer to schematic." Yeah, right, the schematic was wrapped around one of the covers and hard to follow, so I took pictures of each part, 




and then used paint.net to combine them, adding notes after I pondered each line to try and get the right ones hooked in:


My note boxes and complete schematic are now immortalized on Google Photos forever. When I get back into this thing in a year or two, at least I have some idea what I did last time. However, the actual Air Handler doesn't look anything like that. 


And, under the cover where the schematic wrapped around are the actual places that I need to hook to.



After a bit of following wires and installing connectors, I had it all wired up and tested with the prototype duct taped to the top of the box. I want folks to notice how I powered this device. 


Yes, it's a cellphone charger. I use these a lot for 5vdc projects. As I described in other posts, it's only a buck and will work just fine with 240vac input. Love these little things. Now, how to protect the boards and wiring. 


This is what I came up with. Yes, I ordered a new roll of white filament for the printer. I used plugs for both ends and kept the USB C connector as the power input. That way I can plug a laptop into that side to make changes if I need to do that. The other side is a Phoenix plug. I discovered Phoenix plugs mostly by accident prowling around for plugs on Amazon. You can put wires directly into both the fixed socket and the plug itself. Using plugs like this is really nice for environments where there is a small amount of vibration for a long time; plus it allows me to remove the entire assembly and bring it to a workbench for some work if needed. This is specifically what I used:


It looks like it's two parts, but it's actually three, One part mounts to the enclosure, and then the top piece snaps into that forming the socket. The plug part is one piece. I just put the wires from the Air Handler into the plug and the wires from the relays into the socket. It did take a bit of work on the enclosure to accommodate the mounting though. I put a recess in the enclosure using Fusion.


This worked really well, here's the test print I did to try it out



I was really proud of how well this worked. I printed up a lid for it that is just an inverted "C" that friction fits to hold it on since I wanted to get in there if something happened during extended testing and went live with it. 

It worked. 

Look, no more duct tape!

The "warm red glow" is the little lights on the relay board. Basically, I was done, so I just duplicated everything for the other AC unit on the north side of the house after this one proved itself for a week.

The last piece of this upgrade to my home controls is the remote temperature sensor, I'm still using the ancient ones I built up for the old system and waiting patiently for the Esp and Arduino developers to get past the bugs in their code. The last time I tried (about a month ago) two analog sensors wouldn't work in the Arduino IDE, one would show up in the other; I couldn't get two of them independently reporting. The ESP developers have promised EspBuilder would support Zigbee on the Xiao ESP32C6, but they encountered pretty serious problems with their build environment meshing with changes in Home Assistant. It is currently rumored that they blew off their first of the month deadline in favor of coming out with a 2026.6.0 release instead. So, both platforms are in flux and I'm currently stuck.

What I found though, was that EspBuilder under Home Assistant is really great for this kind of development. I can make changes, load them onto the device, and try them out from my recliner in the house. There is even a little web server on the interface board that I can get to.


There's a whole bunch of other features that make that development environment absolutely the best for home automation that fits it's requirements. 

Code? Sure, I will eventually put the code into github, when I feel a need to be punished learning yet another new thing.

Wednesday, May 6, 2026

A Real Use for the Cheap Yellow Display

 So. a friend told me about the CYD (Cheap Yellow Display). Basically a nice little color display that has a processor on the same board with some inputs and an ESP32 complete with wifi. At first, I kind of shrugged because ... well wifi. For me, in a rural area prone to power outages, wifi has been pretty much a pain in the bottom. Internet in general has sucked over the years because a WAN connection had to be by wire. Dial up, DSL and such were the rule because that was all that was available. 

But, over time, that changed. The power company FINALLY decided to actually supply (mostly) reliable power. Then the various internet providers started showing up. Wifi mesh networking systems became cheap enough to actually use in the home. We caught up (almost) with the 21st century. 

Heck, I think I'll get one of these things and see how they work.Wow! these little things are really great!!


Notice I got the 4 inch model? I wanted something I could actually see and interact with. It has a resistive touch screen, and a nice color display. 


Since I didn't want to scratch up the screen playing with it, I immediately made a faceplate for it and noticed a small annoyance: the screen is off center.


Notice how the left side is wider than the right? No, that isn't because I printed the faceplate that way, it really is off center to allow for the wifi antenna that the processor has.


Never mind, that's good enough to begin; I can adjust for that when I have something real developed. For now, let's play with this thing.....

Since this was my very first ESP32 journey into code, I loaded up the latest Arduino IDE, an installed the esp32 board support and tried it. I got "blink" to work, then advanced to "Hello World;" they both worked, but it was painful. The native code was full of various calls that I really didn't understand and just seemed way to complex for something that would have to maintain for years and years. 

I looked around, even sent an AI out to find a way to simplify developing something for this board that actually did something. My answer was right there in Home Assistant, ESPHome Device Builder. They tout it as "No Code," and to some people it might be, but not for anything that I want to actually do something; more on that later.

I created my first ESPBuilder device, "Hello World," and I was impressed. I mean really impressed. I managed to get a string on the display, in any color I wanted, and actually be able to read it without squinting. I spent some time playing with the backlight, fonts, various items from home assistant like drop down menus and circular gauges. It was totally fun watching things come up on the CYD that had been limited to laptops and phone in the past. 

What to do with this? MY THERMOSTATS !!

For a decade I had used the "Super Thermostat" <link> that I created many years back. Now was a good time to replace them with new hardware. They were already ethernet devices, and a wifi device like the CYD would be a good experiment to try out. Plus, I could put that dusty 3D printer to work for a custom enclosure. 

This was a bittersweet decision. I created those thermostats back in the medieval times of home automation, and they were quite a project. At first they were wifi, but wifi didn't work too well with the Arduino platform in those days, so I switched them to wired which was a lot of work. Then, I modified them to use remote temperature sensors <link> so I could sense the temperature right where the people were; that was also a big project because they were battery powered end devices on a Digi XBee network. Plus, there was a lot of custom changes to the combination of devices over the years that I would have to reproduce under the new digital environment. Did I really want to take this on???

This is what one looks like finished, running, and controlling the AC unit on the south side of the house.


Yes, it's green. There were two main reasons I used green filament to print it. 1, I already had a spool of green filament, and 2, the wall behind it was green. No, it was not to draw attention to them so people would ask about them; nope, not at all. The two patches cover up the holes from previous thermostat work that I absolutely will cover up and paint ... someday. 

It all works, The code has provisions for my power company "Peak Demand Period;" where the price of power goes through the roof. It's animated; the little fan is black and stationary for idle, red and turning for heating, and blue and turning for cooling. It even has drop down (or in this case up) menus for selections. 


If you use your imagination, you can see the fan spinning

I can change the mode with the simple press of a fingernail or a pen on the screen (remember, it's a RESISTIVE touch screen). Same thing with the fan. The temperature is displayed as both a circular gauge and numbers in fahrenheit. The temperature setting is controlled by both a slider and two buttons.Yes, I was showing off a bit, but I couldn't control myself. 

"But, wait, how did this thing control the air handler? It doesn't have any wires going into it?," you say. Well, I cheated. The old real thermostat was still running, catching commands from Home Assistant and feeding them through the wires to the air handler. Basically, this was just a fancy display that had bells and whistles that actually worked to send commands to Home Assistant which sent them on to the old thermostat that fed the wires. The idea was to stage my conversion to new hardware one bit at a time. First the CYD because it was cool and pretty, then something to replace the old thermostat that would actually control the air handler, then a remote temperature sensor that I could place appropriately. 

Yes, this was going to turn into a huge job with parts all over the house, but any one of the pieces could be updated independently as desired. There's buzz words for this like, "distributed processing", "isolated failure tolerance," or maybe "extendable architecture," but what it really was was staging the changes while I kept the AC working. That thing is my heating and cooling, and in my unpredictable climate ---necessary. So, While this screen looks like a thermostat, it's actually just the face of a much larger system—the real work happens in the old thermostat that is ancient. For now,but that is going to change.

Power comes in the back through a USB C connector hooked to a wall wart on the opposite side of the wall. That way there are no wires visible and only a small round hole in the actual wall. Why? Well, I had a lot of trouble with heat generated by various devices when I tried taking the 24vac down to 5vdc. Those little converters are cool, but run hot and that's not a good idea over time. I thought of this going into the project, and the device is upside down compared to other projects. 

The lid is actually the mounting point of the new thermostat and is held on by screws into wall anchors, then the CYD is mounted to the case with a hole in the bottom for the display and a friction fit to the wall mounted lid. The USB C cord comes through the lid, like this:


So, if I want to work on it, I just pull it off the wall, unplug the USB C connector, and walk off with it. Slick, and I wish I had thought of that technique much sooner. It makes taking pictures of the other half easy, like this:


See how I used a commonly available right angle adapter for the USB C connector? I try to keep projects as cheap and easy to find parts for as possible. Also, notice the dead space to the right? That's because the CYD display is off center as I mentioned earlier. It makes for a larger thermostat device, but it would drive me nuts over time looking at a screen that was off center every time I walked down the hall.

Which reminds me, How does this control the actual AC units? Well, ESPhome and Home Assistant thought of that for me. Each operation like changing mode: heat, cool, off, are handled by Home assistant. The thermostat is a "device", with "entities" that can be put in a dashboard. That way, I have menus on the laptop and cell phone as well as the thermostats on the wall. I basically stole the controls I already had for the old thermostat that was routed from old code and hooked this to that. This mess of stuff made for a cool display on Home Assistant:


If you've read any of the other posts on this blog, you already know I'm a sucker for graphs. They tell me at a glance if something is wrong, and I get a feel for the behavior of the various things around the house easily. I will eventually make that menu simpler for 'normal' people to use, but for now, it's my baby, I'll show it the way I want to.

So, after building two of them and working out how to share the common code between them, I had two new thermostat devices. That was really great for a few days, but then I thought to myself, "Self, why don't you move all that logic over to another device that is right on the AC air handler? That way you can get rid of the requirement of hooking into a wire that runs through the wall to control the AC. I could put all the control logic in there, and when necessary, adapt it to a different air handler. Plus I could do things at the air handler that are not as easy with a wired system. I could measure the air flow, temperature of the incoming air vs the outgoing air, maybe use the lower speed of the fan ,,,

I'll write about that project in the future, it was a bit harder, but fun.

Wednesday, April 15, 2026

My First 'Real' Zigbee Sensor

I've made a lot of sensor devices that reported using Digi XBees. The little RF devices work quite well and set up a self healing mesh network that really does what is needed. These came before Zigbee and the devices we see now for home automation. It was the beginning of the Internet of Things (IOT), but it wasn't actually on the internet. Most of this blog is about developing these devices to serve some purpose: reporting data about or controlling something around the house. Bringing industrial controls home for a common person. 

Zigbee devices started appearing, using the same techniques I was familiar with but with a documented protocol that could make different manufacturers devices work together. However, the first implementations were crippled by the manufacturers such that anyone buying them would be stuck using a single manufacturer's equipment. Much like pool controllers that are locked into a particular manufacturer. The Iris devices promoted and sold by Lowe's were such devices. Myself and others broke into the protocols of the Iris devices and built our own controllers eliminating being locked down like that. 

That philosophy, thankfully, died in favor of a huge number of real Zigbee devices. Zigbee 2 MQTT was the crowning touch to this; it allowed any manufacturer's offering to connect and translated the protocol into MQTT topics that anyone could use to control their own house.

But, you can look up the history of IOT if you want to know more, this is about creating my first device that used the Zigbee protocol. In my last post I described how I implemented a swimming pool controller using commercially available Zigbee devices, but left something out: measuring the air temperature at the pool controller, and a contact sensor for a float in my septic tank on the same side of the house.

The ESP32C6 had been announced that supported native Zigbee and Matter. Then Seeed Studio announced a tiny Xiao device that packaged the C6 as a component similar in size to a Digi XBee. This little thing was exactly what was needed for me to get my feet wet creating a sensor to measure temperature and check the status of that float. So, I ordered one (actually a couple).

Taken right from their web site

This thing is a little bit bigger than my thumbnail.

It comes in a cool container


Yes, it's that tiny, and subsequently a bit hard to deal with, so I ordered the expansion board to play with it. 

Taken right from their web site

This was big enough to handle and work with. It has plugs for adding sensors and powering them as well as that cute little display for debugging or showing off. Plus, there were instructions on using the latest Arduino IDE to develop software for it. I'm very familiar with the Arduino IDE since I've been using it as long as it has existed. That was a real plus in my mind. 

I downloaded the IDE, installed the board specific software, and wrote my first program for the C6, "blink". Then I expanded to "Hello World,"  I was ready to dig into bringing up a Zigbee device, and then later, conquer the world.

The first thing I noted playing with the Zigbee examples supplied by the developers was that they were designed to connect a C6 controller to a C6 device. I wanted to connect a C6 device to Zigmee2mqtt and Home assistant; how does one go about that? I had to poke at it quite a bit to get my device to join, and it was really frustrating. There was a whole world of considerations that I didn't have in my development work under the Digi XBee model. At this point, I need to tell you about a way to cheat. You know how frustrating it is to look for an example of something like getting that little display on the expansion board to work, and even make it behave like a terminal and scroll information? It's really hard to search for it because you get 1.6 million hits, many of them on forums, and a huge number of youtube videos some of which are related, others that are not. Plus the usual totally unrelated hits that just drive you nuts. The answer to that for me is to use AI to search for me.

Let AI do the searching dealing with the ads, pop-ups, videos in the corner of the screen and give you back something that might actually help. I used it extensively to summarize discussions to a few real findings and translate the jargon into something I could understand. DO NOT let it write code for you. That would be great, but it puts in stuff you didn't ask for and inserts more errors than it solves, but for gathering information, it's a gem. Especially in today's ad-ridden internet.

I got the device to join with Z2M and then ran into problems with the data it was providing to Home Assistant. That led me to what's called a 'converter.' This is a piece of yaml code that describes the Zigbee clusters and what to do with the data. The documentation on these pieces of 'code' is odd and I had to prowl through it a lot to get some idea of what was going on. Also, Z2M had changed the way the converters worked and should be written, and the 'helpful' sites on the web were mostly too old, or just flat wrong. AI to the rescue, sort of. AI had the same problem I did, separating the junk from the real information. It kept suggesting things that just wouldn't work, and were a mix of the old and the new. However, it was pretty good at finding problems with the exceptionally weird combination of syntax, keywords, and indentation that plague yaml. Yaml was supposed to provide a way of creating code from a description without having to learn to code. Instead, you have to learn how to make a very elaborate description that is properly organized using specific keywords, indented to the way some programmer thought it should be. Basically, it is part of the future that one has to adapt to in order to get anything new done in the IOT field. Also, it sucks.

Net though, I got a device working. It measures the temperature using an 18B20 and looks for a contact closure. Two endpoints that show up just great in Z2M (Zigbee2mqtt) under Home assistant. And then later in any dashboard or card that I want to use. I didn't find anything that could do this particular combination anywhere on the internet. Heck, there's only a few contact sensors out there at all. Here it is as it looked while I was working on it.


The 18B20 is plugged in to one of the expansion board ports; I used the chip version at first and then changed to the waterproof version when I installed it outside. This is a picture of it installed and actually working in the same enclosure that I used for the other pool devices.



It has been VERY reliable in  the months that it has been running. I used the Seeed 'case' for the expansion board to protect it a bit. Of course, I broke the first one I used; the little crack repaired with super glue is visible in the photo. Here's a close up:


Sigh, one has to be careful with those tiny plastic parts. Hey, superglue is great stuff, might as well use it. Speaking of glue, that "Alien Tape" that used to be advertised all over the place is actually great stuff. I use it all over the place, but one has to be careful because sometime it lets loose. I used it to mount the board, and it has held up really well so far. The other stuff is that 3M double sided 'tape'; you use that to mount something and then let it set overnight, and it is there forever. Shortcuts for the various projects we develop.

If anyone is interested in the actual code for this, it will be available on github when I finally overcome my reluctance to relearn how to use it. 

Friday, April 10, 2026

The Demise (sort of) of the Pool Controller.

Once upon a time I was controlled by my swimming pool controller a Goldline P4. It was an expensive piece of hardware that I got when the pool was originally installed. That thing was said to be the pinnacle of pool control, but in about 20 minutes of working with it I saw shortcomings that were a bit annoying. But, I kept using and working with it. 

At that point I started trying to overcome the various short comings. I installed an RF remote control from the manufacturer that turned out to have limited range and was constantly having to be moved to another spot to communicate with the pool. I broke into the control system and set up my own input to the communication protocol between the pool components <Link>. I installed a fancy variable speed DC motor trying to save on power, the list went on and on and on. Search for swimming pool here on the blog to see how much work went into trying to control that device.

That's why the first line says, "controlled by."

Well, the expensive variable speed motor was a bust and got replaced by a two speed pump <Link>. The much touted chlorinator got turned off and only used to keep the pipes connected. Basically, all the frills and fluff that I succumbed to were removed and I was back to a basic pool that has a chlorine float and periodic shocks because all that fancy hardware just didn't work on high calcium well water and climate extremes of the desert. So, one day I asked myself, "Self, why are you putting up with this controller?"

The immediate answer was that if I replaced it with something else, how would I get the 24 volt power I needed and the high current relays that ran the motor and lights? When I discussed this with a friend, he looked at me like I was stupid and said, you have those already in that controller. A light went on, and a journey began.


Above is the architectural drawing of what I wound up implementing to solve all the annoyances of the Goldline controller. I just gave up on controlling the controller and disconnected its relays from the big board inside; I would use them myself some other way. The 24vac supply in the controller would provide the power for the pool valves, all I had to do was come up with a way to connect them. Plus, using Zigbee kept me from having to dig trenches or cut wall board. In my previous post I mentioned that I have an extensive Zigbee network that has a router right inside the wall where the device was going. Heck, Zigbee keeps the devices off wifi, and is really fault tolerant. Perfect way to go.  

Well, the answer was obvious to me, use a couple of those Zigbee relay devices and connect them through Zigbee2mqtt into Home Assistant where I could create dashboards, automations, etc. to my heart's content. 

I started off getting the relay devices; I used two different ones because I had one type on hand from some experiments I ran a year or two ago, and I ordered another one with a temperature sensor in it to get the water temperature. 


Now, I needed a box to put the stuff in because this was going to be outside in the sun and rain. That's a big deal in Arizona because the sun will rot almost anything over time. Plus, there had to be protection from the rodents that infest the desert. It certainly wouldn't do for a pack rat to steal all the shiny things and take them home to its den.


I picked this enclosure on Temu. It turns out they have a big selection of this kind of enclosure, and the price was way less that something similar from Home Depot. Now, how to arrange the stuff on the side of the house where the pool equipment is? I came up with this because it is really simple and wound up high enough that I wasn't sitting on the ground to work on it.

Just try to get into that you packrat !! 
\
Now, to put the parts and pieces into the box, wire it up and see if it generates magic smoke or actually works.

Plenty of room for more stuff

The beauty of a nice enclosure is that it hides the wires inside where no one knows how sloppy one is when a project is getting near to the 'live stage, you're all excited to try it out and just slap things together. Someday I'll get back to it and organize the wires better (yea, right). I did realize that I was missing something though. Yes, all the planning and ordering and waiting and I still forgot something. In the Arduino mega that this was replacing, I had the air temperature and a contact sensor for my septic tank level switch. Shucks, that means I have to look into those.

I got an Xiao ESP32C6 from Seeed Studio along with it's little expansion board, an 18B20 out of a box of them I have from something I never completed and made my very first Zigbee sensor. It has two sensors exposed in it one for the temperature and the other for the septic tank float contacts. This was a coding experience that I had never done before and was a bit of a challenge. But I got it going and even have the tiny little display scrolling with updates that I seldom look at. 

Yes, someday, I'll clean up the wiring...

A note on using the 18B20: Yes it's waterproof, and you can actually drop it into water and it will work just fine. However, how do you keep it in place? If the water is flowing, how do you keep it from leaking? If you're putting it into an environment where shiny stuff gets stolen by packrats, how do you protect it? The answer, Thermowells. 


I used them in two places for this project. One is in the picture above; it sticks out the bottom of the box in the shade to measure the air temperature, and the other is inserted into the pool water flow to measure the water temperature when the pool motor is running. 




This works great to keep leaks from driving me nuts and the rats from stealing the sensor. They solve a lot of mounting problems, and the threads allow commercial piping to work. Take a closer look at the way I did that. The T fitting and the plug are standard PVC fittings I picked up at ACE Hardware. I just threaded the thermowell into the hole with a little teflon tape. Leak free seal against the water pressure of the pool pump. I wish I had known about them years ago. Now about the wrapping I have on the wires. This stuff is new to me, and an attempt to keep the various rodents (squirrels, rabbits, rats, mice, etc) from tearing the wires apart. 





It claims it keeps cats from chewing the wires. I don't worry about cats (except the occasional bobcat or mountain lion), but I'm trying this to keep the rodents out. So far so good (months) because it's wire that wraps around the various cables exposed outside the boxes and conduit. I picked it up on Amazon. A warning though, wear gloves when you put it on, the wires can be damaging to fingertips.

But what about power to the new stuff? Well, there's 24VAC, 120VAC, probably 5VDC somewhere in the Goldline; I didn't use any of those. Instead, I used a tried and true technique (to me anyway). I used a small cell phone charger.


These little things cost roughly a dollar (US), and work fine for low current applications. They won't fast charge a cell phone, but they supply enough 5vdc to power this kind of electronics. Plus, you can get cables to adapt them to any device you happen to have. I plugged one of these into a plug on the side of the Goldline, ran it up into the new enclosure, and the split the power to each of the devices according to whatever kind of plug it had. In case you haven't run into that idea yet, there are USB power (not data) cables that split into two or more other plugs. Using the appropriate adapter, you can power anything, and not have a special buck converter. These little plugs have a wide input range 90-250, and actually work. I have them all over the place. I bought ten of them a few years back, and just used the last of them on another project (another 10 on order right now). I mean a power supply for a dollar?? Heck, I've used them to get 5vdc from a 240vac circuit and it held up well. Yes, occasionally they fail, but for a dollar, I don't care. 

Well, I had it physically constructed, and had wired the little relays in the left Zigbee relay controller to the big relays in the Goldline controller, and the right Zigbee relay controller handled the 24vac valves, so let's join this thing to Z2M and see what happens. Basically, it worked really well. Some of the usual messing around with naming the various Home Assistant devices and entities and then some dashboard work, and I had a control system for my pool that could do any darn thing I wanted. 

Victory !!


Now, if I was to do this over again with a new house, and a new pool, I would never even think about all the bells and whistles that I originally suckered into. A basic two speed motor, and some Zigbee devices hooked into Home Assistant would be all I need. Hayward could just find some other dude to sell their expensive, limited, failure prone hardware to. 

(Note: If you’re wondering why the septic sensor isn't live yet, let’s just say while I was moving gravel, I gave the local packrats a clear shot at the wires. They took it. Round one goes to the rodents.)

The little zigbee sensor using the ESPC6 was a great little project that you might be interested in; details on that project are upcoming. Stay tuned.