Restarting the brainwagon blog?

I wonder if i trained a large language model on the contents of this blog and used it to generate new posts, whether it would generate interesting enough stuff to at least shame me into creating new posts?

This would require that I actually learn something about this topic at least. Although it probably would also require some hardware that I currently don’t possess.

brainwagon is 20 years old today!

It was twenty years ago today that I first posted something to my brainwagon blog. While I have sort of fallen out of the habit of posting to this site, it still remains as an testament to my inability to concentrate on a single topic for more than a couple of days. I keep thinking that I should stop posting to Quora, and should instead refocus my efforts to the sorts of things that I used to routinely blog about, but I haven’t quite gotten back into it. It’s not that I have stopped doing nerdy things. I still am doing woodworking. I want to get back to rebuilding my first telescope. And I’ve spent more than a little time building a “homelab” computing setup. But I haven’t mustered the degree of concentration and the sense of community that used to drive me to blather on inside these pages.

Oh, and I have been caring for stray cats too.

I hope all of you are well.

Experimenting with ESP8266/Tasmota Firmware…

Hey gang, I know it’s been quite some time (since last May apparently) since I posted anything new on the blog. It is not that I haven’t been doing projects. The continuation of the COVID-19 pandemic generally means that I’ve had a lot of extra time, and have been tinkering with a bunch of different projects and learning new skills. I just haven’t felt much like writing them up.

But I realize that I miss some of the interactions that writing a blog brought about, so maybe it would be good to write up a detail or two of some of the projects. We’ll see how successful I am.

Today’s projects will center around microcontrollers based around the ESP8266 (notably the WEMOS D1 Mini are some of my favorites) and the Tasmota firmware.

The WEMOS D1 Mini

If you haven’t encountered the ESP8266 microprocessor before, you can use google, but the basic idea is that it’s a small controller which is both very cheap and allows access to WiFi. They come on various boards, but one of the most popular is a small board which is called the Wemos D1 Mini. I’ve used them in a few of my own projects before, including an internet enabled clock and my old half life clock that I built a while ago. Did I mention they were cheap? You can get five of them for $17 or so from Amazon. That’s even cheaper than clone Arduino Nanos, and did I mention they have Wifi? They have Wifi.

Programming with platformio

The Arduino has been popular in part because it has a friendly set of libraries and an IDE that can be used to program them. It turns out that with a little work, you can pretend that the ESP8266 is just a different type of Arduino, and all your skills could transfer into programming these things.

But I prefer to http://platformio.org which is a more command line driven approach. You still program the same way, but you can use your favorite editor (vi for me) to create the source code, and can compile and install using simple command line tools. It also provides convenient access to a lot of different libraries.

Using platformio I had created a bunch of different projects over the years. For instance, I created this clock to download ISS data from the Internet and provide a small display with the location of the ISS.

I’d also made clocks, and a variety of adhoc sensors like https://brainwagon.org/2018/12/09/how-not-to-code-an-simple-iot-sensor-and-a-new-task-list/comment-page-1/. But each time I wanted to do a fairly simple sensor project, it kind of meant an afternoon of programming. Granted, not particularly difficult programming, but neither was it trivial. I kind of wish there would be a simpler way I could attach a simple sensor to the esp8266, and get it routed to a server for logging, graphing or data analysis.

Tasmota Firmware

A couple of weeks ago, I was doing my usual browsing/tinkering, and encountered something which I hadn’t considered before. https://github.com/arendst/Tasmota is a firmware that can be downloaded to ESP8266 (and more modern ESP32 boards) that are often used for IOT peripherals. I had used it before when I experimented with SONOFF switches. Here’s the product page. These are cool because using them you can create a switch which doesn’t rely on any cloud architecture to run: you can control it with simple MQTT or HTTP messages. But I had missed a couple of things that I hadn’t realized before.

First of all, you can install the Tasmota firmware very easily on the WEMOS D1 Mini. The easiest way is to bring up the Tasmota Web Installer on chrome, and select any one of a bunch of precompiled versions of the Tasmota firmware, each with different sets of potential sensors or capabilities. You then simply add your sensors to the board, fire it up and configure it’s wifi and MQTT settings, and you have a capable little sensor.

The first of the many applications that I saw was actually something I was interested in. Ikea sells an air particle sensor box which costs just $13.00. This is considerably cheaper than some of the other sensors I’d experimented with before. But out of the box, it just lights an LED bar to indicate the air quality (green for low, yellow and red for higher levels). By itself, that sensor is not particularly useful. I want to have quantitative data, and to be able to log the data to an MQTT server.

Luckily, someone had done the heavy lifting before me.

A quick trip to Ikea purchased a pair of these little guys. This afternoon, I opened one of them up and did the necessary modifications to add a WEMOS D1 Mini with the appropriate firmware.

I could have added another sensor directly in case (there is plenty of space) but I chose to simply create a second WEMOS that used a SHT30 temperature/humidity sensor that I had a little carrier board for. Both send their data to an MQTT server.

Node Red front end

I could have written a little Python script to slurp up data from the MQTT server and produce graphs and the like, but there is an interesting alternative: Node Red. It’s a sort of graphical programming system that allows you to wire up data sources (like MQTT inputs), process them in various ways, and send them to various other outputs. It is also a convenient front end for creating UI elements that respond. After an hour or so of tinkering, I had the following:

Node Red UI elements

Not too shabby. I experimented with similar things before, and also had the data injected into an InfluxDB database, which provides for linger term storage. I’ll probably work that up again.

A couple of years ago, I also did similar data logging using the INA219 voltage/current sensors on a small solar power setup that I created. At that time, I used custom firmware but I now believe that I could do the entire project without any of that programming. I could simply make a couple of small modules that run Tasmota, and do all the data logging with MQTT and Node Red.

I also discovered that the Tasmota firmware also can serve as a controller for a display device. I had an 8 digit 7 segment display controlled by a MAX7219 chip, which is one of the potential displays that the Tasmota firmware knows about (it also nows about a variety of E-ink and TFT displays). You can send commands to the board using HTTP or MQTT to tell it to send information to the display. In a few minutes, I had it displaying the time, essentially making a small internet clock. That seems pretty cool. I ordered some small OLED displays that I can do more experiments with. I’ll probably need to compile a custom version of firmware to use both the sensors I want and the displays, but it seems like an interesting thing to play around with.

Future tinkering

It’s a fun thing to play with. Inexpensive sensors and displays, wired into your own servers, with little-to-no programming. I like it, and will be looking for other possible projects to make use of my new knowledge.

Hope some of you found this interesting.

A cornucopia of updates…

Sigh. The new version of WordPress is doing stupid things with images. I’ll fix them later.

Okay, so roughly a month ago, I said that I was interested in rebooting this blog, and then once again I lapsed into silence. It’s tough to make something a new habit, even if it is something that you wish to do. But it’s not because I’ve had a lack of new things that I’ve been working on: it’s simply that I’m out of practice in terms off writing about them. Rather than try to frame each of these different things into a consistent, well framed narrative, I am simply going to dump out some of the things that I’ve been working on.

I’ve been interested in writing emulators for old computers for quite some time. In the past I’ve written an emulator for the DEC PDP-1 so I could run SpaceWar!, one of the very first video games. A couple of years ago I wrote an emulator for the 8080 microprocessor so I could make an emulator for the original Space Invaders games. It worked rather well. While goofing around a few weeks ago, I tried to recompile it, but had some difficulties which I eventually ironed out. I also relearned a small amount of the subtleties of that hardware which I had forgotten. Nifty. But it also got me back into being interested in writing another emulator.

I had already been doing some research into the old Atari arcade game Battlezone. I had long wished to actually understand more about how this game managed to achieve the 3D graphics which were quite revolutionary for its time. I had also considered trying to figure out how to extract the vectors that it draws, perhaps with an eye to creating a bit o hanging wall art using EL wire and the vector shapes. Luckily, a bit o work on the internet lead me to the vector ROMs and how the backdrops were encoded. This, combined with some very simple (and very slow) vector rasterization code I wrote lead to me extracting some very cool outlines directly from the arcade roms.

That was fun. I briefly considered writing a full emulator for BattleZone, but it seemed difficult because while the main processor for the machine was my old familiar pal, the 6502, it also included a custom processor that was designed to handle the math necessary to render the tanks in 3D.

So instead I embarked upon creating an emulator for the Atari game Asteroids. It too had a 6502. I started trying to write my own emulator. It’s pretty straightforward to do a half-assed job of this, and I got about 60% of the opcodes implemented before I got grumpy, and decided to cheat by using http://a rather nice little 6502 emulator core which was placed in the public domain. Over the next several days, I managed to get most of the emulator cobbled together while watching Psych reruns. It started out pretty rough. In particular, deciphering the abstract functioning of the vector generator took me a while to sort out.

But I eventually got it sorted out. Note: the 6502 emulator above doesn’t have a proper implementation of BCD mode in the 6502, which makes the scoring incorrect until you sort it out. In the end though, I got it working.

In other news, I went to an estate sale and got a couple of other goodies, including an antique PS&W draw knife, an old Vlchek auto wrench, and a very large (75 pound) Rock Island No, 574 vice.

I cleaned up the draw knife with some 320 sandpaper and WD-40, and it turned out pretty nice. I soaked the wrench in some vinegar for 18 hours, and then hit it with a wire brush and it turned out well. The vice is a work in progress. I disassembled it all to base components, and in the process got tons of old grease all over my workbench. What a mess. I applied some Citristrip to bring the entire thing down to bare metal, and now the project is stalled while I consider how I’m going to finish the vise. Here is the new one with a smaller Babco vise for size comparison.

In other news, we’ve been taking care of a couple of feral cats whom we’ve named Whittaker and Patches. Whittaker is a 10 year old male. He got into a fight with something six or eight weeks ago, and we ended up trapping him and taking him to the vet, where he got some antibiotics and was neutered and microchipped. He tested positive for FIV, which makes him not a good candidate for adoption given that I have two indoor cats already, so he’s back out roaming. Patches is a female who was obviously pregnant around the same time. We’ve suspected that Whittaker is the daddy for a long time, given that they occasionally show up together. She was obviously nursing for some time, but we hadn’t seen the babies. Until yesterday.

Patches and Whittaker showed up with five kittens, three of them sort of patchy (although with little orange that we see in mom) and the other two inky black solid color. My guess is that they are 8-10 weeks old. We are trying to see if we can lure them all down again at once so we can have them trapped, get mom fixed and maybe see if we can get the babies rehomed before they go full feral.

I’m running out of energy, but a couple of weeks ago, I was experimenting with creating anthotypes. They are a photographic process that uses non-color dyes, usually derived from plants. Of particular interest to me was using the spice turmeric. You can create a solution of a non-color fast yellow dye by dissolving some in alcohol and painting it onto paper. You then can sandwich a “negative” (which is actually a positive) which I created by printing a black and white image onto some clear transparency, and then exposing it in the sun for around 40 minutes. The yellow bleaches out and yields a yellow print which has very low contrast. But you can “develop” this print in a solution of borax and the yellow will turn a darkish brown. The print is still low contrast, and has questionable longevity, but it was a fun afternoon to give this a whirl.

Anyway, Patches is now out back and looking for some food, so I think I’ll give her some and prep for work. I hope you all are having a good week.

Welcome back…

WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.