Many modern cellphones can be crudely controlled through their headset stereo jack by simulating headset button clicks.

Update: I think I misread the lines; GND and microphone are switched. Therefore text in bracketed italics below is incorrect. The given circuit will still work and should not damage anything, but a much simpler approach will be to simply ground the corrected phone GND line (i.e. on my Droid Incredible ring2) to the microcontroller GND and then the bias on the microphone line is +2.5V and the Zener is not necessary.

Update: see improved version

This circuit was tested on my HTC Droid Incredible Android smartphone, but should work with other phones that receive compatible headset button clicks. Disclaimer: it's possible (but unlikely) that wiring this wrong will kill your phone or microcontroller. If you manage to do this, don't look at me.

The phone detects a button click as a momentary grounding of the microphone line. The phone stereo plug is 4-conductor, also known as Tip-Ring-Ring-Sleeve or TRRS. The tip is the very end of the plug, the sleeve is the metal part of the plug that is farthest from the tip. The two rings are in between, separated by insulation.

The NPN transistor Q1 controls the grounding of the microphone line to simulate a headset click. The base pin of Q1 is connected to a digital output of the Arduino (or any 5V digital output). [This scheme is slightly complicated by the fact that the cellphone puts out a -2.5 V bias on the microphone line (I believe this is to power an electret-style microphone). The -2.5 V draws base-emmiter current even when the Arduino output is set low (GND). We stop this current with Zener diode D1. This way the current is blocked until the Arduino output goes high, overcoming the Zener and allowing Q1 to connect the microphone line to ground.] LED1 is simply an indicator for when a click is taking place. LED1 could probably share the same output pin as Q1 base, just not the way I happened to do it.

Simple Arduino code for simulating clicks is also included. The shortest "click" duration that seems to be detected by my phone consistently is 40 ms. Your mileage may vary. On Android phones, both single and double clicks are generally recognized by default. Typical functions are a pause/play/answer/hangup for single click, and next track for double click, but these can be different depending on what's installed on the phone. An application called DroidShuffle can be used to make this more customizable, including handling of triple, quadruple, and long clicks. I have run into some issues with how Android handles clicks when the phone is in sleep mode though.

To complete the circuit and connect it to your phone, you will want a 4-conductor TRRS stereo plug with bare wire connectors at the other end. I found a 3.5 mm one at Mouser: What I received was: tip-red, ring1-white, ring2-yellow, sleeve-ground. [On my phone, the microphone line is ring2-yellow.] [No the microphone is sleeve and the GND is ring2.]

The components I tested are not exactly what's in the circuit file, although what's in the file should work. The components I used were: - Q1: 2N4401 or MPS2222 - D1: 1N4733A (Zener voltage 5.1 V; anything between 3 and 5 V should work)

[Check the microphone line bias that your phone puts out; if it's different from -2.5 V you might need a different D1 or may not need D1 at all. If you're using a 3.3 V microcontroller you'll probably need to change D1 and you may need a Darlington transistor for Q1 or alternatively some kind of voltage amplification.]