~$ ./mike.sh --post 2

The Long Road of the Advanced Beginner

20 Mar 2010

This is the story of an Arduino electronics project I built. When you hear “Arduino,” you may think you know where this story is going, but you don’t. There are no schematics, no breadboard layouts, no code snippets. This is the project that carried my electronics skills from Advanced Beginner to Competent in the Dreyfus model of skill acquisition (with a nod to Merlin), and I’m disappointed to say it took me two years to do so.

I’m not going to describe the finished project, the code for that is available on GitHub. What I’m going to describe is the failed predecessor. It’s far more interesting, and it consumed 80% of the last two years. Briefly, though, the final project’s homepage is LanternHook.com, and it’s four Arduinos with WiShields and BlinkM multi-color LEDs that make a persistent socket connection to a Python Twisted service. Each lantern is available via a URL and functions as a physical webhook. The code explains how it really works.

Here is the auspicious beginning of my failed LanternHook predecessor. This photo was taken on January 20, 2008:

Mike's new electronics hobby equipment

Why, in this supposed Arduino project, are the most recognizable components on the desk Foneras? I’ll tell you in a moment. First, I was lucky with this project because the idea came to me quickly and clearly. I wanted a computer that didn’t look like a computer, and—like the Ambient Orb—I wanted something pleasing to look at that conveyed a little information. I also wanted to build four computers to live in my parents’, brother’s, sister’s, any my houses, and have them connected in some way. Having them interconnected meant WiFi to me, and as Rands would say that small but crucial decision early on had repercussions I was not prepared for. At the time, there were no Arduino WiFi options that were cheap and easy, but I found this post describing how easy it is to connect a Fonera to an Arduino over serial. Great, I thought, and quickly created a system that worked like this:

Fonera → Arduino → 2 BlinkMs

The Fonera runs Linux, so I setup a scratchbox in a virtual machine (requisite self-link) to build the packages I needed. It was snappy, too. The Fonera connected to a beanstalkd server, which meant it blocked on a socket that returned right away when there was a new command (color) for the lantern. Simple. If you’re an advanced beginner, I highly recommend emulating what I did up to about this point. Tie together some pieces you understand, and keep your momentum up by building a project in iterations. Demo it to people whose opinion you value. I demoed the lanterns in the summer of 2008 (with an iPhone app), and it worked great and looked great. Then why did this project take over two years instead of six months? Just when I could have written up the project and called it done, I decided to take one more design iteration. I had a good reason: The purpose of this project was to learn about electronics, but it was so simple that I hadn’t learned that much.

The hardware worked, but there was too much of it. The whole thing seemed too complicated. With the Arduino, it was more than a bit crowded it the top. Looked to eliminate some parts, and it seemed like a good idea to cut out the middleman, so I cut out the Arduino. This was the smartest and dumbest thing I did. It was smart because the Arduino wasn’t really doing anything except as as a serial-to-I2C converter. It was dumb because I should have asked myself why the Arduino wasn’t doing anything. This was an advanced beginner electronics project, where Arduinos are as common as the electrons themselves. Instead, observe how I ignored the warning signs I was plowing into a 18-month run:

First clue: It’s possible, but by no means easy, to get I2C working on the Fonera. You use these two GPIO pins next to the Ethernet connector:

002 Fonera I2C

Don’t ask me which one is for data and which one for clock, because you shouldn’t be considering doing this. I love installing and configuring Linux boxes, and even I got bored with all the work required to set up I2C. Even after I got all the software working—because I’m a software expert—it still didn’t work—because I’m an electronics advanced beginner. I needed 4.7k pull-up resistors to on the data and clock lines. Without them, no signal. I actually knew I needed pull-ups, but I used 10k resistors. I used the only guidance my advanced beginner skill-set contained, which was, “10k is usually a good resistor to add.” I know this is dumb, but it’s all I had, and it’s comforting to advanced beginners to have rules to cling to.

Second clue, and this is a big one: I started blowing BlinkMs. Meaning, the lights would stop working. I ignored the problem at first, thinking it was ESD. Then I figured out it was the BlinkM’s ATtiny micro that was blowing, and I ignored the problem again. Then the problem got to the point where I couldn’t ignore it:

Failed BlinkMs

That’s what failure looks like. 9 blown BlinkMs.

I sought advice on how to protect the lines, but the advice I got was still over my advanced beginner head. I tried crazy solution with regulators. Didn’t work. In hindsight, I may have been blowing the micro via the digital lines, not the power lines. I’ve sense learned the digital lines have even less protection. It didn’t matter, though, because I gave up. In fact, I almost gave up on the project entirely.

This is the point in the story where the advanced beginner needs a miracle. Mine came in the form of the WiShield. (By the way, the WiShield in the Wattvision box. It was kinda amusing to see when I opened the case.) The WiShield solved the problem because it meant I could give up and still move forward. It’s important to do both (give up and move forward) when you’re learning, but before the WiShield I couldn’t move forward if I gave up on the Foneras.

Still not done.

The project works so well now, and it’s wired so conventionally, that it’s boring. One hiccup though, is that the socket connection can get lost. I tried to add code to reinitiate connection, but it doesn’t always work. My current plan is to use a watchdog to reset the Arduino. Maybe add an external 555 timer as a watchdog, like the Practical Arduino blog describes.

The project is still not done in the big picture, either. Why does it require a Python Twisted service running on a server? It should be replaced with something more standard, but for now a socket connection from the Arduino was the best.

Here’s one of the finished lanterns.

Laternhook