Pages

Wednesday, October 30, 2013

tunes

I told you last episode about buying a used car. I got the car I wanted. Getting it was half the effort. Getting it home was the other half.

I got several estimate from car haulers who asked between one and two dollars a mile to collect a car and bring it to your door. I thought those offers were fair, but they meant completing the transaction on the car sight unseen. If Amazon offered free Prime shipping, I might have gone for it. Instead, I found a flight for just over a hundred bucks. The seller picked me up at the airport in the car. Very smooth.

When the deed was done, I set off for home. A half an hour into a long drive, the guy called and wanted to know if he had left his magnetic dealer tag on the back. A half an hour after that, I set out again.

The drive was pleasant and the car seemed almost factory fresh. I was transported back to 2001. In 2001, people still apparently listened to music on round shiny things called CDs. The factory put a hole in the dashboard just for these things. My digital tunes don't fit in the hole. My long drive was going to be quieter than I expected.

The hole in the dash is actually part of what we used to call a radio. Kids these days call that a 'head unit'. The head unit does usually contain a radio. Mine contains the CD player as well, and the interface electronics needed to speak to a remote CD changer.

I guess that these interfaces were common in factory radios from about 1995 to 2005. Hundreds of hobbyists have leapt to the same conclusion over that period -- pretend to be a cd changer and send digital tunes in that way.

Some hobbyists have even turned this little trick into a business. I remember that one of the first products to pull this emulation trick was the PhatBox. ZD ran a review of that device in 2000, not long after its introduction. The product was discontinued by 2005. The review was amazingly detailed. It said the box ran Linux on a Cirrus EP7212 SoC and managed the CD changer interface with a dedicated 8051 microcontroller.

The PhatBox product tried to solve two problems. It did a great job delivering audio to the dashboard. I think it stumbled by trying to solve the storage problem. The Phat solution was laptop hard disk drives wrapped in a proprietary cartridge. Phat didn't know about the coming iPod. They didn't know that only Apple gets to mark up commodity storage and live to tell about it.

Several firms took up the CD emulation challenge post-iPod. Many automakers got in on the act themselves. DICE electronics (now Audiovox) still sells an aftermarket unit.

Even that business is now in decline. Finally. I can leap in with both feet now that this
technology has hit bottom. I decided to build a CD changer emulator for my car.

This path is a well travelled for BMW cars of the era. These cars hide two connectors for a CD changer in the trunk. One is a three pin connector for power and data, the other is a six pin connector for analog audio. I hear that some fancy cars have only digital audio. Mine isn't one.

The three pin power/data connector provides constant +12V, ground, and a serial data line. This scheme is called 'ibus' in BMW circles. The same thing is called 'kbus' among MINI cognoscenti. The technology shows up in some Rolls Royce cars from the same era. I'm sure it has no name there. Gentlemen don't talk about data busses. Whatever the name, the bus runs at 9600 baud with 1 start bit, eight data bits, an even parity bit, and a stop bit. The bus is pulled up externally to 12V.

Most folks building amateur CD changers for these cars are using an interface built by Rolf Resler. You can get one here. I didn't. The interface, plus shipping from Germany, cost more than the Radio Shack retail price for an Italian Arduino.

Resler's interface is probably wonderful, but it is just an IBUS to RS232 (or serial over USB) adapter. There is no logic to spare in that interface for the CD changer emulator. By contrast, an Arduino has enough logic for the job and enough spare capacity to run the ibus interface as well.

You could probably connect the ibus directly to an Arduino I/O pin for a while without smoking the Arduino. You can run an Arduino directly from the 12V line though 12V is at the upper end of the range for the Arduino's linear supply. I used one of the 'TX' halves of a Sparkfun bi-directional level converter breakout board for my bus interface. Sparkfun has revised these boards recently to eliminate the distinction between 'RX' and 'TX' lanes.

These level converters are used mostly for 5V <-> 3.3V level shifting but the BSS138 MOSFETs around which they are built are rated for 50V.

My Arduino code is available here. I have used it on a Duemilanove and an Uno R3.

This sketch doesn't actually jam any audio into the car. It just pretends to be an attached CD changer. If the BMW head unit sees an attached cd changer, it will let you jam your own audio into the audio pins in the trunk. I leave that as an exercise to the reader. I used the same Tunelink reviewed here last year.


No comments:

Post a Comment