Comet NEOWISE

As seen from the Everglades to the west of Miami

ESP8266 RGB controller

I had a sizable pile of infra-red RGB controllers that came with every RGB LED strip I’ve ever purchased. Still, one was never around when I needed it, and the transmission range was so small that I’d have to move closer to the LED strip to change the color anyway. Finally, there were really only a few unique colors – most looked the same as the next. I decided to instead replace the RGB LED PWM generator with an ESP8266 (as a NodeMCU) that I could control via a web interface from my phone.

For the code I found this excellent resource: https://tttapa.github.io/ESP8266/, in particular, I took the Chapter 14 example and made some updates to support the LittleFS file system (the only change that’s absolutely required is the SSID and password for your WiFi access point): https://github.com/daecks/ESP8266/tree/master/Examples/14.%20WebSocket/A-WebSocket_LED_control

Given that I had a couple of RGB signal boosters, I did not need to use high-current MOSFET transistors to drive my 15-foot LED strips, and instead I chose to use 2N2222 NPN transistors because I have an ample amount of them. The RGB LEDs in the strips are SMD 5050s, which are rated at 60 mA per LED channel. The strips come with their own resistors, so all that’s needed is to drive the NPN transistor with the correct base current.

To have the transistor act as a PWM switch, the recommendation is to have the collector-emitter current be 15-times that of the base current, meaning my base current would be (current per LED / 15) = (60 / 15) = 4 mA, which the ESP8266 can handle (the limit is 12 mA per pin). The voltage output of a ESP8266 GPIO pin is 3.3 volts, and the voltage drop across the transistor is ~ 0.7 volts, so given this and Ohms law, I could determine the base resistor to use: V = IR, R = V/I, R = (ESP8266 voltage – transistor drop)/ 4mA = (3.3 – 0.7/ 0.004) = 650 Ohms. The closest resistance value to this is 680 Ohms, so I went with that.

Schematic for circuit
Breadboard layout
The final result
The web interface for controlling the color

References

On working from home

I follow DHH (creator or Ruby on Rails, among other things) on Twitter and he always has great insights on tech. I found myself one day reading the Basecamp (of which he is a co-founder) employee handbook, thinking it was going to be something like the one from Valve, but to me this was so much more. I stopped reading every now and then to think “wow, can work life possibly be like this?” and was left wondering how I as a small cog in a corporate machine could hope to make any changes like this.

Then COVID-19 happened, and the very corporate environment that I used to work in shifted to something closer to their ideals, but honestly still far, far away. I wondered what other advice Basecamp had regarding working from home, and found their book “REMOTE: Office not required“. It’s a great read at only a few hours, is packed with information, and helped me out with adapting to working from home. From it, I’m going to be reading at least one more book: “On Writing Well” (my reading list is just getting out of control, though not nearly as bad as my Steam games backlog) and I’m going to bring my 32-inch 4k monitor at work back home – I don’t know what sort of crazy I was thinking by leaving it there.

Configuring OSMC for high quality audio

And what I mean by that is, “default all audio output to a USB device, not unlike an O2+ODAC kit from JDS labs”.

Step 1: Install OSMC, which is a Kodi-based media entertainment distribution that can run on Raspberry Pi (https://osmc.tv/download/)

Step 2: Configure ALSA audio to use the USB audio device as the default (this way, I don’t always have to keep the USB device powered).

dmesg output when connecting the USB soundcard

Check which cards are identified by asound

“cat /proc/asound/cards” output

I have to make the USB audio device the default, in slot 0. Edit the file /usr/share/alsa/alsa.conf and change the default device to be “1”, thus, USB audio will become “0”

defaults.ctl.card 1
defaults.pcm.card 1

Reboot the device, run “cat /proc/asound/cards” again and check the order has changed. Regardless of whether the USB audio amp is actually plugged in on power up, whenever you do plug it in, it will come up as the default device and audio will be routed to it.