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 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???
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.
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:
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:
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.
No comments:
Post a Comment