Wow. For the first time in my life I've undertaken an electronics project and had it immediately work. I'm still a little shaken by the experience.
As you might recall, in my last post I discussed loading the custom, Linux-based DD-WRT firmware onto the Fonera router. I left off with some thoughts about using that environment to achieve serial communication with an Arduino.
Getting the Fonera to talk to my Arduino turned out to be shockingly easy. The 2200 Fonera model has a four-pin header exposed. The pin closest to the ethernet port is ground; next is serial receive; then comes serial transmit. I scrounged up a female pin header connector from a USB break-out bezel I had lying around (already half-cannibalized — last year I'd used the USB end to make the cable necessary for softmodding the office Xbox). That makes the photo to the right look a bit messier than it needs to. In truth I simply connected ground to ground, then the Fonera transmit pin to the Arduino receive pin.
The Arduino software environment's serial monitor only displays transmitted data, so I whipped up a quick program to read incoming data and echo it back out on the transmit pin (which wasn't connected to anything, but the Arduino's serial output is picked up by my macbook through the USB connection). You can see the program in the picture below. You can also see the result I got when booting up the Fonera:
It worked! First you see the bootloader, then a bunch of garbage. That's nothing to worry about, though. The bootloader runs at 9600 baud, which is what I had the Arduino serial link configured to expect. Once the bootloader is done, the DD-WRT environment takes over, and it ramps the serial port's speed up to 115200 baud, producing the cloud of gibberish that follows the bootloader.
Fortunately, that's easy to fix with the stty command:
All of us at EchoDitto are big fans of the FON project — we run a FON access point here at the office, and I run one at home even though my primary router is a much-more-capable WRT54G running an old version of the Sveasoft Linux firmware. I got my Fonera router from Phil, so I assume he's running a FON AP, too. We're trying to support the project — honest!
I say all this out of guilt. Last night I hacked a Fonera. I know, I know — they sell these things for next to nothing only so that they'll get distributed and the project will grow. But I don't have any more WAN pipes available to share! So I hope the project's sponsors will forgive me for succumbing to the siren song of $10 Fonera routers on eBay. I couldn't help myself from checking out what a spare unit can do.
"Kind of a lot" turns out to be the answer. The La Fonera is based on the Atheros chipset, which is found in a number of other commercial routers and supported by both the DD-WRT and OpenWRT firmware projects.
Sveasoft kicked off the custom router firmware scene, but the author's controversial attitude toward the GPL made them fall out of favor rather quickly. Besides, truly open efforts quickly outpaced the project. OpenWRT is the king of functionality, but also the most intimidating — they seem to have a general "GUIs are for chumps" sort of attitude. While I aspire to similar levels of snobbery, I'm more comfortable sticking with projects that have support forums filled with posts that are comprehensible to someone just getting started with the project.
Besides, I've had great luck with DD-WRT in the past, using it to successfully repeat a neighbor's faint wifi signal through my girlfriend's apartment (with permission, of course — but without having to do anything to his router, i.e. no WDS).