iPad's audio jack as an external trigger
Using old iPad's 3.5mm audio jack as an input for external buttons or switches.I have been tinkering with an iPad 2 to use as in-car navigation / display, but one of the things it lacks is some form of external wired input that can be triggered by another circuit. Just one on/off state is enough for me.
My first thought is to use the microphone input. It would be impossible to write an app for iOS6 without having a Mac, so that would not work. I could try writing a daemon to monitor the input and perform the action and run it through some tools within Cydia. I should revisit this.
Activator is an automation app (available through Cydia on a jailbroken Apple device), which allows setting up actions based on events. Most events are gestures or based on the UI elements. Some events are for physical buttons, but I would like to avoid opening up the iPad (for now, at least). And finally, there are two events for the 3.5mm audio jack, one for plugging something in, and one for unplugging it. These might work, so I decided to find out how exactly the iPad determines if a headphones or a speaker is plugged in.
A quick search online shows that "headphone detection" varies by device and depends on the part used for the audio port. Often, it is an additional flexible contact that is physically closed by the inserted jack. Sometimes, headphones are detected by measuring resistance across R-ground or L-ground.
To find out which one it is for the iPad, I set up Activator to open an app when the headphones are plugged in and to go back when they are unplugged. Then I tried plugging in:
- Headphones: Works as expected
- Just the 3.5mm jack (no connected wires): Works. Which implies the iPad does not measure the resistance.
- Plastic stick: Does not work. Which implies that the detection is triggered by conducting current through the jack.
- Thin piece of wire: Does not work. The wire is not thick enough to press on the contact(s).
- Thick piece of wire: Works. Wire conducts across the detection contacts.
__ __ | | | | |> <| headphone detection contacts |____|To test this theory, I made a crude "jack" out of two straight pieces of 14 AWG wire stripped on sides (so they touch the contacts) but with insulation between them (so they don't conduct across those contacts).
___ "jack" contact 1 | __ "jack" contact 2 __ || __ | || | | || | |>||<| headphone detection contacts |____|
When I insert this "jack" into the audio port, nothing happens, which is what I expected. But when I short the two wires, Activator triggers my action. There it is! That is my external input!