Arduino + OpenWRT = Art

It’s an OpenWRT image for the very cheap TP-Link TL-WR703N Linux routers you can buy from here: http://www.dealextreme.com/p/tp-link-703n-ultra-mini-portable-3g-802-11b-g-n-150mbps-wifi-wireless-router-light-blue-white-102903

What’s cool about them is that with the OpenWRT (https://openwrt.org/) Linux operating system, you can make this router do whatever you want, including broadcast a Wifi access-point, run Linux applications, etc. The REALLY cool thing is that it has a fully working USB port too! This means you can connect various devices to it such as USB storage, Arduinos, Launchpads, etc and even multiples of them on hubs.

I made a ready firmware version for the router that is configured to do this http://nemik.net/tmp/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin

It is designed to make the TL-WR703N talk directly to Arduino’s and MSP430 Launchpad microcontroller kits by simply plugging in the kits into the USB port. Older Arduino’s will use FTDI drivers and make a /dev/USB0, new Arduino UNO’s make a /dev/ttyACM0, and TI’s MSP430 Launchpads make a /dev/ttyACM0 device. You can talk serial to them all directly then!
Just set the baud rate by doing something like:

stty -F /dev/ttyUSB0 raw speed 9600

and replace /dev/ttyUSB0 with /dev/ttyACM0 for Arduino UNO’s and TI Launchpad kits and 9600 with the baud rate you programmed your kit/sketch to.

You can read serial data from the kits with something like

cat /dev/ttyUSB0

and write to it simply by doing

echo "hello world" > /dev/ttyUSB0

I also packaged in SQLite and some other stuff I found useful. The .config can be found at http://nemik.net/tmp/openwrt_arduino.config

The Launchpad USB support comes from a new patch I submitted here: https://lists.openwrt.org/pipermail/openwrt-devel/2011-November/012919.html which I hope can get added to the trunk if it’s OK. It enables those drivers in the kernel, they’re already part of the kernel source.

This is not bad to use if you know your way around Linux. I disabled wireless on it and by default it listens for telnet until you set a root password for SSH with ‘passwd’.
Its subnet is 192.168.3.1 and if you plug a computer into its LAN port, it should issue an IP by DHCP on the 192.168.3.x subnet.

I hope it is useful for someone.

For an example, I used it to help a friend with an interactive art installation. It’s an art installation in Chicago called “Hatchery”. The website for it is here: http://www.popupartloop.com/active.php?id=123
It’s a sculpture inside a glass building with two photosensors on the outside measuring light. When a person places their hand on one of the sensors, it detects it because the difference between them is greater than some threshold (ADC’s are needed for this part) and then as the hand is held there, it starts a cool LED light sequence. If we make a video for it, I’ll post it here later.
Anyway, what also happens is that when the hand is placed there, the Arduino sends a serial string with something like “Touched!”. A program running on the WR703n (to which the Arduino is hooked up with over USB) listens for this and when it gets it, logs it to an SQLite database that resides on a large USB stick. The router also broadcasts a wireless access point that I can connect to from my Android phone and hit a certain URL to download that SQLite DB whenever I walk by. It’d be nicer to make it available direct on the internet but there are no public access points in the area for it to connect to.
Then I take the SQLite DB and do some queries on it to do a few simple analytics such as how many people touched it at what times, hours, days, etc. The analytics page is available here: http://nemik.net/hatchery/

I hope it’s some inspiration make your own networked devices using Launchpads and these unbelievably cheap yet powerful Linux machines.