Apple Vehicle Dock
After going through 4 or 5 different variations of my car computer project, I decided that the only way to eliminate the problems I'd had with boot times and unreliability was to go with a tablet-based solution; essentially a dock that would replace the factory head unit and provide amplification, charging and wheel-control capabilities. Since there was only really one tablet with a suitable docking connector and control protocol, I went with the iPad. As an added benefit of using the dock connector, it would also work all recent iPods and iPhones.
From my previous attempts, I already had a stereo harness adaptor providing power, wheel control and speaker connections - along with a 50W 12v/5v voltage converter. The primary effort would be in converting the steering wheel's button presses into commands for the docked Apple device... and of course, making a dock for the device to sit in. As with my previous installation, this would be done by modifying a Metra double-din fascia.
The Apple Accessory Protocol permits the remote control of an Apple device via the dock connector, using serial commands. Official documentation doesn't appear to be publically available; but others have documented the protocol for us. The MX5's steering wheel controls are based on a resistor network. Only two wires run from the wheel - pressing a button on the wheel grounds the two together via a resitor (each button having a different resistor value). Watching for resistance changes allows the detection of button presses and pass them on as commands to another device. I'd previously used the Joycon EX to perform this role with the Joggler and a netbook computer - but in order to generate serial commands for the docked Apple devices, I'd need to make my own.
Research, Planning & Design
In order to provide this electrical interface between car and iPad, I'd need a microcontroller of some sort. Not having used these before, I did a little reasearch and bought a Duinomite Mini. At £17 it's extremely cheap, yet with onboard video and keyboard support, you can actually program and debug on the device itself - making it entirely self-contained. It uses BASIC, which is easy for anybody to learn.
The pinout of the Apple dock connector is well documented, although very difficult to solder due to its pitch. Rather than buying an expensive purpose-made breakout board, I sourced a cheap 'dock extension cord' from eBay and simply cut open one of the connectors. Within was a solderable breakout board, with all the required pins available.
As noted in the pinout documentation, the USB data pins must be set to specific voltages in order for the device to start charging. I decided to design a simple circuit board that would provide the required resistance and voltage values (using voltage dividers) to configure the docked device for charging and serial communications.
I'd also need a method of volume control, as Apple devices disable it when audio is sent through the dock. I bought a basic class-T amplifier and a digital pot, then attempted to get the two to work together; controlling the pot with the Duinomite (using SPI). After little success, I decided to instead use a small stepper motor to turn the amplifier's existing volume pot. Although a little 'Heath Robinson' in nature, this actually works very well. It eliminates interference and makes sudden volume spikes impossible, and also retains the volume level between journeys. Controlling a stepper motor with the Duinomite is also trivial, unlike the pot.
Circuit, Software & Dock Fascia
I built my circuit design on a perfboard, adding header pins and resistors to provide the required resistance and voltage values to trigger charging and 'serial mode' on the device. A 10-way IDE ribbon cable connects the board to the dock connector, which would be embedded into the aftermarket fascia.
My initial test program consisted of a crude routine to send a simple Play/Pause command to the device every few seconds. Thanks to the simplicty of MMBASIC, within hours I had a complete program running that reacted to the wheel controls and sent media playback commands to the docked device. The full source code is well commented, and includes a full list of 'Mode 2' media playback commands, including those I didn't use in my setup.
As with my previous car projects, I bought and modified a Metra double-din fascia; using a soldering iron to fuse various pieces together. Modifications included the addition of a protruding dock mount and two storage trays. Using wet & dry sanding and Tamiya TS-6 spray paint, I manged to get a pretty good colour and texture match with the interior.
Lateral support for the iPad is provided by two metal bars (actually cupboard door handles), and cylindrical neodymium magnets embedded into the fascia attract a ferromagnetic plate glued to the back of the iPad's protective case. Rather than being a form-fitting slide-in dock, this 'open' arrangement allows the docking of any apple device and protective cases.
Installation, Testing & Tweaks
The initial in-car installation revealed a few problems that needed to be overcome. When first powered, the car speakers produced a rapid 'ticking' noise whenever the dock was unpopulated. I discovered that this was caused by the software continually sending the 'Set Mode' AAP command to the dock, depite there being nothing to receive the command. Sending the 'Set Mode' command only upon a button being pressed eliminated this issue completely.
The next/previous track commands were also initially erratic, as the 'button held' commands were being sent at a much higher frequency than the device could respond to. Increasing the delay within the main program loop corrected this, resulting in 100% reliable iPod/iPad/iPhone control from the steering wheel buttons.
Having driven a test run with the iPad docked (and my brother sat in the passenger seat, ready to catch the iPad if it fell out!), I discovered that the 12 or so magnets I'd initially chosen to use were in fact sufficient to hold the iPad in place whilst driving. However, I decided to double the number of magnets all the same, as I needed to be sure there was no way it could come out of the dock accidentally.
The heavy iPad also had a tendancy to lean over slightly in tight corners. In addition to the extra magnets, I decided to add foam bumpers to the bars (wrapped in heatsrink for a neater finish) that would help to keep the iPad more secure. With these additions, the iPad no longer moved during cornering.
Use & Future Enhancements
I'm pleased to say that having used the dock in the car for a number of weeks, it has continued to perform perfectly. Music playback works very well, allowing me to listen to local music, or to stream with Spotify over the 3/4G connection. After the intial teething problems, the wheel controls now work 100% reliably, just like a factory head unit. Thanks to the universal connector and communications protocol, the dock also works with every Apple device I've tried.
The smaller iPods and iPhone are not heavy enought to require additional support once docked. On that note, I've not seen any indication that the iPad would come loose under normal circumstances (despite my 'spirited' driving style). Perhaps a more powerful car would make such a docking arrangement fail under acceleration, but it works well in the relatively slow MX5.
The upcoming iOS6 and accompanying turn-by-turn navigation (and the new 'Eyes Free' voice control) should compliment this dock rather well, so I look forward to its release.
As a future potential enhancement, I considered adding a DAB radio for use when a 3G signal (or a device to dock) is not available. I bought a cheap (under £30) portable DAB radio and successfully modified it to be controlled by the Duinomite - however, I couldn't devise an elegant way of showing station information without showing the screen, ruining the look of the dock. As I don't listen to the radio much anyway, I decide the scrap the idea.