Early to rise and early to bed, makes a man healthy, but socially dead. -- Animaniacs

I Made a Thing! Clock Radio Project

This is a GE 7-4680A clock radio. There’s nothing much that’s special about it. They pop up on eBay a few times a year for prices in the $25-$45 range. I have no idea when it dates to; its date markings are in some kind of code. I know they were produced at least as early as 1982, probably much earlier. It has an AM-FM radio and TV audio tuner that’s backlit with a small incandescent bulb. Its single monaural speaker has a nice warm tone. I don’t know what it is about old speakers. They don’t sound perfect, but they tend to always sound fine. Modern speakers either sound great or sound like shit, with nothing in-between. Setting the time is limited to two buttons, one of which advances the clock slowly, the other advances it quickly. If you miss, you have to go all the way around 24 hours to try again. It has no battery backup, and has to be reset after even the briefest of power outages.

Click to Enhugen

One very much like this one sat on my mom’s nightstand as far back as I can remember, up until some time in the early ’90s, when she got a new one, then it sat on my headboard for the rest of the ’90s and then it went off with me when I moved out. It had what I’d always assumed was a little fresnel in the clear front panel over the dot that lit up to indicate PM. Turns out that was actually a cigarette burn.

By 2016, a couple of the LEDs were dimming and the front panel was loose. There was a short in the time-setting buttons so that if you pushed them, there was a chance it would just instantly jump ahead 78 minutes. So I started looking for a replacement on eBay, and ended up buying two. Some time in 2017, I dropped the water tank from my CPAP machine on it and the alarm started buzzing and never stopped. That’s why the one in the picture there is not the one I grew up with.

I have an unreasoning nostalgia for this model of clock, though it’s certainly not anything useful or modern. So since I had both a fully functional replacement clock and also a spare, I decided to build a thing.

You’ll recall that a few months ago, I gave Dylan a small network-connected music player I’d built. And part of that project was coming up with a quasi-standardized way to put together a Raspberry Pi Zero W-based network connected music player. So I reckoned, why not take that, and make a clock.

Three Texas Instruments CDB4543B BCD-to-7-Segment Latch/Decoder/Driver chips

So that’s what I did. I had a go at using the original display panel, since it was a much better fit. But it’s weird ’70s LED technology with a 20v forward voltage drop. Where the hell was I going to get 20 volts to drive that? And then I burned one of the lights out trying to figure out the pinouts. The driver chip for the LED had a number on it that led me nowhere, so I was shooting in the dark for how to make it work; the display itself had a 20-pin ribbon cable that had become stiff and fragile with age. There were more lights on the panel than the clock actually used, including a colon for separating hour and minutes. None of the pins seemed to work it.

So instead, I got four 7-segment modules and hot glued them into a frame made of styrofoam, cut to size. The displays had a little decimal dot in the corners, so by turning the first one upside down, I got the AM/PM dot for free.

Continue reading I Made a Thing! Clock Radio Project

Ross Codes! A Music Player for Dylan

So guess who just finished Kindergarten?

I am not making this up: one of the buses in our neighborhood (not his) says “Torchwood Transporation” on the side.

Congrats, little boy.

In recognition of Dylan’s Kindergarten Graduation (which I guess is a thing), I built him a present. Dylan likes to listen to music when he’s going to bed, just like I did when I was a kid (honestly, just like I did pretty much up through my twenties). And since he’s also been getting into Doctor Who, he took an interest in the possibility of listening to some of my Doctor Who radio adaptations (The BBC productions are pretty safe. I’m going to have to heavily vet the Big Finish ones). Since his MP3 player’s got a modest capacity and modest battery life and is a little cumbersome to load, I decided that, as a Kindergarten graduate, he was mature enough to have a network-connected music player.

So I built one.

This isn’t going to be a full instructable, since, as per usual, I just sort of fumbled my way forward until it worked and neglected to document things. But maybe it’ll be enough to get you started.

The Hardware

Okay, so I did not actually start this project specifically for Dylan’s sake; I’d come up with the idea of making small networked music players last year with the goal of just coordinating Christmas music between the family room and the dining room. IoT speakers are a thing now, obviously, but I wanted a few things specifically:

  • To play music from my local collection on the NAS, rather than streaming it from a cloud service, particularly one that would ask my to buy or subscribe to things I already owned
  • To synchronize playback between multiple devices
  • To just be a music player and not quietly listen in on me all the time waiting for its moment to betray me when the robot empire takes over help me buy more lightbulbs or whatever.
  • Fit inside the 1960s clock radio I inherited from my parents

The obvious choice of base platform for something like this was the Raspberry Pi Zero W, a ten dollar Single Board Computer that has onboard wifi and bluetooth and is about the size of a key fob (the fancy big ones where the key switchblades out of the side).

Fir Meit

The full-sized Raspberry Pi models have analogue audio output. The original hardware versions had a dedicated headphone jack, while later ones use a combined jack that carries analogue audio and video. But the zero drops the analogue jack altogether. Apparently, you can produce analogue audio on the GPIO pins by just adding a couple of resistors in the right places, but there’s another option.

Its called a “bonnet” because its a cute little HAT. Get it?

As with most Raspberry Pi products, demand outstripped supply for a while, so part of the proximate motivation for this project was that Adafruit had this bundle which included the Zero along with a bonnet (ie. a tiny little sidekick card that plugs into the top of the Pi. Ones scaled to the full-sized Raspberry Pi are called “HATs”) that could drive 3 watt speakers, and a set of speakers. (Adafruit also sells the bonnet separately, but at the time, bundles were pretty much the only things that would stay in stock long enough for a normal human to buy them). The included speakers aren’t great, but they’re at least as good as the speaker in Dylan’s MP3 player. I only ended up using the Adafruit speakers for the first one I built. For the second, I attached RCA plugs and used the speakers from an old bookshelf system we were getting rid of. The third one, I have wired to the ancient speaker from my clock radio, which sounds fantastic, but the poor thing isn’t putting out enough power to drive it at full volume.

This project required a bit of soldering, and on my first try, I donked it up a little, damaging the pad for one of the pins I needed. Fortunately, I was able to attach a header elsewhere and use a jumper wire to move the signal to the right pin. I also had a few DHT11 temperature sensors lying around, so I wired that up to the other pins so that my device could also mesh with my household network of sensors.

For a case, I gutted an old 10/100 ethernet switch. It was a tight fit. Too tight, if I’m being honest, but it was what I had on hand. I drilled holes through the top and hot glued the speakers under them. There was just enough space in the middle for the bonnetted Zero… if you didn’t connect the USB cables that it needed for power. But I jiggled things around and finally got it to more-or-less fit with the help of the fact that a network switch’s case has a hole in the back where the network jacks go. The second version, the one which had RCA jacks instead of integrated speakers, I enclosed in a modified electrical outlet child safety cover. That one I’d hoped to just stick inside the speaker housing, but thanks to some miscommunication, Leah had donated the set of speakers I wanted to use to charity and kept a different set. No big deal. Version 3 isn’t done yet because even though the pi and supporting hardware is a lot smaller than the clock radio’s original innards, it’s the wrong shape and I’m still working out how to fit it all inside.

We bought a three pack of 100 mbit hubs. I cant remember why.

The first device, as built, promptly got plugged in and stuck on my nightstand where I never bothered with it. It has, you may notice, no user interface. It has to be controlled remotely, and a smartphone is a perfectly good way to do this. But once I got it into my head to give this device to Dylan, that wasn’t going to cut it. I mean. half the motivation here is to let him listen to music in bed without giving him a tablet.

I spent several hours looking at human interface devices before it suddenly occurred to me that I’d bought a bunch of USB gamepads of various designs a few years back and only ever used them once or twice (I also bought a powered 20-foot USB cable as part of this experiment. It never worked great. I think the powered USB cable was introducing some kind of jitter. I eventually tried switching to bluetooth, and had various problems from not being able to connect at all to being able to connect, but then needing a reboot to get it to reconnect once the controller had gone to sleep. But that’s a tale for another day). So with a bit of work, I managed to cram another USB plug into the Zero, and now I had a gamepad connected to the music player.

Rarely has there been a controller more perfect for converting into a remote control than the SNES controller.

The Software

For the OS on the Zero, I went with Raspbian Jesse Lite, a stripped-down flavor of the default Raspberry Pi Linux distribution. The “Lite” here was important because I had some fairly small SD cards that I wanted to get some use out of. But there was a bonus here I only learned later. The full Raspbian image installs X, the standard Linux windowing system. Because normally you’d want that on a computer. On all of my previous Raspberry Pi setups, I’d gone ahead and left X installed in case I ever needed it, but set up the pi not to launch it automatically. And this was all very good and fine, but I’ve discovered that if you do install X, then PulseAudio, the standard engine for accessing the audio hardware in most contemporary Linux installations, gets configured in a way that assumes X is running. When I tried setting up a regular Raspbian installation to run the same music software as my Zero-based devices, I ran into an issue where every time as song finished, PulseAudio would panic over the fact that it couldn’t talk to the X session it was expecting to be there, and crashed. And several things I did which I thought ought to have set this right just didn’t work. I can get it to play one song, and then I have to manually restart a bunch of daemons to get audio working again. If you never install X, this doesn’t come up and it all just works.

For the music player itself, I went with MPD, the Music Player Daemon. There’s a few things about it I’m not crazy about, but it seems to do everything I wanted. For my purposes, one of the nicest features is that you can slave one installation to use another installation’s database. Because of the small storage space and limited processing power on the Zero, this was a godsend. But even if those weren’t issues, the fact that I can maintain one database on my main media center computer and have it apply to every media player in the house is literally the thing I wanted out of this. A common repository of songs and playlists for as many devices as I want. Each individual instance can also publish its own audio stream via HTTP, so I can point any player in the house at any other player in the house and they’ll play the same thing. There are other solutions which can accomplish something similar to this, but my setup with MPD lets me choose which rooms play which things; they don’t all have to be the same. I can have the family room and the dining room play one thing, while Dylan’s room plays something else, and once I build a couple more, I can arbitrarily mix and match.

I installed MPD on my main media center computer, a much beefier i5 system running Linux Mint. The installation is a little different there, since that one is running X, so the MPD process gets run as a user application rather than a system daemon. It hosts the main database. The smaller devices SMB or NFS mount the NAS to reach the music files. MPD doesn’t actually require this: it can speak SMB and NFS directly. But there seems to be a weird bug where if you do that, filetypes other than MP3 don’t work. I wanted to support my old MIDI collection, so I had to actually mount the filesystem. Another little quirk is that while MPD supports automatic volume normalization, on the Zeroes, this made the playback weird and crackly and clipped. It worked fine on the media center. Another issue is that the audio bonnet doesn’t expose any hardware volume control, so I needed to configure PulseAudio to do volume control in software, and then configure MPD to use the software volume controls.

The other major quirk had to do with networking. MPD had a number of frontends you can install. When I’m at my computer, I just use the command-line client, MPC. For my phone, I installed MALP. Of all the MPD clients I’ve found for Android, MALP is the only one which makes it easy to switch between multiple MPD instances. Most of the others assume you only have one MPD server. The downside to MALP is that it requires a pretty recent version of Android. That might not be a problem for you, but you know how it is with phone manufacturers and system updates. Of the dozen or so Android devices in our house, only three could run it. But I discovered an odd issue where if my phone went to sleep with MALP open and connected to one of the Zeroes, the Zero would lose its wifi connection. You could bring it back up by restarting the networking service, but that’s hard to do on a headless box that’s lost its wifi connection. I mitigated this by writing a cron job that restarted networking (or failing that, rebooted) if the network went away for more than a minute or two. Some searching led me to believe that this might be a bug in the kernel network driver, and very weirdly, it seems to be completely specific to talking over wifi between a Raspberry Pi (Either 3 or Zero W) and a Samsung phone. It hasn’t happened in a while, so I’m hopeful that some kernel update fixed it.

It’s not a perfect solution, even so. Streaming from one Zero to another is more theoretical than practical because of the CPU usage involved. And the streaming isn’t very tightly synchronized. Leah’s immediate reaction on Christmas was to be annoyed that the music in the family room was half a second ahead of the dining room. You can stream audio between devices with lower latency using other methods, but I wasn’t able to get it working in a way that still let me do all the other things I wanted.

The last leg before I gave it to Dylan was to make it controllable via the attached gamepad. For that, I banged out a perl program to translate gamepad input into commands to MPD. If you are interested, here it is. It requires the Input::Joystick module from CPAN, but is otherwise pretty much self-contained (Just plugged the gamepad in and it showed up as an input device. I’ve been using Linux long enough that it still amazes me when I plug something in and it Just Works). It works by invoking the command line MPC client. I know that’s a little suspect (It also logs by making shell calls to the command line “logger” command, which is even more suspect. I am lazy). There are a couple of MPD modules in CPAN, and I’ve worked with them before, but one of them had a lot of dependencies I didn’t want to bother with, and I had some strange performance issues with the other. In addition to translating input from the controller, it implements a sleep timer and a volume limiter. I also designed it with the ability to cycle through a filtered subset of all playlists. You can just toss a new m3u file in your playlist directory whenever you like, and it’ll instantly be available (provided the name of the file matches the filter. In my case, that means that the name starts with “DYLAN”). Since I set up the playlist directory to be on the NAS, I don’t even have to log into the music player to edit the playlists. And, of course, I can remotely control the player myself via MALP or from any computer with MPC on it.

Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

Dylan was incredibly impressed (aside from a couple of times when he ran in to tell me it wasn’t working. Pretty sure that any time it took more than a tenth of a second to queue up the next song, he’d start hammering buttons and confuse the poor thing. It always resolved itself if he just stopped futzing with it for a second), and asked if I could add a screen. Which isn’t out of the question, but his goal here is a backdoor into being able to stay up all night watching TV on the DL.

I hope to build some more of these. I had this idea that maybe when Evie is ready for one, instead of a game controller, I’d hook up a camera and print cards with QR codes on them to control hers that way. Leah points out that she’d just lose the cards immediately (Though I suppose I could tether them to something).

Pizza!

I’m ridiculous, but I wanted to share this.

Last Friday, I got pizza from Domino’s for the first time since college. I’d heard that they did some soul-searching about a decade ago and discovered that perhaps customers didn’t like pizza that tasted like ketchup on a cracker topped by a slice of pasteurized processed cheese-food product, and re-engineered their offerings into something that could broadly be described as “pizza”, but I hadn’t gotten around to actually trying it. Dylan had been suggesting that he might like to since he’d seen a teacher eating some at lunch, and some coworkers were talking about their carryout special, so I pulled the trigger and bought a couple of pies, and you know what? It was pretty good. I liked it. Dylan liked it. Evie ate the cheese and pineapples off of two slices and begged for more. Leah thought it was okay.

So in celebration of this surprisingly edible pizza, I wanted to offer up the following meme:

Upon reflection, associating your pizza company’s mascot with avoidance may have been a misstep.

Misspent Youth: The Toothpaste Millionaire

There’s a handful of books I read — or more accurately, were read to me — in my youth which left enough of an impression that I’ve felt compelled to track down a copy thirty-or-so years later, particularly now that I’ve got little’uns to read them to. This is still a work in progress. Evie’s not old enough to appreciate The Frisky Kittens or Piglets at Sea yet, and I think I should give Dylan another year or two before I spring The Westing Game or From The Mixed-Up Files of Mrs. Basil E. Frankweiler on him. But we made some headway recently when, on the second try, he got interested in Jean Merrill’s The Toothpaste Millionaire.

Jean Merrill is best known for an earlier book, The Pushcart War, which I bet is pretty surreal to read now since the publishers keep pushing forward its then-near-future dates to keep them near-future, but probably they haven’t updated Merrill’s writing style to be less full of charmingly dated minutia. Also, odd coincidence, Merrill and I have the same birthday.

I don’t remember exactly when we read The Toothpaste Millionaire in school, but it was definitely during Media Center (even back then, in the misty murk of history, “Library” was deprecated). Over on the far side where there was a clearing that served as a small presentation stage, flanked by the bookcases of Hardy Boys books, sitting in a position whose old name I completely agree was inappropriate and had to go, but for which they have not yet invented a replacement name I can possibly take seriously (“Criss-Cross-Applesauce”? Come the fuck on. That is stupid. That’s worse than “letter-carrier”. Get the folks who came up with “firefighter” on this. They know their stuff).

The basic story is this: Kate McKinstrey and her family move from Connecticut to Cleveland, and the first friend she makes is a clever and economical boy named Rufus Mayflower, who helps her make saddle bags for her bike. Erelong, Rufus develops an obsession with the cost of toothpaste, and decides to go into business selling his own homemade baking soda-based dentifrice under the name brand-name TOOTHPASTE, and sells it for three cents a bottle. To say that hijinks ensue is being a bit hyperbolic. Spoilers: Rufus makes a million dollars.

The book is pretty funny. Dylan found it hilarious, in fact. It’s not, if you’re an adult, that much happens which is especially silly in itself; in fact, the whole book is a series of people acting reasonably and making rational decisions. But there’s a lot of comedy in the outsider point-of-view and the… Let’s say child-like plainspokenness. Have you ever tried to explain a complicated social concept to a child, like why we segregate bathrooms by gender or why it’s not socially acceptable for men to wear skirts or why we have capitalism, and halfway through realized that it actually is, in fact, ridiculous? That happens a lot in this book. A lot of “Well why not?”

What I noticed on this read through is that the structure of the book is a little strange. The book is largely presented as Kate recapping how Rufus solved a series of logistical problems. The narrative is sort of fragmentary because of this: each chapter is essentially a separate episode, and the linking between individual scenes is generally pretty weak. Some chapters are barely narrative at all. For instance, one chapter covers Rufus doing a TV interview. In a more traditional narrative, you might have a scene of Kate and Rufus talking beforehand, and a scene of Kate watching from the audience and her thoughts and feelings as Rufus goes on the air. But instead, we get a chapter that’s mostly exposition, with Kate dryly explaining about the local talk show, a transcript of the interview itself, and a coda talking about all the new orders they got, including an anecdote about an order from someone in California who’d been on the phone with a relative in Cleveland when the interview aired.

The style works for me, and I think it would work for most kids with engineering-type minds, who’d be more interested in the problem-solving than in any sort of character-driven narrative. Even in the ’80s when I first read the book, there was a weird uncanniness to the ’70sness of it too. Kate accidentally buys five gross of toothpaste tubes thinking she’s buying five dozen, though it still only ends up costing her like five bucks. Which is a lot of money back then.

But having said that, I find that my memories of the book aren’t weighted proportionally. Virtually all the conflict in the book comes in the last fifteen pages, and it feels almost entirely offhand, even though my memory tells me it’s a major theme (My memory also tells me that Kate also bought a barrel of aglets on a lark. This didn’t happen at all, and now I’m wondering if maybe that’s something I am remembering from a different book? Anyone recall a book where the narrator and the protagonist go to an auction and the narrator buys a barrel of aglets?). Another thing I remembered from my youth was a pervasive sense of Rufus being a little “off”. Back in elementary school, I wouldn’t have had the concept, but Rufus, with his obsessiveness over waste, his fetish for honesty, and his frequent displays of frustration at people acting like people, definitely struck me at the time as being on the spectrum. Reading it now, I didn’t get that impression at all, and I’m curious where it came from, whether I was projecting from something else, or maybe it was something I was nudged into by the teacher? The whole of the conflict is squeezed down to just a couple of chapters, the main one of which is deliberately gonzo.

After the major toothpaste brands start folding as a result of the ensuing price war, the remaining players invite Rufus to a “conference” about the health of the industry. It turns out to be an attempt to involve him in a price-fixing scam, which ends when it turns out that the FBI just happens to be in the next room over and promptly arrests the heads of the competing brands. Kate presents this in the form of a screenplay, having decided that she’d like to be a screenwriter specializing in torn-from-the-headlines dramas. And then the chapter ends with the offhand reveal that the toothpaste factory was blown up by a gangster working for the mob.

Continue reading Misspent Youth: The Toothpaste Millionaire

I’m going to keep trying until one of these attains memehood.

I’ve been trying to do this for a long time but couldn’t find the right font. So I gave up and used Just Some Font instead.

Scooby Doo Mystery Machine
Click to Embiggen

You can make your own jokes about them pulling off the zombie klansman’s hood to find it was really Old Man INSERT-TRUMP-ADMINISTRATION-FIGURE-HERE all along.

Kinda moving…

So apparently Google’s so hell-bent for everyone moving to https that they’re going to start popping up warnings in the near future if you go to a non-SSL page.

This prompted me to buy an SSL certificate. But unfortunately, my web host sucks ass and was able to confuse me into buying a certificate which only covers www.trenchcoatsoft.com, and not blog.trenchcoatsoft.com.

Well, actually, I think they manipulated me into buying both, but they only gave me the first one. They’ve agreed to refund the money, but they’re now claiming that they don’t even offer ssl for subdomains.

So I decided that, since I’m not really using my main domain for anything (I’ve got some ancient software up there, which I’ll make available again if anyone complains), I’ll just shove the blog over to the main domain. Which means that from now on, you can get to this blog, with all the safety and security that a green lock up in the address bar implies, at its new URL, https://www.trenchcoatsoft.com. The old url, http://blog.trenchcoatsoft.com should still work as well, and any deep links you’ve got on hand will work as well, just unencrypted.

So you may now visit in the happy knowledge that evil haxors will not be able to intercept you as you read my ridiculous blog about failed ’80s TV series.

I don’t believe it’s so.

The next couple War of the Worlds posts are already scheduled so they’ll probably run on time unless I decide not to, but I don’t know if I’m going to keep going after that. I no longer enjoy writing about apocalypses now that I live in one.

But I wanted to share a few lines from a song that would have been featured in today’s post if the human race hadn’t just proven that they deserve the extinction that’s coming faster than ever now.

 

Once, there was a time when I believed,
Without hesitation,
In the power of love and truth to conquer all,
in the name of salvation.
Tell me what kind of weapon is love, when it comes to the fight?
And how much protection is truth, against all Satan’s might?

 

Hate wins.

I am done with you, my fellow Americans. Fuck you all.

Y’know what? I’m white. I’m straight. I’ve got money. I am going to be hurt less than a lot of people. So as Emperor Trump destroys the economy and you motherfuckers have to explain to your starving children that you voted for a rapist because of something to do with emails that you don’t even understand yourself, when you’re kowtowing to your Russian overlords as the KKK drinks to their triump, I’m going to just enjoy the fucking schadenfreude of knowing that you motherfuckers got the president you wanted. I’m gonna laugh my ass off when you fuckers in Florida are drowning because that “Chinese hoax” has submerged your state. We offered you equality, and you wouldn’t take it. There’s nothing left I can do to help my gay friends, my muslim friends, my transgender friends, my hispanic friends, my female friends from the pain that’s been unleashed on them, They will get the worst of it, but I promise that you will burn too. All that’s left for us now is to make sure that when you burn us down, you burn with us. Fuck you all.

I’m sorry Dylan. I’m sorry Evelyn. We failed you. I failed you. The human race failed you. It’s not right and it’s not fair and I don’t know if you’ll be able to fix it. If the world even still exists when you grow up, you should curse us and spit on our graves for what we did to you. I am so sorry. Don’t forgive us. Don’t ever forgive us.