This is a remarkably clever solution to the problem: how do I build an add-on for both iPhone and Android without paying licensing fees to either?
Project HiJack at University of Michigan gets the credit for figuring this stuff out.
- For power, your app can play a tone out the speaker jack on, say, the left speaker channel. That tone can be rectified in your external device to provide up to about 7.4 mW.
- If you need to, you can send data to your external device from your sensor. You essentially generate an audio tone in software as you might generate a radio frequency in hardware on a radio communicator. The data modulates the audio tone. You build a demodulator on your external device and you are set.
- You can get data from your external device. You generate an audio tone on your external device and play it into the microphone lead of the audio jack. The app on the smartphone can record that audio, represent it in software as an array of numbers (voltage values from an analog-to-digital converter (ADC)). The data you are sending can modulate the audio tone, which modulation can be detected mathematically by processing the recorded ADC values from receiving the audio.
This stuff is cool!