Electronic – What protocol does a headphone jack use

android

I have 2 questions. One is simple, the other may be not.

1. What's the official name for the standard headphone jack? It's universal for all brands of phones, so it must have a name (when you want to go shopping for components).

2. Is it using some sort of a communication protocol? I know for a fact that it's not only for headphones. There is a device for scanning credit cards that plugs into the same jack. I believe Nexus also has a TV-out support from the same jack. Basically, can it be used for other I/O applications?

Thank you

Best Answer

Background on the Jack

"It's universal for all brands of phones, so it must have a name" it actually isn't. There have been many phones over the years that have used various connectors. The "standard" technology is not a formal standard like what you consider things like any of the IEEE standards. The industry has just evolved over time to tend to use what we all know as a audio jack.

The typical audio only jack has 3 rings, usually call Tip, Ring, Sleeve (TRS). These typically map to Left, Right, and Ground. Phone manufactures wanted to make this jack work with existing headphone so they used a connector with 4 rings, called Tip, Ring, Ring, Sleeve (TRRS). These map to Left, Right, and ground just like the 3 ring, but the final connector maps to a microphone. This makes it so that if you plug an audio only cable into it, the microphone input gets connected to ground so nothing is hurt. It also means that if a headset with microphone is connected to an audio only device, the microphone is connected to ground, also hurting nothing. There are similar connectors in 2.5mm (used on some phones to save space), 3.5mm (for phones, mp3 player, etc) and .25" (for larger headphones, guitars, etc).

Data on the Jack

As far as what "data" travels over this, it is purely analog. Some people have reused these cables to pass serial data over them, but they are very application specific. For the case of devices using the jack for other purposes, they can do whatever they want as long as the signal on the line is band-limited, meaning that there isn't any high frequencies being used. The reason for this is that there are filter on the input that block frequencies too high. This frequency will change depending on the device itself but is usually around 12 KHz or so.

The method that people send data over this are usually all pretty similar to how phone line modems work. The general concept is that there is a mapping between the frequencies being transmitted and serial data. If you wanted to reverse engineer a system, you would need to record the line and look at what frequencies there are. The hard part is to figure out what the resulting data is supposed to mean.

2 Way Communication

I would also like to note that 2 way communication is possibly in these systems. The microphone line is used to send information to the phone and the audio out lines are used to send information back to your external device. If you are trying to reverse engineer a device, you will want to look at Mic, Left, and Right to see if there appears to be any bi-directional communication.

Reverse Engineering

I mentioned that reverse engineering would be the difficult part. Here is the method I would go about doing this:

  1. Check to see what lines have data on them. You can use a computers audio jack to capture your data with. This will probably be the easiest method to look at the data.
  2. Determine the symbol rate. Basically when you look at your captured data you should see very specific points that the frequencies change.
  3. Look to see if there are discreet frequencies being used, and how many are used at the same time. For example, there could be 6 KHz, 8 KHz, 10 KHz, and 12 KHz. These could map to 4 bits per symbol. So if you see 6 and 8 at once it may mean 1100 (or maybe 0011). Look a the next symbol and it could be 6, 8, and 12 and could mean 1101. Of course if it is a custom protocol, it could really mean anything they want it to. But this will at least give you a start.
  4. Assuming you collected the data running a card that you know the data for, you can look for patterns. Here is the information included on the cards. You could do things like if your card has a short sequence that repeats look to see if your symbols have a similar repeating pattern. Once you get some of these patterns worked out, you should be able to do a 1 to 1 comparison for the rest of the numbers, You should eventually be able to get a pretty good idea of what is being sent.

There may be some data sent that has nothing to do with your card and you may never know what it means, but as long as you know the position of the data you care about, that is all that is needed. You just have to hope that the hardware manufacture didn't put any "anti-hacking" or "anti-reuse" measures in place. Potentially the designer could have used bi-directional communication to provide encryption. It is also possible for them to just mix all of the data up so it is hard to figure out what is what. I would say it is unlikely that they have done any of this though.