37

I have a small device which connects to a battery powered monitor. When I turn the wheel on the device, the monitor displays information such as when you started turning the wheel and how fast the wheel is turning. I believe the device is sending some sort of magnetic pulse or something through the 3.5 mm audio jack.

Instead of connecting the device to its original monitor, I want to connect it to my iPhone and read in the same data. The cord has a 3.5 mm audio jack at the end and fits in the iPhone normally like a headphone.

I have looked into projects like HiJack but am unsure of how to use the data I receive (or where the data is actually coming from when I do receive it), or if I can even use it in this circumstance.

Can I read data in (to the iPhone) from an external device through the iPhone's audio jack?

If yes, what frameworks/libraries do you suggest I look into?

I have looked into AurioTouch by Apple, but it seems rather complicated and isn't very straightforward.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
james
  • 26,141
  • 19
  • 95
  • 113
  • 5
    From what I know, it isn't really that straightforward. But I've read about other people doing this. Perhaps you'll find something here: [Sensor Data to iPhone Through the Headphone Jack (Using Arduino)](http://www.creativedistraction.com/demos/sensor-data-to-iphone-through-the-headphone-jack-using-arduino/) – Kristofer Sommestad Aug 25 '11 at 14:55
  • 3
    Its possible to do. Not sure how to do it though. These guys are running Credit Cards through the jack. **[https://squareup.com/](https://squareup.com/)** – Louie Aug 25 '11 at 16:22
  • 3
    @Louie - They are implementing a FSK(Frequency Shift Keying) soft modem, on the external devices microcontroller and on iOS. The speeds are very slow, about 300 baud. But thats enough for a CC scan, or reading a heart rate monitor. If you need more speed than that, or just want an easier interface, the charge port has RS-323(3.3v) connections that can reach 56.7K speeds or more. –  Nov 09 '11 at 06:14
  • 1
    I think the main difference is that the dock connector (charge port, as you refer to it) requires approval by Apple to make third-party accessories for, whereas using the headphone jack doesn't. – lxt Dec 30 '11 at 20:42
  • 1
    Also, regarding Square's decision to run through the headphone jack, many devices have 3.5mm ports, whereas only Apple devices have 30-PIN connectors. – Patrick Perini Dec 30 '11 at 20:49
  • You can also look at the Jawbone Up for another example for data transfer over the 3.5mm jack. Their marketing material mentions something about transferring data through the microphone part of the jack. (The third band) – Sum Jan 03 '12 at 00:11
  • Another related question: is the output compatible for the iPhone (V, A, R)? You don't want to destroy your iPhone's circuitry. :-p – Constantino Tsarouhas Jan 06 '12 at 11:27
  • The Jawbone UP band also transmits data to/from the iPhone via the headphone jack, and the app auto detects when you plug it in and auto syncs. Does all of this without a pin number confirmation like bluetooth does, so not very secure. If you have a malicious app open it could theoretically read data off the device if it's plugged in. – rkulla Jul 22 '13 at 19:45

6 Answers6

10

Yes, it is possible to use the iPhone 3.5 mm (1/8") headphone/mic jack as a data input, as has been demonstrated by the HiJack project - which also powers the input device.

The key, as Dominik Selbold has pointed out, is that the incoming data must be modulated at frequencies within the passband of the iPhone microphone input. Although many have suggested that this limits the data rate, in fact 19 kHz audio is a very wideband signal, capable of dozens of kilobits per second.

For example, in 2008, Jonti Olds demonstrated how using Quadrature Amplitude Modulation at audio frequencies could stream TV sound and picture between two computers,using their audio cards. What would be needed on the iPhone would be to develop a QAM demodulator for the audio input - using the FFT library - to demodulate QAM audio modulated video back into digital video - like H.264 - probably at 1/4 VGA resolution. NTSC Composite video is already QAM, but at a much higher bandwidth; about 5 MHz.

If you search the web for JQAM, you can find Mr. Olds project and code. IMHO, this would be a very cool project to tackle on iPhone or Android.

DWmFrancis
  • 101
  • 1
  • 3
5

You can read any data through the iPhone's headjack, if the bandwidth of the signal fits into the bandwidth of the iPhone's A/D-converter, which is about 20Hz to 20kHz.

Dominik Seibold
  • 2,439
  • 1
  • 23
  • 29
4

Look out for SpeakHere application if it helps and not finding any complexity... because this also works same as AurioTouch but somewhat simpler than that..

This will be much more straightforward that you are talking about if you only need to record audio.... best of luck...

DShah
  • 9,768
  • 11
  • 71
  • 127
  • 1
    the OP isn't talking about audio it doesn't seem. He's wanting to use data received through the headphone port...not actual audio. – Jared Jan 06 '12 at 16:58
  • @Jared: i think Headphone port will send data which will be in audio form only... if i am wrong please correct me... – DShah Jan 06 '12 at 17:00
  • No I believe you are correct, but the SpeakHere looked like it was for simple audio recording/playback which I don't believe will help the OP when trying to convert an audio pulse (for example) to usable data. I think we are both talking about the same thing in different ways though. – Jared Jan 10 '12 at 00:35
  • 1
    @DShah I have built an app that reads data via the headphone jack based on the SpeakHere sample in the past, so this is good advice. – Ben Clayton Oct 04 '12 at 12:55
2

If it is of any relevance, I am using the HiJack project from the University of Michigan. You can find the source here. The code is mainly written in C++, it has some bugs and yes, it is version 0.1, but if you dig in the code, you will find some interesting information regardng this matter.

Michal
  • 15,429
  • 10
  • 73
  • 104
2

I found one framework http://www.crudebyte.com/jack-ios/sdk/ but to be honest didn't try it. Seems like they have some sample code inside of binary and the last update date of the lib was in 2013-06-07, so seems like the work is going there.

1

Check ArduCom project. Its transfering serial data over iPhone headjack. www.youtube.com/watch?v=ROMvwrd0Au8