Installing DD-WRT and Optware on the Asus WL-520GU

Posted on Dec 31, 2011 in UberFridge | 4 comments

DD-WRT capable Asus WL-520GU Router with USB HUB

A router + USB hub + USB storage can be a great stand alone Linux box

To unlock the full potential of an open source capable router, you can install DD-WRT and Optware. This turns the router into a great WiFi capable cheap Linux box. This article gives some pointers on the steps you need to take.

Why use an Asus-WL-500GU router?

The Asus WL-500GU router is one of the few DD-WRT capable routers that have a USB port. This makes it an excellent choice for communicating with Arduino. With a USB hub plugged into the router you can connect the Arduino and a USB stick for storage. The GU version has the most memory of the Asus routers and should be your pick if you want to run memory heavy python scripts.

I have bought my router second hand for 15 euro, compare that to a WiFi shield and MMC shield for Arduino at 50 bucks each. Having a router instead of a WiFi shield has many benefits:

  • The router can run the web server instead of the Arduino
  • Lots of storage space (4GB), with a file system
  • Access to files via SSH
  • The router can be a WiFi client in a home network or an access point in absence of other networks.

Installing DD-WRT on the router

To install DD-WRT on the router to unlock it’s full potential, follow this guide on the DD-WRT wiki. I am running DD-WRT v24-sp2 (05/17/11) mini-usb-ftp (SVN revision 17084M NEWD Eko). It crashed a few times, but is stable now. I don’t know whether it’s the best pick or not.

Initially I followed this guide on TodBot to get started with DD-WRT and Arduino, but only up to the point of installing the drivers. I don’t use JFFS, because I use USB storage instead of the internal router memory. I also do not use a ser2net proxy to talk directly to the Arduino, but I let JavaScript ask PHP to ask Python to talk to the Arduino.

It took me a while to find working drivers, so I am hosting them herefor your convenience.

I didn’t take notes while installing DD-WRT, so please use the guides for help.

Installing Optware

OptWare transforms your router into a fully functional Linux box for even more features than DD-WRT. It comes standard with the webserver lighttpd, auto mounting of USB storage and much more.

Because it comes with a package manager it is very easy to install python, pyserial, and anything else we need later. Just for fun I even installed irssi, an IRC client, so I could chat from my fridge. Worked really well actually!

By far the easiest method to install Optware is Optware, the right way by Frater. This one took me a while to figure out:

echo 0 >/proc/sys/net/ipv4/tcp_ecn

That command disables congestion notification, which caused errors when wget tried to download stuff for Optware. Execute it before you try to install. I have added it to my startup commands in the DD-WRT web interface (administration->commands). I also load the USB serial drivers in the startup code, so my startup code looks like this:

echo 0 >/proc/sys/net/ipv4/tcp_ecn
insmod /opt/serialdrivers/usbserial.o
insmod /opt/serialdrivers/ftdi_sio.o
insmod /opt/serialdrivers/acm.o

I used a gparted live cd to create the necessary partitions on the USB stick. I use a 2GB Optware partition, 512 MB swap and 1,5 GB data.

After installing optWare, disable all services you don’t really need, because the python script will need a lot of memory. The only services I have running are automount, reloc_syslog, lighttpd and fixtables.

Finally install the programs you need for UberFridge, with ipkg-opt

ipkg-opt install python

This guide probably isn’t complete, because I didn’t take notes at every step. If you think something is missing, please let me know.

4 Comments

  1. Your link for the drivers is broken…

    Additionally, I noticed you install python but mention nothing about the perl scripts and check_running.sh setup. Also the directory location to upload the python scripts.

    • The drivers link is fixed now, I forgot to fix it after loosing all data.

      The check running script checks whether python is running, when it’s not running it checks if it is supposed to be running and restarts it when necessary. The script is executed by a CRON job every minute. CRON falls asleep sometimes in version v24 of the router firmware, so it doesn’t work that well.

      The python scripts are in /mnt/uberfridge/
      The www files are in /opt/share/www/lighttpd
      The shell script can be anywhere, I have it in my home directory.

      • Thank you for the quick reply. I should of just read the comments in the file. duh. Thanks for responding though.

  2. Thanks so much for detailing this. I was amazed at the cost of the Wifi shields ($60+) and still the system is limited, and needs some other computer running all the time. Having all this in the router is just so much easier, not to mention more energy efficient.

Leave a Reply

Your email address will not be published. Required fields are marked *