Hacking of the Linksys WRT54GS router

28 Apr, 2009  |  Written by Cristiano  |  under Making stuff

I check my emails quite often, probably at least every hour and most of the time I have no new messages. What I needed was a kind of visual notifier that lights a led or waves a flag or makes a noise when I get a new message. My first attempt was using I-Buddy, a funny USB gadget which is intended for using with MSN. When you get an emoticon I-Buddy flips the wings and lights its head. Quite good stuff. In the UK is available for around £15 but I got mine from the Ebay for £2.99 plus a couple of pound for the shipping. If you are a programmer it is possible to make I-Buddy do whatever you want using its API and any language compatible with the .NET Framework (for example C# or VB .NET).

So I wrote a little tool to check my mailbox and make I-Buddy flip the wings if there was a new message. Good enough but then I realised I wanted something working without the need of a computer turned on all the time. I already had a Linksys WRT54GS router modified to work with OpenWRT, an open source firmware working on many devices which turns your router in a real Linux box you can use as a web server, a proxy, a mail server or anything else. Personally I bought mine because I needed an Asterisk server at home and the WRT54GS was powerful enough to manage up to 4 simultaneously calls.

Now you should know the WRT54GS has 2 serial ports on the PCB which are not connected to the external world but they are there for us. I thought I could connect some type of display to one of the serial ports and then drive it with a shell script.

First thing I added a pin header to the router’s PCB and soldered four wires from the serial port to the pins of a PIC16LF628 microcontroller. The four wires are for the power supply (3.3V), the ground, TX and RX signals. I first tried with a PIC16F88 but because it works at 5V I had few troubles to make it talk with the serial port (which works at 3.3V).

So I had the WRT54GS router sending commands to a PIC microcontroller through the serial port. I just needed to things: a shell script running on the router that scraped from the internet the information to display. Secondly, I needed a display!

The shell script was quite easy. Because my domain is hosted by Google Apps, I can get the new messages reading a feed:

https://username:password@mail.google.com/mail/feed/atom/unread

The content of the feed is XML and I was interested in the <fullcount> element which contains just the number of unread messages. A couples of seds and greps to extract the information I wanted:

wget -O – -q "https://username:password@mail.google.com/mail/feed/atom/unread" | grep ^<fullcount>[0-9][0-9]*</fullcount>$ | sed ’s/<fullcount>([0-9]*).*/1/’ > /dev/tts/1

Note the redirection at the end of the command to send the result to the microcontroller through the serial port.

For the display I chose something simple because at this point I had already spent more than 2 months on this project. It is definitely a very simple project but it was the first time I made something like that.

So I used four 7 segment led displays. Each display requires 9 wires: 1 for each segment plus 1 for the digital point and one for the power supply. I had four displays so I needed 36 pins from the microcontroller: no way. Usually to reduce the power consumption and the number of required signals you turn on only one display at the time and change the active display very quickly so your eyes think they are all working. This classic way of multiplexing the led displays still requires 12 wire: 8 for the segment signals and the digital point (which are shared among the displays) and one wire for each of the four display power supplies. Still to much for my PICLF628 which has 16 I/O pins but 2 were used by the external oscillator, 2 were used to communicate with the router’s serial port and the MCLR pin actually works only as in input. So I was left with only 11 pins.

An article from instructables.com saved my life. It explains a different way to multiplex the led displays which requires only 9 pins to drive up to 8 displays. This method is called Charlieplexing and has the only disadvantage to make the microcontroller code more complex (spent two days to make it work!). Eventually I had the led displays working and still 2 spare pins to use for something else, maybe to drive a buzzer when I receive a new message.

I really spent much time on this project and it is not finished yet because I only built a prototype on the breadboard. I still need to mount the final circuit inside the router and create a hole in the router’s case to place the led displays. The final version of the shell script doesn’t download only the list of unread emails but also the balance of my Google Adsense account and the whos.amung.us statistics of a website I run. These values, as well as the current time, are all displayed in turn, one value at the time.

I will post a new article with the images of the final circuit mounted inside the router as soon as I get my new Dremel Series 300 (to cut the router’s front panel) from Amazon.

 

2 Responses so far | Have Your Say!

  1. Router hacking completed - cesaretto.it  |  June 1st, 2009 at 11:13 am #

    [...] eventually completed the project described in this article. The result is not as neat as I expected and in particular I don’t like the two screws on the [...]

    Router hacking completed – cesaretto.it - Gravatar
  2. ghfdlcdxcic  |  May 6th, 2010 at 7:07 am #

    TiQYwv zylwkasvsdau, [url=http://ihroygxgkikj.com/]ihroygxgkikj[/url], [link=http://jelswebmatbq.com/]jelswebmatbq[/link], http://hbhkliantdyd.com/

    ghfdlcdxcic - Gravatar

Leave a Feedback

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