Use of 3.5 Jack

Greetings all,

I’m just looking into developing a relatively simple app. I have no programming knowledge myself but have enlisted someone who has some basic experience.
What I’d like some help with is utilizing the iPhone’s 3.5 jack in an app. Is there somewhere I might be able to find some sample coding or specific info on using the jack to send a signal through a cord? For example, if I were to connect a cord to the iPhone and a buzzer, I would want to have the buzzer controlled by pressing a button in the app. Any help here would be greatly appreciated. Thanks!

You have no control over it. if the jack is in, iOS will automatically output audio there, otherwise on the speaker

Thanks for the reply.
The only reason I felt there might be a way to utilize it is because of apps like RedEye and Time Fugit which utilize devices plugged into the jack.

Unsure how they work, perhaps they use specific audio signals to instruct the plugged in device to do things actually

Just some thoughts :

The audio mini jack outputs voltage that changes with time, in a form called pulse code modulation. To me, this is a bunch of rectangles (called pulses) whose height represents voltage and width represents how long this voltage lasts. Now those pulses can be used as remote control signals. Connecting the mini jack output with a pcm decoder like this one you can control servos, leds etc.

But it is not trivial. One should find remote control signal specifications, hand draw samples that resemble commands in the right bit resolution (8 bit or 10 bit ?), test it against the pcm decoder he/she chooses (pic, avr ?) and end up with something that shows pretty to computer science / electric engineer colleagues but quite bulky to others.

Also one should consider the difficulty to find a channel to sell such stuff. Oh, and testing is not trivial too ( oscillometers anyone ? ). Sure, if someone is an electric engineer (or is willing to study what an electric engineer studies ) can go through those steps, the question is if it worth’s it.

1 Like

Also i read somewhere that if you mod a default function of the device, like changing what some button do, your app will be rejected and if you hide the feature when apple discover you’ll be banned from the dev community.

Thanks for the tips, all.
Believe me, the last thing I wanna do is attempt to put one past Apple. I just figure if they approved two apps (that I’ve found so far) which make use of the 3.5 jack then there should be no problem with my idea.
I’ll forward the info you guys have given me so far to my developer and see what they say. If anyone has anything else to add, please do!

The stuff related to that on the electric engineering, if you have a general engineering math background (maths and complex analysis, fft and signal analysis and processing - feedback theory) its not that hard actually. it just sounds 10 times scarier than it is if you can do it practically :slight_smile: The only heavier stuff if you went to highschool and potentially college with some basic focus on math are complex analysis and the getting the initial grasp on the signal related stuff.

Good thing is that it will help you in other fields. Audio Filters in unity are an application of the same theory for example.

The most complex thing at the end of the day is creating the actual device that sits on the other side and program its microcontroller (an FPGA for such a task potentially as cheapo and “trivial” to program compared to some real thing) so it does anything meaningfull per se and then naturally the whole functionality and hardware to the actual purpose it was meant to fullfill.

With no background, totally undoable, but with some background it can be a grea, satisfying tinkering project :slight_smile:

I have to agree with Dreamora.

I’m pretty sure I could rig up a prototype bi-directional serial interface from an iPhone audio jack to a .50 embedded microcomputer in a day or two without resorting to using an FPGA, FFT or any complex math. The hardest part for me would be doing the send/receive side on the iPhone because I would need to learn more about generating audio to send the data. If only I had the time to work on something so fun!

My degree is in computer science but I started to dig into embedded processors a few years back and found it to be an amazingly interesting hobby. See my site at http://www.speechchips.com for some of the results.

Would you need to send data as audio? Could it not be utilized to send a weak electrical pulse?

Well the audio coming out is an electrical pulse anyway. You would need to generate a serial data stream using the audio out of the iphone and have a device attached that could read the signal. I understand you want to get into this but as Dreamora says you’re going to need to do some homework regarding embedded devices before you can even begin to think about an add on for an iPhone.

This page talks about getting power from the iphone audio jack.
http://blog.reinforce-lab.com/2010/10/iphonegettingpowerfromaudioplug.html

It also has a link to a page in Japanese regarding building a software modem to communicate using the audio jack.

http://www.reinforce-lab.com/projects/iphone-software-modem

Also, found this link using the google.
http://translate.googleusercontent.com/translate_c?hl=en&ie=UTF-8&sl=ja&tl=en&u=http://arms22.blog91.fc2.com/blog-entry-350.html&prev=_t&rurl=translate.google.com&twu=1&usg=ALkJrhjZxf7_zXjzv_nuKR_s-q31zb-a2w

Also http://www.perceptdev.com/labs/ has circuits and software and a link to a book that describes the entire process.

Interesting, I was pretty certain that apps had to be MFI approved to provide this type of functionality but I don’t see that any of those apps given as example are.

On a side note regarding using audio signals for i/o; flagging your application (by setting UIBackgroundMode or whatever it’s called in plist) as audio and not being a “real” audio application is a pretty sure way to get rejected.

Would be very interesting to hear how RedEye and Fugit got their apps approved…

For an iphone you would pretty surely want to use the lowest level audio framework it offers.

RedEye / Fugit might have signed the corresponding 3rd party hardware usage contract with Apple which you commonly end on if you want to create a hardware extension for it and don’t want to fear cases where apple forcefully cuts you out.

you would do that anyway cause if you want to bring such a device officially to a western market, it needs to go through official bureaus etc for approval before you can sell it, a lot of legal paperwork and costs which you aren’t going to spend before verifying that you can even work on the device you want to target