Electronic – Audio 3.5 mm jack unique hardware key for iOS/Android

audio

Here is the situation. Let's say there is a set of small devices supplied with an audio 3.5 mm jack. Each of these devices represent sort of a unique hardware key value (say just a number or a string). Let's also say there's is an iPhone/Android app, that needs to detect that one of these devices is plugged in on start up or the plug-in status (unplugging one device, and plugging in another) has changed. The app should have the full knowledge of whether any is plugged in, and if yes – which one exactly. There is no other interaction needed so far.

What would be the easiest (for a guy, who never dealt with any kind of hardware) and the cheapest (in production of such 3.5 mm pluggable devices) solution for the situation.

I've searched around, and most of the examples are quite complex and are about more sophisticated devices, like external sensors, programmable microcontrollers (Arduino, Hijack, etc.), which seems a bit of an overkill to me. But correct me if that's the way to go.

Best Answer

Assumption: The desired end-product is some form of hardware identification / copy-protection dongle for software to run on a smartphone.

Going from simple to more reliable, here are two options:

  1. Sound ping-back: Pure analog, no microcontroller

    • Dongle consists of a circuit as described below, connected to 3.5" (or 2.5", whatever) TRRS headset connector, to be plugged into smartphone's headset socket.
    • App on smartphone outputs an audio tone in a series of bursts (varying on-off duration) on one predefined audio channel (Left or Right) of headset.
    • Dongle circuit harvests power separately from each headphone channel: Consider a Schottky diode bridge rectifier fed by the audio signal, and with a zener diode as a shunt regulator... one on each headphone channel.
    • If audio signal is present on both channels (i.e. normal music playing, for instance) the net voltage between the harvested channels will be low to none - so the rest of the device simply will not power on, or will do so intermittently (variation of audio between channels)
    • If on the other hand, a steady sound signal exists on just one channel, i.e. a voltage difference is established between the two harvested channels, this will be used to power a simple audio-frequency oscillator of any sort, emitting a predefined frequency (the infamous 555 timer won't work, too power-hungry... perhaps a low power variant), which outputs to the microphone channel of the headset connector.
    • The smartphone app receives microphone-input, and detects whether the incoming signal is the frequency expected and none other, within analog component and design tolerances. Also, it can check whether the mic input signal exists only as long as the audio out signal is present - note the variable tone bursts mentioned above.
    • If yes, then dongle is valid, app is good to go.
    • Note that this form of dongle is trivial to crack, by splicing in an oscilloscope or even an audio recording device, between dongle and socket.
  2. Unique ID Challenge-Acknowledge via audio. Uses a low-power microcontroller.

    • Dongle again harvests power from headphone channels to power itself, as above
    • App on smartphone repeatedly outputs a unique numeric sequence as a DTMF tone with a start marker, on one predefined audio channel (Left or Right) of headset.
    • Microcontroller's ADC is used to sample incoming DTMF, to extract the numeric sequence once the start marker is identified.
    • If sequence is not a known valid one as programmed into the microcontroller's code, nothing is done.
    • For a valid sequence, a corresponding numeric sequence is generated by some predefined transform, as complex as desired.
    • This resultant sequence is output as DTMF tones by the microcontroller, back through the microphone channel of the headset jack.
    • Smartphone application receives this DTMF sequence and validates against the transformation algorithm. If the result checks out, the dongle is valid, and the app is good to go.
    • A low-power microcontroller such as the Texas Instruments MSP430 family is recommended for this kind of design.
    • Open source DTMF generation and detection source code can be found for many microcontrollers, and of course for Java or whatever other language the smartphone app is to be coded in.
Related Topic