2
\$\begingroup\$

I have been looking around for some time and haven't found helpful information on how this is done. I am working on a project that intends to send data through the headphone jack to be processed by a smartphone. More specifically, I want to measure the temperature of water using an IR sensor. The voltage of the sensor will be sent to a smartphone where it can be analyzed to tell me what the temperature is. Is this a feasible idea?

I don't know too much about how 3.5mm connectors work on smartphones so links would be helpful as well. I know this is a vague description of the project and I'm just looking for some sources to steer me in the right direction. The project requires the usage of the headphone jack on smartphones so I can't use USB.

Side note: I am a novice undergrad engineer that might be in over his head.

\$\endgroup\$
4
\$\begingroup\$

It shouldn't be too hard to solve this problem in a way which is fairly platform-agnostic and flexible across the possible variations of your application need.

First, you need to find a circuit for injecting an audio signal into the headset jack; as headsets with wide compatibility (iphone, most android devices, and probably more) are available on the market, this is clearly possible. I believe it has been covered here before.

Then you need a means of data transmission which is easy to implement, and which is fairly immune to variations in the phone model, components, temperature, etc.

Trying to send an analog voltage level directly would likely not be - the phone (or at least input circuit you use) will likely block DC, and even if it does not you have a hard time knowing the precise gain on the phone's input circuit.

So something which encodes information over time is probably going to work better. A simple solution would be a voltage-to-frequency converter, or voltage-controlled audio oscillator. By producing a tone with a frequency proportional to your signal, and then measuring the strongest frequency in software on the phone, you'll have a fairly reliable system. It will be somewhat subject to the accuracy of your modulator though - for example, if you hack something up with a 555 it may depend on non-precision capacitors whose value varies from example to example and over temperature.

Another option to look at would be a digital modem - for example frequency shift keying. You could simply pull the specs for a 300 baud telephone modem and approximate such a signal with a square wave output from a little processor such as an ATtiny, PIC, MSP430, etc, using the processor's ADC to read the sensor and come up with a number you want to encode. If you don't need to take measurements very quickly, you could lower the baud rate still further and make the decoder easier to write.

In summary, by modulating some aspect of the signal such as frequency which is less subject to device-to-device variation, you can build a system which will be fairly universal - only requiring that you create a build of your demodulator software which can be linked into the structure of a basic audio record-to-buffer type application in the SDK of each type of phone you want to support.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the quick reply. I'm only in charge of the hardware design and this will help tremendously moving forward. \$\endgroup\$ – mphommal Jun 28 '13 at 20:03
3
\$\begingroup\$

Following Chris's answer perhaps something like an LM331 IC would be useful. It performs the task of voltage to frequency AND frequency to voltage conversion depending on how it is wired up.

http://www.ti.com/product/lm331

enter image description here

\$\endgroup\$
  • \$\begingroup\$ analog JIm is back. \$\endgroup\$ – Standard Sandun Jun 29 '13 at 0:14
1
\$\begingroup\$

Yup, this is completely feasible idea. This is just analog communication. But speed of data transmission will be not as good as the USB.

Recently i have been working on same concept. And i have found about project Hijack. Check this http://web.eecs.umich.edu/~prabal/projects/hijack/

This is 3.5 mm Jack powered device, which makes enable to communicate with the smartphone.

This is just one way communication. As far i know None has tried 2 way communication using 3.5 jack.

\$\endgroup\$
-2
\$\begingroup\$

@mphommal:

Many things need to be considered before you can get to the bottom of this problem:

1) What exact smartphone are we talking about here? Different vendors use different hardware and integration setups, which means the process will be different amongst phones, in all likelihood.

2) How do you propose to do your processing on the smartphone? Do you have the phone 'rooted,' with complete access to all the facilities of the onboard processor? Or are you looking to make this a user domain app?

3) What sensor do you plan to use? Analog, 4-20ma or 0-5VDC, or digital with a serial interface (SPI, TWI, I2C, etc.)?

The way I see it, you really have two options for doing the processing. You can search through the dev tools for your phone's OS (iOS, Android, others) and see if those tools include libraries for reading data from specific inputs. Perhaps there's one that suits your needs. OR, you can completely hack the phone, and use the onboard processor like a regular old uC, which probably means learning the appropriate assembler or, if you're lucky, the onboard processor has an available C/BASIC compiler.

Once you answer these questions, I think we can get you on the road to success.

\$\endgroup\$
  • 2
    \$\begingroup\$ I think you're making this way too complicated - a simple audio signal (that, depending on the type of data and accuracy needed either modulates and encodes the data in a digital stream, or encodes the signal as a simple frequency) can be implemented with nearly any phone with no need to root the phone or interfacing with any special phone hardware other than outputting audio that the phone can "listen" to through its microphone jack. \$\endgroup\$ – Johnny Jun 28 '13 at 20:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.