The MP3mobile 

This page documents my efforts at fitting my car with a MP3 player: I'm still twiddling with lots of bits of the setup, and so this page will change when things do with the setup. Hopefully, this page will help anyone else trying to do the same thing! There are now some pictures (thanks to Patrick, who lent me his Mustek VDC-200).

First of all: a disclaimer. Basically, all this worked for me. If it doesn't work for you, burns down your house/car/household pet, that's your problem. People building PSUs, it's a good idea to test them (voltage, current, etc) under load (eg: a partially dead hard disk) before plugging in an expensive PC motherboard which it may well blow up.

For those of you looking for a complete, built, in-dash player should look at my empeg unit (http://www.empeg.com which is very cute ;)

As this page is getting pretty big now, here's an index:

Why?

The whole idea got rolling when I decided I wanted to upgrade my car stereo in my Mazda MX5 (Miata to Americans, Eunos Roadster for Japanese!). Up until MP3mobile, I'd been using a Sony TCD-D3 DAT walkman on a car-mount arm as the primary audio source, which was great: long play, good quality audio - just that I never seemed to have the tapes with me that suited my mood, and the D3 doesn't have useful things like track programming or repeat. While looking at new head units/autochangers, two thoughts struck me: So, I built an in-car MP3 player. The result isn't minature, like the MPman, but does take no 'user-accessible' space in the car interior, and is pretty secure. Possible future commercial versions will most likely be the same form factor as a normal radio/cassette. The rest of this page goes into mind-numbing detail about how it was built and things to look out for if you try this yourself - but the basic concept is simple: a wide range of great quality music (all of which I like, unlike compilations) whenever I want it.

The final result is immensely wonderful, and impresses the hell out of most hackerish people (like me). Non-computer people just wonder why you havn't got a CD player. But, with my setup (based on RedHat Linux 5.0) I can do these things:

None of these things can be done with an autochanger. Sorry, but you lose :-)

Future plans include:

How it looks

Here are some pictures of the system's display: mounted just below the stock radio/cassette unit, it's very unobtrusive. The lefthand part of the display usually scrolls the title/artist information, with the right hand side showing elapsed time. The sexy spun-aluminium gearknob is a Voodoo knob (see miata.net's marketplace section). You can also see the audio output from the MP3 player going into the CD-in jack on the front of the radio.

...and yes, I own all the CDs that the music on the system has been compressed from. Below you see the ridiculous looking exclaimation mark on the VFD display :-)
 
 


 
 
 

And if you type *2, you get a random play of tunes from the year you enter (via the ID3 year tag). Very 'golden year', isn't it?
 
 


 
 
 
 
 

The Techie Details

(abandon hope here if you're not technical)

Where?

I'd seen some articles on fitting rear-deck speakers into MX5's, which noted that there was room either side of the fuel tank on the rear shelf to fit some extra speakers - so, I opened up the rear deck (lots and lots of bolts, carpet, clips...) and found two ducts that go from just behind the front seats into the boot which are about 16cm wide by 9 tall by 50 or so deep - ideal :-) The larger one of these ducts (the one which doesn't lead to the spare tyre mountings) is where the MP3mobile is situated.

The Processor & hard drive

Now all I needed was a computer. Ideally, I wanted to use an ARM-based machine, because I like them - unfortunately, there wasn't anything easily off-the-shelf that was usable, so I decided to look for small PCs. After a couple of months of keeping an eye out for a suitable broken laptop (486dx100+, dead screen, dead keyboard, onboard sound...) I gave up and started looking for embedded industrial control computers.

Quite soon, I found the Advantech PCM-5862 'biscuit PC'. This board puts an entire Pentium PC (including: 2 72-pin SIMM sockets, Socket7 (to 200Mhz), 10-base-T Ethernet, 16-bit audio, 2xUSB, EIDE, Floppy, 4xSerial, Parallel, PCI slot, PC/104 slot, SVGA with monitor and LCD drive) into the footprint of a 5.25" disk drive - and best of all, runs from a single +5v supply. I found an importer, found out the price (urk, not cheap - I paid 293+VAT from UCS in the UK), screamed a bit, then bought it anyway: it's still cheaper than an autochanger...

Next was a CPU - I didn't need anything powerful, and ended up with a secondhand Cyrix P150: this is actually fairly marginal for mp3 decoding - I'd underestimated how bad the FPU is in those things when compared to a genuine Intel. It soon got replaced by a P166MMX (see below).

The hard disk I chose was a Hitachi 2.1Gb 2.5" laptop drive - after much umming and aaahing, I decided to go for a 2.5" even though the capacity was way down on what I could get for the same price in 3.5". Basically, the Hitachi drive could withstand operating shock of 100G (300G non-operating), and ran off a teensy little 0.5A at +5v. The Adavantech board's EIDE is on a 2.5" drive connector anyway, so attaching it was no problem. I had thought of using a small HDD and a 5-CD EIDE changer, but the fact that most CD-ROMs nowadays are incredibly plasticky put me off somewhat.

Power Supply

With the whole system together, I needed to power it: my power supply design expertise doesn't extend very far at all, but even I knew that using 7805's to drop +12-16v down to 5v at up to 5A was going to generate a LOT of heat, so I searched the web for a suitable switch-mode PSU chip - the SGS-Thompson L4970A is rated at 10A, and the datasheet includes some helpful example circuits (hint: I'm using the one entitiled 'Low cost 5.1v 10A power supply' in the .pdf :-) ). This chip, and all the bits for the PSU can be bought from Farnell, who have distributors almost anywhere and will deal with individuals (as long as you've got Access or VISA). One thing that was harder to get off the shelf was the 40uH 10A inductor, so I used two of the Newport 11A 22uH ones that Farnell do stock, in series. I should say at this point that Patrick, a mad inventor friend who's much better at breadboarding than me, actually built the circuit!

As the Advantech manual notes, if you give it a +12v supply to the board, you get higher quality audio (it isolates the analogue audio bits from the switching noise of the logic circuitry), so I put on a SGS-Thompson L4940V12 (Farnell code 413-197), 12v low-drop-out (LDO) regulator, to give me a maximum of 1.5A at 12v - might be useful if I ever fit a CD-ROM...

If you're building the PSU: please note that everything needs to be bolted to a heatsink - this means the 4970, the 4940 and the 1545 Schottky diode used in the 4970 circuit. However, the heatsink tag on the 1545 is NOT GROUND and needs an insulator so that it isn't connected to case ground otherwise things will go bang - these are easily available from electronics suppliers. I suggest you check it with a multimeter before powering it up!

UPDATE! I've just (4th September 1998) replaced the 5v PSU with a better part. See the news section for details.

For input power, I used a Neutrik speaker connector (Speakon) which will pass an ungodly amount of amps, and as a side-effect both looks cool and has the most addictive push-and-twist to lock docking motion of any connector I've ever used :-)  It's also got 4 poles, which is useful for the ignition sense (see below).

Casing it

Finding a box that was the right size wasn't easy... I needed something metal, so that it could be used as a heatsink (the power supply especially needed the chips bolting to something metal to remove the heat). In the end I used two preformed aluminium boxes, one which held the PC and hard drive, and the other which held the PSU - both were from Maplin Electronics. Here, the help of Franc Buxton (a technician/car nut who works at The Department of Computer Science, Warwick University) came in handy, as did the department's fully equipped workshop, full of things like punches, drills, rivet guns and so on. Franc basically did all the drilling, cutting, punching, crimping, rivetting and that sort of stuff to leave me with two boxes attached together, lots of cooling vents, fans, phono connectors and 25-way D's on the ends of the box. There are vents above the Pentium on the Advantech board to allow it to breathe in, and another fan (off a Pentium heatsink, which incidentally is the cheapest/only way to get 50mm fans) which blows air past the PSU and then through the CPU box, leaving at vents towards the front of the car.

The hard disk is mounted hanging from the lid of the computer's box in a small cradle, slightly shock mounted on little rubber gromits, and mounted the right way up (it'd have been a lot easier to put it upsidedown, but I was a bit nervous about that!).

Some pictures of inside/outside of the unit can be found here.

Power Control & input

After trying the PSU out on the bench, a couple of things became aparent: This needed a two-prong attack. One, reduce power consumption - it was taking about 5A at 5v, and despite the PSUs ratings, I had doubts about it, as it seemed to be cutting out every 30 seconds or so - maybe my inductors weren't up to the job, and quite possibly as the example circuit was designed for 35v input, something wasn't operating at optimum efficiency. After trying downclocking the CPU (to 50Mhz, x2, ie 100Mhz as opposed to the normal Cyrix 60Mhz, x2) which saved about 0.5A, I tried fitting the P166-MMX from my desktop machine: this has a 2.8v core (as opposed to the Cyrix's 3.3v), and when underclocked to 125Mhz (50Mhz, x2.5) the whole system took just over 3A - much better, and the PSU wasn't trying to burn the house down now, either. I ended up buying a new AMD K6-233 for my desktop and using the P166MMX in the car! UPDATE: the P166 decided (after 2 weeks) that it didn't like running at 125Mhz anymore, and is now back at 166Mhz. The PSU is coping...

The other problem was that car batteries are usually about 12v, but can be below this with the engine off (with it on, they're usually about 14v) - this wasn't really a problem, as I didn't plan to listen to music with the engine off much, anyway. The problem was to ensure the machine got powered off reliably, and after it was shut down properly (it runs RedHat Linux 5.0) - so, a PIC16LC84 was bought and I breadboarded a little power control circuit.

Basically, this circuit does two things:

Since this circuit would be powered up all the time (it's directly wired into the battery), I wanted a low-power solution - ok, so the 16LC84 was probably overkill (a 16C84 isn't exactly high-drain!), and a small 100ma 7805 provides a regulated 5v to power the PIC and the MAX232 which gives RS232 drive levels for talking to COM1 on the PC. A dropping resistor and a 5.1v Zener diode bring the ignition sense line down into the realm of a signal that you can shove into a PIC, and the keypad scan routine was helpfully provided as an example that came on the install disk of the PIC C compiler used.

When you get into the car and want music, you just hit any key on the keypad: if the ignition is on, it powers up the PC, and then sends any keypresses to COM1 as ASCII (0-9, * & #). If the PC is on and the car engine is switched off, the PIC notices this, and sends '!' to the PC on COM1 every second for 30 seconds, then turns off the PC power supply: the PC takes about 15-20 seconds to complete a /sbin/halt, so that works out nicely. Update! someone built this circuit, progammed my code, then couldn't get it working... I forgot to mention that now you have to type "123" in sequence to start the main computer - I changed this from any key to prevent accidental powerups.

The PIC binary (in intel hex format) is here: remember to set the correct options before programming the pic - I use an XT oscillator, watchdog timer off, boot timer on. I've not included the source as some of it was from the PIC C compiler examples which are copyright (and also, this requires you to have the PIC C compiler!). The pinout is as follows:

A0, serial tx (to pc, via MAX232)
A1, serial rx (from pc, via MAX232 - not used as yet)
A2, ignition sense (high=on, take ignition line through a 10k resistor to this pin, with a 5.1v Zener pointing UP from ground to this pin to limit the voltage)
A3, pc power control (high=on, this goes directly to the high-side driver)
A4, pc reset (low=reset, this generates a small reset pulse a second after powering the PC on: it's not actually used as the Advantech resets OK).
B0, keypad column 1 (Pulled to 5v via a 10k resistor)
B1, keypad column 2 (Pulled to 5v via a 10k resistor)
B2, keypad column 3 (Pulled to 5v via a 10k resistor)
B3, keypad row 1 (Pulled to 5v via a 10k resistor)
B4, keypad row 2 (Pulled to 5v via a 10k resistor)
B5, keypad row 3 (Pulled to 5v via a 10k resistor)
B6, keypad row 4 (Pulled to 5v via a 10k resistor)

The display

I needed something pretty to go into the dashboard and tell me what was playing (and allow me to select things) - the head unit I've got is the original Clarion CRH60, which is just a radio-cassette, but has a good amp and is completely removable (essential for a convertible) - so there was no CD-autochanger interface to even try to reverse-engineer. Ideally, a small TFT display would have been nice, but they're a little expensive (like way more than the computer and hard disk put together...). Instead, when I was round at Patrick's workshop, he gave me a 16-character vacuum-flourescent starburst display (identical to the ones in fruit machines) - Farnell sell these: two versions - small (like mine, 9mm characters), code 481-671, or large (12.5mm characters) code 942-420. They're driven with a 2 wire interface (plus reset), and have onboard PSUs which generate the 50v for display drive, and so only need +5v to run: they're also pretty bright, and so can be seen in a car in daylight.

The display was hooked up to the low 3 bits of the PC's parallel port and I worked out the command set (having drawn a blank on finding programming data on the OKI 1937 VFD driver on internet) - the display can be dimmed and you can set the cursor position, basically. There are some other bits I havn't worked out which seem to give super-bright, but I can't repeat the results reliably! I had thought of using a PIC to drive the display from a standard COM port, but the protocol is so simple and with only 16 characters to refresh a 'hit the hardware' approach doesn't munch too much Linux CPU time.

Both the display and keypad come out on a single 25-way D type, allowing me to unplug everything easily when I want to take the PC inside: soon, I won't be able to do this, as I'll have bolted down the plate which covers the access to the duct - but I'm not doing this until I'm sure I can deal with it not fsck'ing properly without removing the machine!

Audio output

During tests indoors, the audio output of the Advantech board was excellent, probably better than my AWE64 home PC: out in the car though, there was a LOT of ignition noise on the sound, probably due to ground loops (so people who know tell me, that's a concept a bit too analogue for me!). An in-phono-line audio supressor (isloates everything from everything else) from Maplin fixed this amazingly well, but did cost 15 pounds - there's probably something I could have done with capacitors that would have had the same effect, but that'd be too tricky for me...

The audio comes out on two poncy gold-plated (99p each) phonos on the outside of the case.

Software

I wanted something which would play mp3 tunes without complaining, and with an easy-to-use interface for another program (ie my keypad/display handlers) to talk to. After playing with the jukebox interfaces of mpg123, I tried Xaudio, which worked like a dream (I use the 'rxaudio' program, which in the current release doesn't talk well down pipes, but this can be fixed by talking to it with pty's: in fact, this bug has been fixed with version 1.00, so it's now perfect :-) ). One of the other things I liked about Xaudio was the provision of second-by-second elapsed time, which meant that the time indicator on the display was a doddle to implement - the jukebox interfaces of some other players didn't have this info easily accessible.

Currently, the software's pretty basic. On boot, it loads a pre-compiled ID3 database (this can be rebuilt using *8). I can then select tunes by year, random play, play group, artist, and so on, using a simple back/forward/select mechanism from the keypad (unfortunately, the keypad doesn't have the ABC, DEF, and so on printed on the keys like a phone, which would have helped a lot...). I can mute the tune with #, pause, restart, skip forward and back and so on - it's great!

The display by default shows the artist & title (scrolling in a 12 character field), one space, and then M.SS (the dot takes no space, as it gets turned on in the M segment's display) - * goes into command mode, allowing you to pick functions 0-9 (or * to return to play mode). *1 is artist select, *2 is year select, *8 does a rescan of the filesystem/rebuild of the ID3 database, and *9 will do a shutdown if you need to shutdown without turning the ignition off. At any point I can key 9 to build a random playlist: eg: *19 builds a random playlist of everything in the database, *1 (then select an artist) #9 gives me random play of tunes from that artist, and so on.

People have asked for source for various bits of the system: below are some snippets that should help people doing the same sort of things. Please note that this is quick-hack code, so don't expect prettyness/whatever. It just works. Also, please don't mail me if you have no idea how to do anything with these files: I've not got time to teach people programming, these are just bits to point people in the right direction (or at least a direction).

Have fun :-)

Commercial version

I'm currently working on an in-dash commercial version of the mp3mobile: more info on this can be found on the empeg website. Basically this unit will fit in a standard dash-mount slot, and provide RCA outs for external head units or amps. Pricing will be comparable to high-end cd autochangers/head units, and we hope to have prototypes out for testing in the next few months.

News

If anyone's got any questions, feel free to mail me on altman@empeg.com

Hugo

Page first created 8th April 1998
Last modified 8th April 1999 (woo! first anniversary!)