10 minute project: Traffic counter for router

I’ve been joking about making a new case for my wireless router for a long time. The idea was that that would be shaped like a McDonalds store, with a little sign out front that says how many billion bytes (or whatever) have been served. Tonight, I decided to see how hard it would be to cobble together the technical portion of the project using an Asus WL-520 router running MightyOhm’s OpenWRT build and an old display that I had sitting around.

Using my python library as a reference for how to use the display, and my XML parsing script for ash, I was able to cobble together a working project quickly. My source code is after the break.

Now, to complete the vision, I just need to make some golden arches…

screen.sh is the script that figures out the amount of information transmitted by the network interface, and the second file is an example cron job to make an update every minute.

cat /root/screen.sh



# Configure the serial port
stty -F ${TTY_DEV} 9600 cs8

# Turn on the led backlight
echo -e "\x14\xff" > ${TTY_DEV}

TMP=${INFO#*TX\ bytes:}
TX_BYTES=${TMP%\ (*}


echo -en "\x0C" > ${TTY_DEV}
echo -n "McRouter        " > ${TTY_DEV}
echo -n "Served " ${TX_MBYTES} "MB" > ${TTY_DEV}

cat /etc/crontabs/root

* * * * * /root/screen.sh
This entry was posted in tech. Bookmark the permalink.

3 Responses to 10 minute project: Traffic counter for router

  1. Robin J. says:

    When I first saw this post (being the non techie person here) I thought it meant a traffic car counter. Then I thought about how excited the old people near our house would be with an automatic car counter so they wouldn’t have to sit outside. Then I realized what you meant. So then I decided it was okay it wasn’t an automatic car counter because our old neighbors would probably miss counting the cars by hand. Them not being able to personally see the speeders and loud breaking semi trucks would depress them. :)

  2. Pingback: LCD Router Traffic Counter - Hacked Gadgets - DIY Tech Blog

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>