3
\$\begingroup\$

I recently bought a TRRS Pigtail on sparkfun and I want to have two buttons attached to one end of the cord and another end connected to the iphone in the headphone jack. I would like to be able to have an app detect when a button is pressed.

How would I be able to do that?

\$\endgroup\$
  • \$\begingroup\$ The headphone jack on my phone is an output not an input. I'm not ruling out that other phones have a more complex interconnect method that may have input lines but this of course wouldn't be a "jack" \$\endgroup\$ – Andy aka Mar 22 '13 at 15:11
  • \$\begingroup\$ That appears to be an audio cable. How is it going to detect button presses? \$\endgroup\$ – Leon Heller Mar 22 '13 at 15:12
  • 3
    \$\begingroup\$ @LeonHeller Through the microphone input? \$\endgroup\$ – W5VO Mar 22 '13 at 15:13
  • \$\begingroup\$ Because that's exactly how the microphone button, the volume and play/pause/stop/forward/rev/phone answer/phone hangup buttons work on an iphone and really, any smartphone since 2008. TRRS, Tip, 2 Rings, 1 Sleeve. 2 Audio, 1 misc, 1 Ground. \$\endgroup\$ – Passerby Mar 22 '13 at 18:14
5
\$\begingroup\$

Generic:

Connect each button between one of the stereo output channels and the microphone input, along with some resistors for attenuation and possibly a capacitor for DC blocking (suitable audio input circuits have been published, you can search for them as readily as I can).

Have your app output an audio tone of different frequency on each of the left and right channels. Have it collect data from the microphone and use one of the known frequency detection algorithms to determine if either or both tone is present at meaningful amplitude.

Vendor Specific:

Research how function buttons on headsets (pause, track skip, whatever) are implemented, and construct such circuitry. Act like a playback app that could use these, register with the operating system for those events, and do what you want with them instead.

\$\endgroup\$
5
\$\begingroup\$

While everyone else is saying things like "it's an output, dummy" (highly paraphrased), I'd like to point out that there are "button remotes" on headphones for iPhones. Even the headphones that come with the iPhone includes a mic and some buttons for volume, play/pause, etc.

I suggest googling for different DIY wired headphone remote designs. Here are some that I found:

http://www.instructables.com/id/iPod-Inline-Remote/

Or you can buy a pre-made inline remote and modify it. Like this one: http://www.amazon.com/iLuv-iEA15BLK-3rd-Party-Headphone-VoiceOver/dp/B002RL9WDQ/ref=sr_1_2?ie=UTF8&qid=1336707292&sr=8-2

Enjoy!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.