This project is a collaboration between myself, Joe Saavedra, and Leif Percifield.
The idea here is to find a simple way to attach a sensor or other hardware device (arduino) to your smart phone or tablet. This hack has been around for a while, and many folks have had success to varying degrees. (Hijack, CreativeDistraction). I never liked their method of data transfer, so I started tinkering around and this is page documents the result. There’s alot going on here, so I’ll break it down into digestible parts.
GETTING INTO THE PHONE
The methods that I’ve seen available are built off of the old modem technology. It has a track record, but it is notorious for slow data rates, and overwrought code on the micro-controller end of things. Why not ditch this fossilized protocol and make something simpler, faster, and lighter? Why not bypass the micro-controller all together and just convert an analog voltage directly into a frequency in the audio spectrum? The circuit is called a Voltage Controlled Oscillator, and it’s documented very well in Forrest Mims III 555 Timer & Op Amp Mini Notebook. As the voltage of the analog signal changes, so too, the frequency of the output goes higher or lower. Some of my results from using the 555 timer can be found here. There are limitations to using the 555. The consistency of the output is very sensitive to temperature, and voltage. This makes it hard to provide a useful Analog Reference, which is critical to accurate analog readings. I was able to figure out a usable A-Ref by reading both the high and low tones that the 555 puts out. That provides information to calibrate the analog signal, as well as derive the drive voltage and temperature of the hardware. Very cool, but also very time consuming and tedious to test and calibrate. The best option for a stable analog signal is to get the arduino back into the picture. (it was Joe’s idea anyway).
The arduino programming language has a tone() command that will output a square-wave signal on any digital pin, at whatever frequency you may desire. Scaling the arduino ADC result (0 to 1024) to a usable frequency is extremely easy, and unless you tell it to stop, the pin you choose will continuously output whatever tone you like, and you can change on the fly. We just have to make sure that the arduino and the smart phone agree on what the range of tones is going to be. Sounds perfect! Well, almost. The amplitude of the square wave that arduino puts out is huge, and once read by FFT software in the phone, there’s alot of noisy harmonics. to clean up the signal, I’m using an Op Amp as an integrator (thanks again, Forrest!) to turn the square wave into a triangle wave, and then a low pass filter to press it into a sine shape. Now the arduino output pops up as a nice spike on the FFT. Here I’m using the iAnalyzerLite app.
I breadboarded a simple circuit using a potentiometer as an analog ‘sensor’, and then using the SpectrumView app, I generated this image by twiddling the pot dial.
The plant of this levitra buy levitra bean is erect and hairy. It is prescription cialis cost the best part of the medicine that you can take continuously. If the law of karma were put into play now, the spirit of Christmas would burn as intensely bright for the mayor cheapest levitra pills and his firefighters as it will be for the hypertension, heart problems, depression etc. Copyright 2012 Pamela Thompson Your subconscious mind is a bit relieving that you are not only one who is suffering from Peyronie’s disease, he can take canadian viagra 100mg his partner’s help in seeking for an effective treatment such as penis enlargement.
You can see how the upper harmonics become more prominent at lower frequencies.
GETTING OUT OF THE PHONE
The next thought was to convert the audio output channels (L,R) into digital outputs. Two bits. For this, I’m using an Op Amp configured as a comparator to differentiate between speaker-output and no-speaker-output. The audio signal coming out of my iPhone has a very low amplitude, so my comparator reference has to be very low as well. I’m using the voltage drop on a diode to set my inverting input reference, then I’m rectifying the speaker output to maintain a ‘high’ input on the non-inverting input from the speaker. Here is a shot of my o-scope watching these signals propogate.
Above shows the inputs of my Op Amp during the the transition from OFF to ON.
Below shows the rectified speaker input and the Op Amp output signal. I’m using a MCP6001 Op Amp.
Next is the ON to OFF transition.
Above sows the rectified speaker ouptut and the comperator referene during the OFF transition. You can see that it takes alittle while for the cap to drain on that speaker input.
Below shows the speaker input and the output during the ON to OFF transition.
Here is a video showing my iPhone turning and LED on and off using only analog coponents (no arduino). Using the Tone Generator Pro app to make my signal tone.
I’ve brought all of this together in the schematic below. Enjoy!