If Henri Bergson had been writing around the turn of the millennium, he would have talked about abstraction violations. In his time, it was about living beings acting like mechanisms. For me this weekend, it was about digital devices acting analog.
I love my Blinkytape, so when I got email announcing that there was a special run of addressable christmas-tree lights with the same built-in arduino-compatible controller, my response was pretty much “Shut up and take my money.”
A couple of boxes arrived from China way sooner than I had imagined, and I got the strings out and powered them up and enjoyed the glorious color-chaser factory demo for a while. Then I took one over to my mac, plugged it into a USB hub, and got ready to code some patterns that wouldn’t make my spouse claw her eyes out if they were on a tree.
Nothing doing. The string did its factory demo thing just fine, but the arduino IDE could not program it. Sometimes it thought that the controller on the other end wasn’t emulating a Leonardo. Sometimes it thought another program was already in control of that USB port. Sometimes it thought “resource busy”, and sometimes it even thought the program had uploaded correctly, but the string of lights didn’t do anything different. I shut down all my other programs, restarted the computer, got code transferred. Once.
Then I tried PatternPaint, the Processing-based app that Blinkinlabs makes for doing lightpainting-style animations. Mirabile dictu! It worked! So maybe it was just something weird about my mac’s USB handling? Macs are known to have USB problems with arduinos, after all. I headed for the Linux box in the basement.
More nothing. Sometimes /dev/ttyACM1 was there to write to, but no Leonardo on the other end, sometimes it wasn’t there at all (even though the string was still doggedly running the last pattern I had managed to put on it).
I fired off an email query to the company, just to get things started, and then went to check if maybe I only had one defective string. The second one was even worse: it wouldn’t program (but would talk to PatternPaint) but apparently the last 6 LEDs weren’t even connected, because they wouldn’t light at all. More useless troubleshooting, surprisingly quick answer from one of the Blinkinlabs folks, who offered a solid list of questions, additional diagnostic tips and possible fixes.
Then I wondered whether it might somehow be my hub, which was daisychained from another hub and might somehow be producing some kind of signal weirdness. But no, when I plugged an Uno into another port on the same hub it programmed just fine. (By now, some of you are wondering when I will get to the punchline.)
About 5 hours after starting down the rabbit hole, I plugged the string of blinky LEDs into the hub closest to my mac. No problem. I had code zipping right down and pleasantly staid red-and-green fades lighting up my room a minute or two later. Oh, and those 6 dead LEDs at the end of the second string? They were working fine.
The documentation warns you that if your hub is underpowered the product may not work (those LEDs would gladly draw an amp and a half at full intensity, after all). But it didn’t say anything about turning into a chimerical beast that works with some pieces of software and not others. (Now it will. Those guys are fast.) I can only imagine the knife-edge of marginal voltage levels that let the controller respond the way it did. (Oh, and yes, I tried timing the upload so it would happen when the LEDs were dark. Also no dice.)
After the strings started working, I did something else stupid: I’d been using one of those wimpy little narrow-gauge micro-USB cables that happened to be handy, and I decided to see what would happen if I switched to the big, thick, solid cable the strings shipped with. Maybe that would have a lower voltage drop and pass enough current for the controller to work properly. Maybe instead my keyboard would stop working. Turned out that the thicker conductors let the LEDs draw more more current and stress the hub’s power supply that much more.
Once I talked with an engineering-professor acquaintance told me the story of a student who couldn’t understand why an op-amp circuit with a gain of 20 and a 5-volt supply voltage couldn’t amplify a 300-millivolt input signal up to the 6 volts the equation said you were supposed to get. We both chuckled knowingly. Now you can chuckle at me.