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:
   local remote control
Saturday, April 13 2024

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

Happily, I woke up this morning with no hangover (or else an extremely light one), suggesting it is possible to take pseudoephedrine and drink alcohol without ruining the next day.

I spent the entire day working out the details of the local editor for my remote control system. As I've already explained, the idea was to create a web page served from the ESP8266-based NodeMCU itself that would allow the GPIO (general-purpose in/out) pins to be controlled directly, thereby overriding the usual source of information (a Linux server out on the internet) for what state those pins should take. I was having no problem dynamically generating such a page with checkboxes using data in a JSON object served from an endpoint on the ESP8266. But now I had to work the opposite way, taking data generated from clicking on those checkboxes to make changes on the ESP8266. To do this, I'd have to send data to an endpoint on the ESP8266, and none of the examples I had showed this being done. I'm at the point now where I don't bother to Google how to do specific things that require significant amounts of qualifying information, since Google often can't come up with a page where someone is doing what I want to do. Instead I used ChatGPT, which hones in directly on my language like a very attentive and knowledgeable slave. In this case, though, it probably would've been better to ask Google, because I ended up getting stuck in a loop with ChatGPT. Initially it acted like I could read query string variables in a manner similar to how NodeJS does it, but then this required a whole additional library called ESPAsyncWebServer. And then every suggestion ChatGPT made for fixing the problem led to failure. At some point I became so exasperated that I asked the soulless chatbot "so is there a way to read query string parameters in ESP8266 or is there not?." It responded "Absolutely!" and began the loop of useless suggestions again. So I turned to Google. Within seconds, I'd found a great example that resulted in code that looks like this:

It turns out that all the query string variables are accessible as server arguments that I can iterate through and read without any additional libraries at all.
With that out of the way, I decided to go from theoretical to practical and upload the new code into the NodeMCU providing remote control down in the basement. In so doing, I discovered a number of little bugs, the kind that don't reveal themselves until you're controlling multiple pins. I also added an important feature: human-readable names for the entities being controlled as well as the name of the device itself.

Somehow I'd started the work on this part of the project assuming that the frontend for local control would actually be a web page as rendered by a web browser, and thus the HTML and Javascript I'd written would be part of control panel providing local control. But then it occurred to me: ideally the control panel would just be another ESP8266 with a display and some buttons. It might not even need a display if I manually wrote what each button controlled next to each button (that wouldn't be super flexible, but it would work, especially if I had some way, such as LEDs, to show the state of the system being controlled). For such small, low-power microcontrollers, I could maybe build a simple menuing system (such as the one I built for the Atmega328 slave in the solar controller), but a modern web browser capable of faithfully executing Javascript was out of the question. (The minimum device for that would be something like a Raspberry Pi Zero, which is unnecessarily power hungry.) So I was going to have to also build my control panel from scratch. But building the web interface wasn't a complete waste of time, since to get that working I had to also implement the API it uses, and my control panel would be using that very same API.

Meanwhile I was being pretty neglectful of the dogs. Eventually I took them on a walk out to the end of the driveway and then back home through the woods southwest of the driveway. The dogs stayed out for awhile after I got home, and hopefully they were getting good exercise. At the cabin, Charlotte does a lot of self-guided adventuring, something she doesn't do was much back in Hurley. Sometimes she's gone for over an hour and I even start to worry about her.


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

feedback
previous | next