Friday, July 10, 2015

Using the Audio Jack for power and digital interface to smartphones!

If you have seen credit car readers on smartphones, you will see they are a small block that plugs into the smartphone's audio jack, what you might think of as its headphone jack.

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!