# Understanding this circuit for getting sensor data from an arduino to a phone via the headphone jack

I am trying to understand the circuit below which relates to getting sensor data from an arduino to a phone via the headphone jack.

The instructions on this page aren't clear on what the function of the resistors/capacitor is so I was hoping someone here could give an explanation.

Thanks!

1. R1 is needed for the android device to recognize that there is something connected to the earphone port.
2. R3 and R2 are a voltage divider to reduce the signal level from the arduino to a level that the android device can accept. It reduces the level at a ratio of 5 to 1 (5V from the arduino would give 1V in to the android.
3. C1 is used because the android uses a DC voltage on R1 to detect the external connection. C1 removes the DC part of the signal from the arduino so as not to interfere with the android accessory detection.

To one way of quickly looking at it,

R3 and R2 form a resistive divider which limits the amplitude of the output to something which will not excessively overdrive the microphone input.

C1 is a DC-blocking or AC-coupling capacitor which passes only change in the signal level, while removing offset in its average, or DC voltage. This is quite normal when moving signals between audio devices or stages.

R1 may exist to help the phone detect that a device is connected. It also functions as something of a frequency dependent voltage divider with C1, ie, a filter.

Overall, the circuit will have additional filter characteristics. You can formally analyze it analytically by writing the capacitor as a frequency dependent impedance and then basically treating it as a network of complex-valued resistors, though the algebra will be a bit expansive. You might consider simulating the behavior in ltspice or various online tools, over a range of audio frequencies. Assume 5v square wave output from the Arduino/MCU.