# Digital input to mobile phone headset port?

This seems to be a common smartphone project, but I haven't seen circuit diagrams with explanations.

What filter network (or resistor network, or other buffering circuitry) should be used to connect a 3.3V digital output (say from an Arduino or similar) producing a square wave at a suitable audio frequency (say around 300 to 3000 Hz) to the microphone input on the headset jack of a typical mobile phone (say an iPhone 4), so as to:

• not damage the mic input circuitry of the phone,

• provide a reasonably high signal-to-noise ratio, and

• not significantly distort the spectral portion of the digital square wave that is within the mic input audio frequency bandwidth? (to allow experimentation with digital modulation schemes beyond simple FM.)

ADDED: The following text has been moved to a new question: In the opposite direction: how should a mobile phone headphone audio output be interfaced to a microcontroller digital input? (assume no audio frequency capable A/D is available.)

• Have you found any specs about the microphone port of the phone? – clabacchio Jan 26 '12 at 9:23
• You probably want the output in a separate question; the microphone and headphones have enough differences. – Brian Carlton Jan 31 '12 at 1:18

Apparently you have a audio signal with 3.3 Volt peak to peak amplitude and want to couple that into a "microphone" input of some other audio device. Microphone inputs are meant to take the very small signals produced by microphones. These are often 1 mV or less, with peaks maybe a few mV in normal operation, although this depends a lot on the microphone.

For starters, you probably want to attenuate your input signal by at least 1000 in voltage. That may still be a bit high, but most microphone inputs can probably handle that. You will have to experiment. Maybe you need a attenuation of 3000 or 5000 so that you set the volume control near the middle of its range when listening. A simple start would be:

That will attenuate by about 2000 in voltage. Note the capacitor to AC couple the signal, which removes the DC bias of the input signal.

• This is a simple, low cost circuit. It works almost always, it will attenuate some 60dB. You asked for 300 to 3KHz but if you use a lower frequency such as 30Hz etc, the attenuation would be greater and hence your system will probably end up not working. – Ktc Jan 30 '12 at 10:09
• The circuit with the values as I show it will start rolling off low frequencies around 34 Hz and high frequencies around 16 kHz. Not only is that well beyond the OP's spec by significant margin, it is plenty good enough for all but the most demanding audio. A typical phone isn't going to reproduce that frequency range. Physical size alone guarantees 34 Hz is not a limiting factor. – Olin Lathrop Jan 30 '12 at 12:49
• @Olin L : With your circuit, the mic input will see a fairly low impedance. Could this cause any issues? – hotpaw2 Jan 31 '12 at 19:11
• @hotpaw2: It shouldn't. It will keep the mic input within a few mV of ground, which should do it no harm. Someone mentioned that this mic input may try to provide power for electret mics. Even so, bringing it to ground should not harm it. You can put a cap in series, but it has to be large enough for the lowest frequency and the unknown impedance of the mic input. For example, at 300 Hz and assuming the mic input has 100 Ohm impedance (shouldn't be that low), you would need at least 5.3 uF. A small 10 uF 10 V or so ceramic should do it. Try without first, though. – Olin Lathrop Jan 31 '12 at 19:26

I supposed you have an iPhone, and I did some research.

First thing I've found is this:

Electric Signals

Acquiring signals from some other source can be a little tricky for the following reasons:

The headset microphone input is very sensitive (it expects a low-level microphone signal). A bias voltage is present on the headset input to power electret condenser microphone capsules (used by the afore-mentioned microphone accessories). The headset input expects to see a particular load in order to signal the OS that an external microphone is present. Of the three issues, the third one is perhaps the most difficult. To be sure the iPhone OS will select your input signal, you can place a suitable resistor in parallel with your input. One user reported that a 3.3 kOhm resistor dropped the bias voltage from 2.7 to 1.9 VDC. When connecting the headphone output directly to the headset input for some basic frequency response measurements, I have had good success with a 670 Ohm resistor.

And

It should also be noted that the iPhone 3G rolls off the low frequency response of it’s headset input below 100 Hz.

You can give a try with this application and with the signal greatly attenuated, and maybe with a potentiometer try to increase the amplitude until you see it saturate. In this way, you should be able to find the maximum measurable range without breaking the phone. For this reason maybe it's better to start with a sinusoidal signal centered around 1kHz, in order to pick the less attenuated frequencies.