Android devices can be used as signal generators and signal analyzers. It is easy when all you want is to get the signal out of the speaker or headphone connector, and you are happy to analyze what internal microphone in the device receives. But what if you want to feed some external signal into your Android device?
Most Android devices use 4 contact 3.5 mm plug for headphone/hand-free-set. The hands-free sets have microphones in them, so there must be a way to get signal into your device though this connector. I started looking around. I found that almost all smartphones expect the mike and common leads on connectors 3 and 4. I found out that there are actually two ways to wire 4 contact 3.5 mm plug for headphone/hand-free-set, here is table from A note on headset standards: OMTP, AHJ and Apple article:
A little bit Googling and measuring revealed that most Android phones (and iPhone) are wired using AHJ pinout shown on right. This pin-out seems to be the case with my Samsung S4 mini smart phone and a small Denver TAC-70031 Android tablet I have.
Replacing the TRRS Plug on my phone headset discussion offered the following circuit diagram which shows how external microphone and headphone can be connected to Android phone or iPhone.
The How to connect an external microphone/synthesizer/guitar to the Android/iOS device? article reveals details how the connection of external microphone works:
Here is another interfacing circuit diagram from Sensor Data to iPhone Through the Headphone Jack (Using Arduino) article (same basic idea, different component values) and idea used in SoftModem for Arduino interfacing:
The trick in detecting the external microphone on the smart phone is to have right impedance between the mic pins. Samsung phones seem to require a microphone with impedance of around 1.0k – 1.5k Ohm. Some other devices might also work with somewhat higher resistance values (1 kohm to few kilo-ohms). It is a good idea to keep the impedance always higher than 1 kohms, not because you would risk braking something (short circuit is OK because what what happens when you plug in normal headphones), but because some resistance values less than 1 kohms resistance values can be used for control buttons on some hands-free kits.
Galaxy S4 Headset Mic & button wiring schematic pinout???? and Nexus One Headset Controls: Issue, Solution and the Aftermath articles shows a circuit diagram for Samsung headset. I got my Samsung S4 to detect external when I used 1.5 kom resistor between MIC pins (the same trick did not seem to work on Denver tablet for some reason).
The $0 Android Oscilloscope article tells how to build an oscilloscope probe for use with Android for no money if you have some basic component around. The article tells that this method allows you to get 44k samples/sec in at least 8 bit resolution. It should be enough for many uses. The article shows how to get oscilloscope view with free OsciPrime Oscilloscope Legacy app.
A Preamplifier for Smartphone Oscilloscopes article shows an improved version of the same Android oscilloscope. A Preamplifier for Smartphone Oscilloscopes Instructable describes a preamplifier circuit for making smartphone scopes more versatile and resistant to accidentally transferring too high voltages into your audio jack (destroying your expensive smart phone). The input impedance is increased from around 2 KΩ (typical mic input) to 1 MΩ (typical oscilloscope input). The supported signal voltage range is 10 mV to 50 V or more, and the safe overload range is equal or higher.
Now I got the signal connection working with my Samsung smart phone nicely, but my original aim was to use the Denver TAC-70031 Android tablet as lab instrument. So I had to do some more experimenting to get it work. First I tried several other resistance values for mic input without any better results. Always the internal mic seems to be active and no signal getting in from 3.5 mm jack. There was some small voltage on the mic pins which would indicate that there could be mic in headphone connector…. What else should I try? I need to understand better how the mic/headphone detecting circuits work to come up with new ideas. Some details on mic detection can be found at Audio Jack Detection and Controller article that describes NCX8193 audio jack accessory detector and controller operation.
It seems that this IC has detection on both the headset pins and mic pins. I quessed that maybe I should also have something connected to headphone pins as well. I tries 47 ohm resistors on headphone pins and 1.5 kohms resistor on mic input. The mic detection does not seem to work, or at least it does not seem to turn off the internal mic.
It seems that I have to forget using this Denver TAC-70031 as oscilloscope / audio signal analyzer for signals coming through cable. It seems to be only useful as signal generator and analyzing signals that internal microphone can pick up.