Monday, July 22, 2013

Airplay in my car (Updated!)

I was inspired by this recent Lifehacker post by Ben Novakovic to try to assemble an Airplay receiver for my car. My car doesn't have a bluetooth receiver while I could probably put something together that used bluetooth, but I liked the idea of using wifi based Airplay better. In Ben's post, he converted a new 2nd generation Airport Express to run off a 5V USB power supply.  I already have several 1st generation Airport Express units, a few of which I wasn't using. Assuming they can also be run of a 5V USB power supply, I would like to use one of them instead. I should note that while this worked great in my garage, I encountered audio problems, probably due to the wifi connection, as I was driving around town.

Hardware Setup

A Google search revealed that power supply failure on the 1st generation Airport Express units was fairly common and there were a few useful posts on converting them to run off USB. Like the 2nd generation unit, the 1st generation Airport Express runs off 3.3V and 5V. The previous posts, used a card reader board to step down the voltage, my plan was to use the step down converter, Ben specified in his post.

 The 1st generation Airport Express, with the case ready to be opened. 

As you'd expect from an Apple product, the 1st generation Airport Express is a pain to open. The two plastic halves of the unit are melted together. Rather than use a saw, I used a small screwdriver to break the plastic seam and pry the unit open. Once open the power supply can easily be removed with a single screw.

The open Airport Express, The top half is the power supply.

 The power supply half of the Airport Express with the power supply removed

There are six wires coming out of the Airport Express controller going to a socket connector. Three black (ground), two orange (3.3V) and one red (5V). I wanted to preserve the connector on the  Airport Express controller in the event I wanted to reassemble the Airport to it's original state so I constructed a pin connector that would mate to it. I shorted the same color wire pins together and soldered a couple inches of wire off the black (ground), orange (3.3V) and red (5V) leads. For the USB connector, I sacrificed a USB cable then soldered the red (5V) and black (ground) to the matching pin connector cable. My soldering skills aren't that great, so I soldered a few inches of wire onto the step-down converter leads, black (ground), red (VIN, i.e. voltage input 5V), orange (OUT, i.e. voltage output, 3.3V).  Finally, I soldered connector/USB wires to the appropriate wire lead on the step down converter. I secured the step-down transformer and strain-relieved the wires using kapton tape. There is probably a better way to do this, but I am used to clugeing things with kapton tape.

The wiring harness I assembled. The step-down transformer is on the right the connections to the controller half of the Airport Express are on the left..

The wiring harness secured to the empty half of the Airport Express with kapton tape.

It powers up!

I put the Airport Express back together with white vinyl tape that I had. I also strain-relieved the USB cable.

Software Configuration

The process for configuring the 1st generation Airport Express is similar to the process outlined in the Lifehacker article, although with fewer options. The important point is to set the Airport Express to create a wireless network and to enable the Airplay. I gave my wireless network a clever name.  To set the Airport Express create a wireless network, open up the Airport Utility (I used the Windows version) and click "manual setup". You should be in the "Airport" configuration section. On the Base Station tab, give the Airport Express a name and a password. On the wireless tab, change the wireless mode to create a wireless network. Give your network whatever level of security you feel will make your network safe as you zoom around town. I don't think the radio mode matters, but if you are attempting to do this with an 802.11n capable 1st generation unit (Gen 1.5) you should make sure your network is 802.11g compatible. Next go to the Music configuration section and enable Airplay. Finally save your configuration.

Your phone, or other Airplay transmitting device should be configured as described in the Lifehacker article, but I'll summarize them here. The goal is to connect to the airport express wireless network for music but use your phone's cellular network connection for data. You can set this up in advance either before you start or using a USB auto (12V) power adapter. Directions for an iPhone, summarized from the Lifehacker article are as follows: Go to the wifi settings then press the arrow next to your car's wifi network name to view the setup options.  Change the IP address type to static and enter for the  IP address and for the Subnet Mask. Leave Router, DNS, and Search Domains blank. After some initial road testing I played around with the settings some more. I'll explain them in more detail below. 

Car Integration!

I want to keep my Airport Express hidden in my glove box. I'm not really a car guy, but I figured I could wire some USB ports into the glove box. I also wanted to run a hidden audio cable from the stereo head unit to the glove box where it would connect to my hidden Airport express. Fortunately in my car, the fuse box is right next to the glove box. I used an Add-a-circuit fuse tap and an appropriate fuse to add a circuit and connected it to this 12v-to-5V Step-down voltage converter with two USB ports. there is also a single USB version. I should note that I was pretty nervous about violating my "don't break the car" spousal pledge. This post on a similar car to mine gave me the courage to try.

The wiring harness to convert 12v power from the car to two 5v USB connections

The USB power supply wired into the car. I'm close to violating my "Don't break the car" pledge

For the audio cable, my car's stock stereo has an auxilary input jack near in the center console near the shifter. When I started out on this project, I was prepared to run a moderately visible mini cable (i.e. headphone jack) from this port into the glovebox. It turns out there is an inexpensive cable that plugs into the back of the head unit, replacing the console port with a mini cable that I can run to the glovebox. I imagine there may be similar cables available for other cars.  The stock head unit has the capability to connect satellite radio that isn't being used. In my ideal world, I would tie into that port on the head unit and re-enable the console Aux port. I couldn't figure out how to easily do that, so I may come back to it later. I was also thinking I might open up the stereo again and add a line from the unused console Aux port to the glovebox. Then if I wanted to re-enable the console port, I could swap it easily. If I was really inspired, I could add a switch.

Mazda doesn't make this simple. It's a miracle I didn't lose any screws.

Once everything was connected I tried to hide it in the glove box as much as possible. I mounted the USB power transformer to the side of the glovebox with mounting tape, and the Airport Express on top of a plastic piece in the middle of the box. I also used a few pieces of electrical tape to hold the audio mini cable in place.

Everything connected and hidden away.

When I start the car it takes 30 seconds or so for the Car wifi network to come up. One issue, is my phone can still access my normal home wifi network in the garage. So I have to either switch it manually or start the music playing after I drive off.

 The end result!

Road Testing
In my garage, everything works perfectly, but taking it out for a drive it there seems to be a fairly severe audio skip problem. Doing some searching online revealed that this is a fairly common problem with Airplay through Airport Express Gen1 units, although I've never had a problem with this at home. I suspect driving around town you encounter a range of different 2.4GHz enviroments. I tried a few things to rectify this, and have seen some improvements. First I went into the Airport Express configuration application and into wireless settings. I clicked the Wireless Options button and did the following:
1. Set the wireless channel to 11
2. Set the multicast rate to 24Mbs
2. Enabled Interface Robustness
3. Enabled WPA security (previously, I used an open network)

Some more things to try:
1 It looks like because of car alarms, I might have better luck with channel 1.
2. I might try decreasing the broadcast power.
3. I'll try turning off the bluetooth on my phone. Although I have future plans for this.

If all else fails...
I have a bluetooth USB audio dongle. I'll swap out the Airport for this. Sad panda.

I tried the things on my list and there are still audio dropouts. I ended up swapping the Airport Express out for a USB to 3.5mm bluetooth dongle. The nice thing is it is all still hidden in my glove box. I used this particular dongle with a 12V auto adapter and had all kinds of problems. It works so smoothly now, I think the problem was the power port I was using.

Upgrade ideas: 
1. Tie into the Satellite connection on the head unit and re-enable the front panel Aux input.
2. If option 1 isn't possible, run a line from the front panel Aux input to the glovebox and integrate a switch.
3. I'd like to get a remote control, such as this one, secured to the steering wheel.

No comments:

Post a Comment