Your leaking thatched hut during the restoration of a pre-Enlightenment state.

 

Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").



links

decay & ruin
Biosphere II
Chernobyl
dead malls
Detroit
Irving housing

got that wrong
Paleofuture.com

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff


Like asecular.com
(nobody does!)

Like my brownhouse:
   remote control with an ESP8266
Wednesday, March 20 2024

location: 940 feet west of Woodworth Lake, Fulton County, NY

There had been enough snow (two or three inches) overnight for me to have to climb up on the roof again and use the snow rake to clear the solar panels. I hate this job mostly because of its inherent dangerousness. The north slope of the roof, as I've mentioned, is not very steep. But your walking on snow, which is an easy material to slide on. I feel good traction when I'm walking in it, but if I were to fall and start sliding, how would I stop? And it's a long drop off the cabin's north side.

I spent most of the day up in the loft working on the software for cabin's remote control system. I was on a recreational 150 mg dose of pseudoephedrine, which, given my motivation to work on this project, was helping me stay focused. At first I was mostly working on the tools to manipulate data on the server, trying to make things as generic as possible with the idea of using the code as a basis for a framework I might use generally. But at some point I realized that this "framework" I was making was too dependent on the particular style of database I was creating, one without composite primary keys and having a particular naming convention. My generic tools were usable, but I was going to need better features of the kind that are all present in my classic tool Tableform, including automatically setting foreign keys when creating a record specifically connected to a record in another table. Tableform took years to perfect, so what was I thinking I could quickly crank out something as good?
The moment such discouraging thoughts filled my mind, I decided to shelve all work on the web-side tools, since they were already "good enough" to allow for the kind of remote control I wanted to perform. I turned my attention to the code on a sample ESP8266-based NodeMCU. To get such a device to be able to control things, it was going to have to pick up data from the server (data edited with the tools I'd been describing) and then, depending on that data, channel it to its general purpose input-output (GPIO) pins to then switch a relay to power on a device such as the boiler. It was easy enough to include returned data from the server for the specified device every time it sent temperature data. But that data was in the form of JSON, and I didn't yet have any experience parsing JSON in the Arduino environment. It turns out that doing this is not difficult, though the documentation for this material was surprisingly bad. Eventually I gave up on that and had ChatGPT produce a sample sketch where it parsed a JSON response from a server, and I used that as the basis for a function called setLocalHardwareToServerStateFromJson that looked like this:

As you can see, this function takes the JSON, finds the device_data node, and then reads all the information about the pins in there, setting the GPIO pins appropriately as either digital or analog values. (In Arduino devices, analog outputs usually produce differences in modulated pulses.) The code on the NodeMCU just takes whatever it gets from the server and sets the pins, meaning I can add new capabilities by wiring devices to pins and then adding some data to represent those pins to the database. All the code is in one of my GitHub repositories.
At some point I took a break from this kind of work and went out again with my big chainsaw to gather more firewood along the driveway. This time I was hoping to gather wood that was a bit drier than the dead black cherry I'd gathered yesterday. I found a smallish fallen beech that seemed right, and I gathered some of that. And then I bucked off another piece of that black cherry. Unfortunately, that piece was full of carpenter ants that quickly came out of their torpor when I later set a separated piece of its core on the top of the woodstove to dry. (I immediately took it outside and put it on the outdoor woodpile.)
Temperatures had initially been above freezing. But then a snow squall blew threw and temperatures plummeted after first coating the solar panels with an inch or two of snow. The sky immediately cleared, and, though the sun was going down, I didn't want to miss out on collecting its energy. So I climbed on the roof for the second time to use the snow rake. This time, though, I found a crust of wet snow had flash-frozen to the panels and I could only remove the fluff stuff lying on top of it.
For dinner, I made myself a vegan harvest pizza that I covered with slices of fresh mushrooms and a few slices of tomato.
Later this evening, I turned my attention to building the hardware support needed to do things like turn the boiler and the hot water heater on and off remotely. I'd brought some TBD62003s, an updated pin-compatible version of the classic ULN2003 darlington transistor array that I'd used with great success on the solar controller and in remote-controlled vehicles. It's the only device you need between a 12v relay and a microcontroller, though I wasn't positive it would work with the ESP8266's 3.3 volt logic. I fired up a soldering iron, soldered a 16 pin socket to a breadboard and connected the wires that would go to the microcontroller and the relays, though I mixed up the inputs and outputs on the transistor array, overbudgeting wire thickness for what turned out to be the inputs and under budgeting wire thickness for what turned out to be the outputs. But when I went to test it, none of that mattered and the relays clicked on and off exactly as I'd hoped as I changed the value column of records in the device_feature table of the database. This was a big deal, because now all that was left to do was to wire this up to circuits in the basement and then I could control them from anywhere I had access to the internet.


The outdoor woodpile today in a snow storm. Click to enlarge.


The Subaru parked to unload firewood in a snow storm. Click to enlarge.


The snow I would unsuccessfully try to remove from the solar panels this evening. Click to enlarge.


For linking purposes this article's URL is:
http://asecular.com/blog.php?240320

feedback
previous | next