I have a little project where I'm trying to control the music playback (play/pause/next/...) on an Android tablet from a Microchip PIC18F MCU.
The tablet has a TRRS mini-jack interface for sound output (ground/left/right audio) and also mic/buttons input. This interface is mentioned in other questions and well described in the Android Headset specification:
Basically, each button is connected in series with a resistance of a known value (or rather within a certain range). When a button is pressed, the corresponding circuit is closed and the phone can detect which button was pressed (presumably through some sort of ADC of the voltage level at MIC input).
Now, I would like to have my MCU simulate the various button press, but I'm not sure on how to proceed... basically I need to create a digitally controlled resistor that can take a set of given resistance values.
At first I thought about outputting specific voltage levels at the MIC input (for instance using a PWM output on the MCU), but I don't think that's a very good/robust approach since I don't exactly know how my tablet detects the button presses and also I would like to avoid making my circuit tablet-specific. Currently, I'm thinking about a solution using the resistors connected in series with some small bipolar transistors used in switching mode and controlled by the MCU that would replace the buttons.
What do you think about this idea? Could it work? Do you have any better idea on how to proceed?
Thanks in advance for you suggestions!