Tag Archives: OpenWRT

Jan’s Wifi Radio has a modern look

Jan Wante made this gorgeous Wifi Radio with a modern look. It is based on my original Wifi Radio tutorials.

Not content to simply duplicate my work, he added a few creative twists of his own, including a custom handmade case made of alucobond, MDF, and real wood veneer that gives his finished radio a nice, modern look. Inside, a hacked WL-520gU wireless router running OpenWrt runs the show and an ATmega microcontroller programmed with BASCOM interfaces with a rotary encoder and graphical LCD display.

The very impressive result is shown in this video:

Nice work, Jan!

Sneak peek at my finished Wifi Radio project!

While I’m busy working on part ten of my series on building a wireless router-based DIY streaming internet radio, I couldn’t resist sharing a few photos of the finished project.

If you want to see the radio in person, stop by Expo Hall Booth 166 at the Maker Faire in San Mateo, CA this weekend.  I’ll be there to demonstrate the radio and answer questions!

Finished Wifi Radio

Finished Wifi Radio

Finished Wifi Radio

Finished Wifi Radio

Building a Wifi Radio – Part 9, A Few Odds and Ends

This is the ninth part of an ongoing series about building a low cost, open source streaming internet radio based on the ASUS WL-520gU Wireless Router.  If you haven’t already, check out the previous parts (see the links at the end of this article) for some background about the project.

In part eight, we added a tuning control for the radio.  Now we can change to any of ten preset stations on the radio by adjusting the position of a potentiometer connected to our AVR microcontroller.   The LCD display we built in part seven lets us know what stream we’re listening to and the artist and title of the current song.  This project is coming together very nicely!

Before we put the final touches on this project in part ten, there are a few miscellaneous chores to take care of:

Fixing /etc/config/wireless:

Last time, we tweaked /etc/config/network to assign a static IP address to the LAN (ethernet) ports of the router.  This allowed us to directly connect a computer to the router via an ethernet cable and get a shell prompt, regardless of the state of the serial console or the wireless connection of the router.  Unfortunately, I made an omission in the setup instructions which may prevent this from working correctly.

To fix this, modify /etc/config/wireless as follows (changes are in bold, use your wireless network information in place of my example):

config wifi-device  wl0
    option type     broadcom
    option channel  3

    # option disabled 1

config wifi-iface
    option device   wl0
    option network  wan
    option mode     sta  # configures the router to connect to your network
    option ssid     MyNetwork # the SSID of your network
    option encryption wep  # the encryption mode of your network
    option key	XXXXXXXXXX  # add this line with your WEP key in place of X...X

The only change is to set “option network” to “wan” instead of “lan”.  This minor change tells the router to separate the wireless interface of the router from the LAN/ethernet interface and allows the router to acquire two separate IP addresses, one for each interface.

Launching mpd automatically at startup:

Manually launching mpd every time the router boots is a drag.  You can automate this by creating a symbolic link to /etc/init.d/mpd from the /etc/rc.d directory, as follows:

root@OpenWrt:~# ln -s /etc/init.d/mpd /etc/rc.d/S93mpd

Now every time the router boots, mpd will be started automatically as part of the boot process.  (That was easy!)

Boot script for the user interface:

Assuming we want a dedicated internet radio that doesn’t require user intervention to operate, the scripts for the LCD display and tuning control should also be launched at startup.  This will ensure that upon applying power, the radio will boot into a state where a stream is playing and the user interface is active.

First, we need to create a simple boot script.  Create the file /etc/init.d/AVR with the following contents:

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
start() {
sleep 5    # make sure boot process is done, no more console messages

To launch the script at boot, create a symbolic link as follows:

root@OpenWrt:~# ln -s /etc/init.d/AVR /etc/rc.d/S99AVR

Every time the router boots, the user interface will automatically start, mpd will start playing the selected stream based on the tuner position, and the AVR microcontroller (assuming it is still connected to the serial port) will update the LCD display and watch the potentiometer for any changes in position.

Tweaking the firewall configuration:

This is actually optional, but it can be pretty useful while hacking on the router.  As presently configured, the router blocks incoming requests on the WAN, which now includes the wireless interface.  This prevents us from using ssh or telnet to log into the router over our wireless network.  While we can still get a shell by connecting an ethernet cable to one of the LAN ports on the router, it is often more convenient to access the router across your wireless network.

The file /etc/config/firewall controls the firewall settings.  We’ll be modifying this file.

Open the file in vi and scroll down to this section:

config zone
    option name        wan
    option input    REJECT
    option output    ACCEPT
    option forward    REJECT
    option masq        1

Edit the “option input” line so that it looks like this:

config zone
    option name        wan
    option input    ACCEPT
    option output    ACCEPT
    option forward    REJECT
    option masq        1

Now restart the firewall (or just reboot the router):

root@OpenWrt:~# /etc/init.d/firewall restart

You should now be able to ssh or telnet into the router over your wireless network.

Enable SSH:

By the way, if you want to access the router with ssh instead of telnet, just set a root password.  The telnet daemon will be disabled (for security reasons) and replaced with an SSH daemon instead.  You can do this with the “passwd” command.

root@OpenWrt:~# passwd
Changing password for root
New password: *****
Retype password: *****
Password for root changed by root

Log out of your telnet session and use ssh to log back in with your favorite ssh client (don’t forget to tell the client to use the username “root”).

Stay tuned!

Wifi Radio Enclosure - Google Sketchup Model

That’s it for now.  Stay tuned for the final part in this series, part ten, in which I’ll talk about what it took to turn this Sketchup model into a real wooden case for the radio!

Update: Part ten (the final part in the series) is now online.

Video of my NOTACON talk now online

This week I finally got a working copy of the video of my talk from NOTACON 6 about hacking the Asus WL-520gU wireless router.  You can either watch the embedded video above or follow the link below to Vimeo.  If you don’t like either option, you can also download the m4v source file from here (thanks Vimeo!).

Special thanks to Media Archives for recording my talk!

NOTACON 6 – Hacking the Asus WL-520gU Wireless Router from MightyOhm on Vimeo.


notacon 6

It’s almost time to board the plane and I’m still messing with the slides for my talk at 1PM tomorrow in the East Ballroom at Notacon 6.

It’s a good thing this stuff is so much fun, otherwise I might ask myself – why am I doing this??

I’m hoping to meet some cool peeps at the non-con.  I’ll have Rescue Shield kits and stickers with me for anyone who wants to check them out. Even if you don’t see my talk, say hi sometime during the weekend.  I’ll be the nerdy looking tall guy in the black shirt.  Oh wait…