Build a Cable to Control Your Android Phone While You Drive

by Rich Kappmeier on 23 August 2010 13 comments

I recently needed to replace my 5-year-old cell phone and my 3-year-old MP3 player simultaneously. So I bit the bullet and bought an Android-based smart phone, the famed Nexus One (N1). This was, hands down, the best electronics purchase I've made in the last few years…except for one annoying thing: The music app starts and stops randomly when a standard stereo plug is plugged into the 3.5mm headphone jack.

I did a bit of research and decided that I could solve the problem fairly easily.

First, I built a simple cable that disables (opens) the N1's music control circuit, which solves the original problem nicely (see the schematic below). An alternative to building this simple cable is to wrap tape around the relevant section of the 3.5mm plug sleeve; this will also open the circuit but may leave unwanted tape residue in the jack.

Later, I realized I could go one step beyond and a make a cable that would connect my N1 to my car stereo and have Play/Pause and Skip Forward/Back functions just like the headphones that came with the smart phone. I would no longer have to turn the N1 on and look at the screen while driving in order to access these basic music player functions!

To build this device, you need to know a bit about the difference between a standard stereo plug and the N1's plug (see the photo below). The standard stereo plug has three conductors, what are typically called the Tip, the Ring, and the Sleeve. These plugs can sometimes be referred to as TRS plugs. The N1, and other Android based phones, come with headphones that have a four-conductor plug with one Tip, two Rings, and one Sleeve. These connections can sometimes be referred to as TRRS connections. It follows then that the corresponding jack (what you plug the plug into) on the N1 has the same number of contacts. It is this extra ring, and the control circuit connected to it, that causes the problem.

On a standard stereo plug the sleeve is typically wired as circuit ground. But, on the TRRS plug/jack, the second ring is ground and the sleeve section is used as a control contact for Play/Pause and Skip Forward/Back functions. Unfortunately, when a standard three-conductor stereo plug is plugged into the N1's four-conductor jack, the second ring and sleeve contacts of the jack become shorted by the sleeve of the standard plug. This shorted condition makes the phone think the Play/Pause button has been pressed (see Function Chart below). Further, if the plug is not an extremely snug fight in the jack, any sort of movement of the plug can cause the music player app on the phone to act squirrelly. This problem was so bad for me that whenever my car went over a bump of even smallish size, my music would stutter.

During normal operation, the control circuit is open; i.e., there is no connection between the second ring and the sleeve to complete the circuit. The control circuit remains dormant. When the Play/Pause or a Skip Forward/Back button on the N1 headphones is pressed, the circuit is closed, the phone reads the voltage of the completed circuit, and takes action accordingly.

The "Ideal Resistance" is what I measured across the second ring and the sleeve of the N1 headphones while pressing the function buttons. The "Resistance Range" is the range for which the functions would trigger when I tested my understanding of the N1 using a resistance substitution box connected to a push button and a TRRS plug (see photo below). The "Approx. DC Voltage" is the voltage I measured across the contacts when the button is pressed with the Ideal Resistances in-circuit. Your ranges and numbers may vary, depending on a few factors, so be prepared to experiment with different resistors.

ARTICLE CONTINUES BELOW

I purchased most of the parts either online or at a local electronics store, but the Play/Pause button and the Skip Forward/Back limit switch were in my salvaged parts box. I'm therefore guessing their prices and origins.

You probably won't be able to find the same exact parts I used, so be resourceful. For instance, the reason I had to test the ranges in the first place is that I couldn't find a 600Ω surface-mount resistor at the local parts shop. So, I substituted a 470Ω, which they did have on-hand.

I think I cannibalized the Play/Pause button from an old digital irrigation controller I found at work. I'm fairly certain the limit switch came out of a trashed CD drive I had laying around. I really liked including the limit switch in the design because it had some contextual functionality; flip it to the right and you skip forward, flip it to the left and you skip back, similar to swiping across the screen of the N1 for the same functions. You can see photos of the assembly in various stages of completion below. All the parts I used are shown on the parts list at the end of the article.

I felt it was important to make the assembly as compact as possible and easily accessible while driving. It ended up larger than I would have liked, but if it were any smaller it would have been hell to build and solder. And it wouldn't have been very durable.

The best way to make the unit accessible (meaning I don't have to hunt around the cabin for buttons while driving) was by ensuring it was in a consistent place in my car. I thought about attaching the button assembly to my phone cradle, which is a recently retasked music player cradle, but finally decided it would be easiest for me if I made the buttons part of the plug that fits into the AUX jack of my car stereo. This would allow me to mount it securely to the dash in a place where I could easily reach it without taking my eyes off the road.

You may have noticed that the stereo plug assembly is installed upside-down. This is because I wanted to make sure the plug was securely mounted without using glue. Glue is great, but I didn't want the repetitive use of the controls to degrade the integrity of the assembly. So, the plug is held very securely to the circuit board by being wedged between a zip tie and the heavy ground solder of the cable. I also wanted ensure the force of pressing the play/pause button was transmitted to the jack in much the same way that it would be when a plug was inserted. I didn't want to introduce any forces to the jack that the original engineers hadn't thought of when designing the stereo. It looks funny, but I think this design will keep the jack from developing cracked solder joints or otherwise becoming damaged over time.

This unit was a lot of fun to figure out, design, and build. It has made my listening and driving experience easier and safer! I hope it does yours.

This is a guest post by Rich Kappmeier. Rich is an avid electronics tinkerer, progressive rock musician, occasional writer, and obsessive gamer. He lives in Central California with his wife, Cecilia, and cat, Velcro. Read more by Rich:

4.666665
Average: 4.7 (9 votes)
Your rating: None
ShareThis

comments

13 discussions

Add New Comment

CAPTCHA
This test helps prevent automated spam submissions.
Guest's picture

I love what you did! The fact that is was so cheap to do is a plus. I love it!

Guest's picture
Guest

I sounds like you had fun with the project too. FYI, there is also a free app, "Headset Blocker" that fixes the problem you describe.

"Tired of your phone randomly skipping songs because it thinks your headphones are controlling the music? This simple widget allows you to block and intercept unwanted headphone control signals which seem to accidentally occur from time to time.

IMPORTANT: This is ONLY a widget! You must add the widget to start blocking!

Latest version: 1.0 (for all Android versions)"

http://code.google.com/p/android-headset-blocker/

Guest's picture
digitalmind

Does this cable work with the Motorola Backflip?

Guest's picture
Jeff V

Just linked in from Hack-a-Day. Thanks for writing this up. It looks like something I may work on myself.

Guest's picture

I had a similar concern about controlling my music without looking. Instead I wrote an app called touchmusic to control my music without looking. It's free in the market place.

Guest's picture
Andrew Akeroyd

Nice hack. I've been looking for something like this for a while.
Tried it out on the weekend, it works well on HTC Legend with the same resistor values.

As a side note, this same cable should work with an iPhone too. The only difference is the prev/next track buttons. The iPhone counts the number of clicks instead of detecting the resistance value. I think it 1 click=play/pause, 2 clicks=previous track, 3 clicks=next track.

Guest's picture
Steve

This is great. I'd been peering at the tiny circuit board inside my HTC Desire's headphones to try and figure out what was going on - now I know, and can get building rather than hacking up the original (and making mistakes).

Do you have any idea how the microphone relates to the setup?

Guest's picture
demonh3x

I made the same reverse-engineering that you did and then i found the Hack a Day post linking to this one...

I'm developing my own version of it.
To start: i suggest to use this values of resistors:
220Ohm (standard value) and another 390Ohm (another standard value) in serial to do the 600Ohm (Not standard) (220+390=610Ohm real) Forward action.

Plus, i'm trying to incorporate a microphone to this adapter because when this thing is plugged in; the mic on the nexus one is disabled so you can't talk.
I've connected a mic in parallel to pin 4 (Function, Sleeve) and pin 3 (GND, Ring2) and it works but the mic i used is not providing enough signal and sounds low.
I think it's because of the mic's impedance. (i really don't know how to measure the impedance...) But, i measured the resistance of the pins 4 (Function, Sleeve) to pin 3 (GND, Ring2) on the original headphones; ~38KOhm. And the mic i'm using is ~1K28Ohm. I'm going to try more microphones to see how behaves...

So mis final schematic will be this:

# = button

Pin4-+--------[+ MIC -]---------+-Pin3(GND/Ring2)
+---------------#---------+ //Play >
+-[220ohm]-+------#------+ //Back <<
+-[390ohm]-#-+ //Forward >>

Guest's picture
thesavo

This looks awesome. I tried this on my LG Revolution (Bryce). All I got was play/pause up to 759 ohms. No rewind , no fast forward. It was fun, but no gain for the Revolution. As a tip, i used a salvaged digital camcorder cable. It worked great. I had a cut off female RCA cable and wired that into my proto board. So I didn't have to cut in to the camcorder cable.
Thanks for write up.

Guest's picture
Guest

Who has found any other resistor values for commands?

Guest's picture
Jon

Where did you find the TRRS plug without the solder points on the back? I've been searching for so long to find JUST the plug. If anyone knows, could you please let me know, thanks!

Guest's picture
Fahad

Did you use google to search for it? it is all over ebay, digikey, mouser and other electronics stores.

Guest's picture
Space0221

" the second ring is ground and the sleeve section is used as a control contact for Play/Pause and Skip Forward/Back function"
I would like to fix and say that the second ring is in fact the ground, but the sleeve is the microphone (that's why there are 2 rings to begin with, because the new headphone connections had to make room for a microphone)

http://en.wikipedia.org/wiki/Phone_connector_(audio)#TRRS_Standards