Wednesday 28 September 2011

TP-LINK TL-WR703N - a tiny Linux-capable device for under $23 delivered

Update June 2012: As many have noted in the comments, TP-Link sadly decided not to release the TL-WR703N in Europe / America. The TL-WR702N looks identical and is available internationally, but it will not work (it only has 2MB flash)! The closest alternative is the MR3020. This has the same internal hardware as the TL-WR703N, but its case is a little bigger (7.4cm x 6.7cm).

Unless you've been living under the geek equivalent of a rock for the past six months you'll have heard of the
Raspberry Pi project. The embedded device they are building will offer incredible power for the $25 it is projected to cost when launched in November 2011. A slightly higher specification 'Model B' (with more memory and a 10/100Mbps Ethernet interface) will cost around $10 more.

The prospect of having a well specified device the size of a credit card, consuming minimal power, that can run Linux is tempting many (including your author).

Patience is a virtue waste of time

But what if you can't wait? There are plenty of options available today that can run Linux:
  • Intel Atom based devices: Intel's low power CPUs dominate the netbook market, but have failed to dent the mobile/embedded space. You can find plenty of Atom-based mini-ITX (17cm square) boards and enclosures out there, and there will be plenty of options to use big disks, add more RAM, and so on. All of this comes at a price - not only financially, but also in power consumption and physical footprint.
  • PC Engines Alix: A little known Swiss manufacturer, PC Engines has been producing high quality x86 boards for many years now. The Alix series utilise the AMD Geode CPUs. These are starting to look a little long in the tooth now, and the price is relatively high (around $100 for the board alone, without enclosure, power supply, etc).
  • Linksys WRT54GL: No list of embedded devices that can be hacked to run Linux would be complete without a reference to the WRT54GL. Sadly this device is looking very dated now - it only has a 200MHz Broadcom CPU and it peaks at around 30Mbps WAN throughput.
  • Modern routers: The Linksys WRT160NL, Buffalo WZR-HP-G300NH, Netgear WNDR3700, TP-LINK TL-WR1043ND (and others) all utilise Atheros chipsets and are supported by OpenWrt (an embedded Linux distribution discussed below). Whilst these are all great devices, they don't have the low cost and small physical size that gives them the 'wow factor' of the Raspberry Pi.
  • Ubiquiti NanoStation: This tiny little device is the only one mentioned that I've not experimented with myself. Whilst its footprint and OpenWrt support are appealing, its 180MHz CPU and relatively high cost ($79) leaves me wanting more.

All of these are either far more than $35 (I'm assuming we all want network connectivity), physically too large, have too little grunt, or a combination of the aforementioned.

So is that it then? Should we pack up our things and just wait until November/December for a tiny, lower power device that can run Linux? Not just yet.

And in the red corner...

TP-LINK is a Chinese consumer networking equipment manufacturer that many of us in Europe and America would not have heard of a year ago. Today they boast of being the largest broadband CPE manufacturer in the world (by market share), but this isn't why we're interested in them.

In early September 2011 TP-LINK launched a new device in China snappily dubbed the TL-WR703N. This device is designed to be a portable 3G WiFi router; plug in a USB 3G dongle and the device will broadcast the Internet connection via Ethernet and WiFi. But again, we're Linux enthusiasts, we're not fussed about what the devices was intended to be used for.

Let's take a look the specifications:
  • Atheros 400MHz MIPS CPU
  • 32MB RAM
  • 4MB flash
  • 10/100Mbps Ethernet interface
  • 802.11b/g/n wireless interface with one internal antenna
  • USB 2.0 port
  • Micro-USB power socket, approximately 1W power draw
  • 5.7cm x 5.7cm x 1.8cm dimensions

There's no video output of any form (nor would you expect there to be on a 3G router!), so this is not going to be playing Quake 3 any time soon. That said, this is perfect hardware for a headless Linux box. And you needn't buy an extra case, wireless card, Ethernet module, power supply, etc - they're all included.

And the cost? It's not available outside of China yet, but you can order it from volumerates.com or some Alibaba sellers for about $23 (US) including delivery. I'm told it will start being sold in the US and Europe over the next few weeks.

Show me some pictures!

And now for a brief visual interlude from all this text:

The box has a very Apple-esque feel and the device is clearly aimed as a competitor for the Airport Express

In the box: Some manuals, a USB to micro-USB cable, a Chinese USB to wall plug adapter, and the device itself
The size of the RJ45 port provides a sense of scale. Also pictured: micro-USB power, reset button and power LED.
The device uses the Atheros AR9331 SoC

OpenWrt: An embedded Linux distribution

OpenWrt, for those that are not aware, bills itself as "a Linux distribution for embedded devices". It's entirely free, entirely open source and actively maintained. It's aimed primarily at users wishing to reflash their wireless routers with something far more powerful than the manufacturer's firmware. Such devices typically have very limited flash storage, RAM and processing power, so OpenWrt needs to be very frugal with its resource usage. Hundreds of common Linux applications are available via their packaging system, and if what you want is not available then the tools are provided for you to build it yourself.

But OpenWrt will not run on every wireless router. A list of supported devices is published here. But when you consider how many router models are out there, the number of supported devices is quite limited. 

TP-LINK has a very positive reputation inside the OpenWrt community due to their almost exclusive use of Atheros chipsets (which have strong open source support). So when I first saw this device I knew there was a very strong chance that OpenWrt could run on it. Less than a week after donating my TL-WR703N to the project, the OpenWrt developers had incorporated full support for it. Success!

Installing OpenWrt on the TL-WR703N

Installing OpenWrt on the TL-WR703N is very straightforward. To summarise the steps involved:
  1. Connect a network cable between your PC and the TL-WR703N, and set a static IP on your PC of 192.168.1.2 (subnet mask: 255.255.255.0)
  2. Head to the TP-Link admin interface on http://192.168.1.1. Login with user "admin" and password "admin"
  3. Find the Router Upgrade link on the left-hand menu (or go directly to http://192.168.1.1/userRpm/SoftwareUpgradeRpm.htm)
  4. Upload the latest OpenWrt snapshot for the TL-WR703N
  5. Wait 4-5 minutes for the firmware to upload and the device to reboot. The blue LED will be lit solid when it's finished.
  6. You should be able to telnet to the device on 192.168.1.1 and receive an OpenWrt prompt (no password required)
If you want a web interface on the device then you should:
  1. Set a password on the device (use the "passwd" command). Note: once you've done this you will need to SSH to the device, telnet will be disabled.
  2. Configure /etc/config/network with an IP address, gateway and DNS servers that allow the device to access the Internet. Either reboot the device or run "/etc/init.d/network restart" to apply the settings.
  3. Run "opkg update" and "opkg install luci" to install the web interface.

Living with the TL-WR703N

So what can you do with this tiny $23 Linux device? If you've read this far then you've probably got some ideas already (I'd love to hear them), but here's a few thoughts:
  • The USB port needn't be used for a 3G dongle (the original intended purpose). For example: Plug in a USB hard disk, install Samba, and you've got yourself a tiny little NAS.
  • It's easy to forget the device has a WiFi interface. You could run a tiny wireless access point / bridge, or a wireless network scanner, or IDS, or ...
  • The fact that it can be powered by micro-USB means you can power it from nearly anything that has a USB (host) port. Your existing router perhaps? Your monitor? An in-car USB power adaptor?
  • Mobile phone battery packs (which typically have micro-USB connectors, now that they are the standard) could be used to power the device for portable use.
  • The CPU and Ethernet interface are surprisingly powerful - if you configure it properly you can easily saturate the 100Mbps interface (I've tested this with iperf both in TCP and UDP modes).

Just as importantly, here are some key limitations (these apply to many OpenWrt-based devices of course):
  • You're not going to have much luck running large application suites on this device. For example, a full Apache / PHP / MySQL stack is not going to be viable (due to RAM and storage limitations).
  • The wireless antenna is a strip mounted on the PCB, so don't expect wonderful coverage.
  • Don't keep writing to the root file system (a flash overlay): repeated writes will wear out the flash chip. Use /tmp if you can live with temporary storage, or attach additional storage via USB. This applies to most OpenWrt supported devices.

Conclusion

The TL-WR703N running OpenWrt is a formidable embedded device. It has a solid feature set, a tiny form factor and a low price tag. What's not to like?

I've written this post in the hope of sharing my enthusiasm for this device. Almost everyone I've shown the device to has been staggered by its form factor and every person has a different idea for how to use it. I think it has the potential to become an extremely popular device and I'm really looking forward to seeing what people do with them.

Further reading

  • The TL-WR703N wiki page on OpenWrt.org. If you have additional insights/comments that might be useful to others, then please register and contribute to the wiki!
  • The OpenWrt forums are a good place to start for questions or issues. Be sure to search the forums and wiki before posting.
  • If you're a Chinese user, right.com.cn has a dedicated OpenWrt section and has a lot of recent threads on the TL-WR703N.
  • Further photos at a higher resolution are available in my Picasa album.