Testing OpenWRT on a SLUG

As we started to work on our standalone Pandora player, I decided to do some testing with hardware that I had sitting around. I have a Linksys NSLU2 (“SLUG”) which I had previously loaded Debian Linux on and a SoundBlaster Live! 24-Bit External USB sound card.  In the past I had used MPD on the SLUG similar to the MightOhm project. The SLUG has a similar chipset to the ASUS router and is one of OpenWRT’s many supported hardware platforms. This makes it a good choice for figuring out what modifications need to be made to the pianobar software and default OpenWRT installation.

Yesterday I installed openWRT Kamikaze 8.09.2 on the SLUG using these instructions posted on the OpenWRT website. I was able to flash the new firmware from my Ubuntu laptop using the upslug2 utility. I then followed the openWRT Beginner’s Guide to gain access to the SLUG and changed the default IP address, which was the same as my actual router, and root password. I used telnet to change the password, but configured the IP address using the web interface. Since I wasn’t going to be using the SLUG as a router I decided to turn off dnsmasq, to prevent it from interfering with my actual router, and the firewall. This was done by issuing the following commands as root:

/etc/init.d/dnsmasq disable
/etc/init.d/firewall disable

The instructions also walked through enabling USB support and after rebooting it was able mount a usb drive and the usb sound card was listed in the lsusb output.

Following the instructions in Part 5 of the MightOhm guide I installed & configured kmod-usb-audiokmod-usb-ohci, & mpd. I used the default repository and not the one listed in the MightOhm guide since Kamikaze 8.09.2 uses the 2.6 kernel by default and MightOhm uses the 2.4 kernel to get around the wireless driver issue with the ASUS router. My sound card showed up as /dev/audio versus the MightyOhm’s dev/sound/dsp. The default repository does not include mpc so I installed Sonata on my Ubuntu laptop to control the MPD server.

I was able to playback mp3s, but the start of each song was kind of jerky. I didn’t encounter this problem with my previous SLUG setup.  That setup used ALSA instead of OSS, which might be the problem. So, I decided to install the packages alsa-lib and alsa-utils.  In order to get ALSA to work I had to manually add a user group called audio. By default, OpenWRT does not include any utilities to manipulate users or groups. To add the audio group I issued the following command:

echo "audio:x:2000:" >> /etc/group

After adding the group I was able to play a WAV file with aplay, but I have not been able to get MPD to work yet with ALSA.  My guess is that I have the wrong hardware listed in the MPD configuration, but I ran out to time to test it yesterday.

Building a Standalone Pandora Player

Around Christmas time I showed my Dad how to listen to Pandora stations on his TiVo.  The TiVo interface is really nice and allows you to listen without commercial, “Are you still listening?” breaks, or using any of your 40 free hours per month.  Shortly after my Dad asked if it were possible to get the same thing on the stereo upstairs so that my Mom could listen while in the Kitchen or living room.  I had looked into this previously and told him that the only two ways would be to hook up her laptop to the stereo or purchase a standalone device which would cost $100 – $500.  Neither option really appealed to him.

The problem stuck with me however.  As I mulled it over, I wondered if I could build a simple device dedicated to playing back Pandora for less than the commercial products.  I posed the question to my friend Matthew Beckler who is a Computer Engineer working on his PhD at Carnegie Mellon University and has a lot of experience with embedded hardware (check out mbeckler.org and wayneandlayne.com).  The idea intrigued him and we both started to do some research.  He found a this guide on the MightyOhm blog showing how to convert an ASUS router into a WiFi Radio. I found an open source command line Pandora player called Pianobar. Matthew figured we would be able to adapt pianobar to work with the MightyOhm project and help me interface a simple control pad and LCD display.

So we’re off to build a standalone Pandora player. This will be my first real project involving the use of micro-controllers and modification of source code, so I’ll be relying heavily on Matthew’s experience. You can check out our progress here.

Germany Day 5: Into the Mountains

Continue reading →