I have two switches that I would like to connect to an android phone (and/or an iphone). To be clear, I would like to connect a morse code key that has three connections: a ground, a dit and a dah.

Is there a way for me to sense that I have shorted between ground and either the left or right output of the headphone jack?

I see a lot of posts about reading the microphone but I'm interested in seeing both signals.


closed as off-topic by Matt Young, Andy aka, Daniel Grillo, Leon Heller, PeterJ Sep 17 '15 at 23:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on the use of electronic devices are off-topic as this site is intended specifically for questions on electronics design." – Matt Young, Andy aka, Daniel Grillo, Leon Heller, PeterJ
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ This question is too broad at the moment. It would be useful to have a make or model, as all android phones are different and have literally millions of hardware combinations... \$\endgroup\$ – George Sep 17 '15 at 21:22
  • \$\begingroup\$ I clicked to delete as it's off topic but I cannot do so. I have flagged for moderator. \$\endgroup\$ – KevinDTimm Sep 22 '15 at 15:27

Phones don't have inputs on the earphone outputs, at least not so that you could use them. Some can detect earphones or line-in, but it would be hard to do what you want through line-in - and most phones don't have line-in anyways.

Only the microphone can be used for button input.

The Android documentation tells you how to attach multiple buttons to the microphone input, and also tells you what events you will need to capture in your Android software.

Basically, you connect the microphone line to ground through a resistor with a specific value. The causes a particular DC voltage on the microphone line, which Android evaluates and generates the events.

  • \$\begingroup\$ Thanks very much - I was trying to do this with no outboard hardware at all. I see it's not possible, but a tiny little box with 2 resistors should be too hard at all. Thanks again. \$\endgroup\$ – KevinDTimm Sep 17 '15 at 17:38

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