NetWinder-based automobile mp3 player
Version 1.0 on May 12, 2002

How to get your car/boat/plane rocking with a NetWinder mp3 player.

Background

With lots of time on my hands after Rebel.com went bankrupt, last fall I decided to drive to Alaska and check out the scenery. The round-trip distance was 16,000 km (or 10,000 miles) and much of it was going to be "in the boonies" where radio reception was sketchy at best. So it was high time to finally build myself an mp3 player, something I had been meaning to do since I first saw a NetWinder...

Hardware

First off, you need NetWinder with the audio hardware (eg. with an audio out jack on the back). Also, a large hard disk drive... I used a 10GB drive, though you can get by with less -- you'll just have less room for tunes. You can of course use something else as your MP3 player (eg. an iPAQ or RIO or the like) but that isn't the point of my story... :)

To power the netwinder, you can draw +12V directly from the cigarette lighter. However the power systems in most cars are horrible and fluctuate and spike alot, which has the potential to damage your netwinder. So the better solution is to buy a 12V-to-110VAC inverter, into which you then plug the netwinder's normal power supply. Throw in a powerbar and you've got a place to plug in your laptop, iPAQ or any other device you might want.

Then you need to connect the audio into your car stereo. This is probably the hardest part to figure out. There are many options:

I originally went for the CD-changer-connector option, but I couldn't get any specs on my car's stereo (it was a Blaupunkt dealer unit, which is incidentally for sale now..). Lacking the time or resources to reverse engineer it, I instead opted to head down to Futureshop and bought a JVC model with a frontside audio input. A few hours of cursing later (me: "so these things are a standard size and have standard connectors", salesman: "of course, yes sir, easy as 1-2-3 to install"), my problem was solved.

Optional: You'll want some way to control the playback on your netwinder. My choice was to use my iPAQ for this, connected via ethernet (overkill, but I happened to have it). Other alternatives are to use a plain old IR remote control, or to use a PC keyboard. Or even just the numeric keypad; you can buy them at Radio Shack and other places.

Arranging things

Since I have a SUV which does not have a trunk, I had to be resourceful in locating all the hardware. I did not want it to be in sight when parked so as to deter theft. I originally wanted to put everything in the dashboard, but there is not much room in there, and it also makes it harder to take the NetWinder indoors to "update" the MP3 collection. In addition, I also have a GPS and rooftop antenna to try and place.

I ended up mounting the NetWinder under the driver's seat with the fan pointing rearwards (this position was, oddly, the quietest spot in terms of being able to hear the netwinder's fan running when the ignition is off, but the stereo is on...). I had the all the "power" stuff (eg. inverter, power bar, assorted power supplies) under the passenger seat. The cables are all buried under the center console.

Software

This is actually pretty straightfoward, I used a base-3.9 disk image (eg. minimal version of dm-3.9), and I added apache, madplay, and a few other small things. The real trick is to make it survive in a car, without being shut down properly. The answer here is to keep the hard disk mounted read-only all the time. I create a RAMdisk that gets used for /var/log, some files in /etc, and /tmp directories.

One of my goals was to cut the boot time as much as possible (so the music starts playing as soon as possible after I start the car), and also to make it possible to take the netwinder out of the car and have it boot "normally" without too much fuss. I accomplished these goals by writing my own startup script, for use in the car. In otherwords I have the firmware set to "setenv cmdappend init=/myboot" by default, where myboot is my custom shell startup script. When I take the netwinder out of the car, all I do is (temporarily) clear the cmdappend and it boots up normally.

To play the tunes, I use madplay (homepage, my armv4l binary). I also wanted to be able to browse the songs and click on them to play them. So I wrote a little CGI script that runs under Apache. I have my iPAQ connected to the NetWinder and a browser running on the iPAQ. Note that I could have just as well used a laptop.

Here are the files I use for playing tunes. First, /root/player.pl is the control script, which gets launched automatically by myboot. Note that I run it as user nobody so that the Apache CGI can later kill and start a new one. The player.pl script first kills of any other instances of itself, and any other madplay instances. It uses /root/mp3/index rather than scanning all the songs each time. Then it either plays the specified song, or picks one randomly. It then plays remaining tunes in the order specified in the index file.

To generate the index file you can use my mkplaylist.pl script. This should by run by root whenever MP3s are added or removed. By default it produces an alphabetically sorted list in index. It also produces a /var/www/html/mp3.html file which contains all the track names, sorted by directory. Each name is a hyperlink to a CGI script called play.

In the apache area I have a few files to make nice viewable interface. The main page is called audio.html which contains a frameset (rename to omit the .txt extension). The upper frame is linked to the mp3.html listing that is made by mkplaylist.pl. The lower frame uses a CGI script called playinfo to display the name of the currently playing track.

Summary

What more can I say... it worked very well! With 800+ songs, having a browser to chose was a definite plus. It would have been really painful using a remote control to try and pick tracks ("click 450 times to get to Marillion")... I mostly let the "random" starting track feature do its thing; repeats were pretty seldom.

Questions/suggestions/comments? Mail me!


Ralph Siemsen / ralphs@netwinder.org