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:
- 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.
- Determine the symbol rate. Basically when you look at your captured data you should see very specific points that the frequencies change.
- 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.
- 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.
It sounds like your question is, how do you go from a UART device to something that can be plugged into a microphone jack.
What protocol does a headphone jack use? should help you understand what is being done on the existing device that you are talking about.
There is still a link missing for you though, that is the ability of turning UART into the audio itself. The easiest way to do this is to buy a microcontroller that you will place between the UART device and the Android device. All the microcontroller will do is read in any UART data and then convert it to what ever form you want the headphone jack to receive. You may also need to implement some handshaking between the microcontroller and the phone in order to know that the device you think is plugged in.
There is also the issue of getting power to the device. A headphone jack is in no way designed to be used as a power source. The easiest method would be to just slap a battery on the device. If you wanted to, you could potentially do some clever tricks with playing audio at full volume for some period of time and have your device charge up a capacitor. You could then run your device off of the power stored in the capacitor. This sounds rather tricky to me though and would personally just go with a battery.
Best Answer
From the comments:
That means that they'll only light when there is a difference between the two channels. If you have a mono recording or a stereo recording with the same signal on both channels then you will have no voltage difference between L and R. I don't understand how you got this to work at all unless you have zero volume on one channel or you inverted the signal on one channel to maximise the difference in L and R.
simulate this circuit – Schematic created using CircuitLab
Figure 1. (a) What you've got. (b) What you need.
If you've got the same signal on L and R then you would have to wire as shown in Figure 1b but would need a higher output level than if you were running (a) with anti-phase signals.
That is critical information and should be mentioned in your question.
Yes, you would.
No, your complimentary (inverted) signal gives twice the voltage to the LEDs in (a) than you would get in (b).
Standard IR transmission uses 38 kHz modulation on the IR light. Your phone's audio won't go above 20 kHz so I don't know how this is working at all.