I am a certified oscilloscope nut, who owns more of them than he needs and is always looking for another one. So when I learned that cheap scope and frequency analysis programs are available for smartphones I was smitten. Unfortunately, the practical utility of the software by itself is limited. A pair of alligator clips connected to the audio jack will handle only a small range of low-voltage and low-impedance signals, could inject voltage from the phone into the external circuit, and might carry a risk of frying the phone.
This Instructable describes a preamplifier circuit for making smartphone scopes more versatile, more useful, and highly resistant to accidentally transferring lethal voltages into your audio jack. The input impedance is increased from around 2 KΩ to 1 MΩ, the voltage range is 10 mV to 50 V or more, and the safe overload range is equal or higher. The scale is easily calibrated with not much more than a volt-ohm meter (VOM.) No software is included; why reinvent the wheel when good apps are already out there for many platforms at a few bucks-or even free? The same basic circuit can be used, with minor changes, in many other systems including laptops, iPads, and Android tablets.
STANDARD WARNING: the complete circuit and your phone should be safe from accidental overvoltages of reasonable magnitude. But I take no responsibility for any damage that may occur to you, the circuit, or the phone. Nor can I guarantee that your particular brand/model phone will give good results. The frequency range will be limited by the parameters of your device; most should be usable from about 75 to 15,000 Hz (no DC). UNDER NO CIRCUMSTANCES SHOULD THE PREAMP OR YOUR PHONE EVER BE CONNECTED TO THE AC WALL JACK OR POWER LINE.
Step 1: Parts and ToolsMouser part numbers are listed because Mouser carries the special 4-contact audio plug that smartphones require. I advise that you not waste too much time soldering components together and drilling lots of holes in the box. Leave the components permanently on the solderless protoboard/breadboard. This saves a lot of effort and grief correcting mistakes and modifying the circuit, and can last for years. A see-through plastic box lets you leave the LEDs right on the breadboard as well.
Minimal Circuit - $12-15
-Miscellaneous wiring. Old audio cables (the kind with RCA plugs) are good for the input and output leads.
-Small alligator clips (2)
-SPST "on-off" switch
-Solderless breadboard [Mouser 510-EXP-350E, $5.00]
-Resistors, ¼ watt: 1.5 KΩ, 22 KΩ (2)
-1 MΩ linear trimpot [Mouser 652 -3352P -1-105LF, $1.24]
-4.7 uF capacitor [Mouser 810-FK18X5R1A475K, $.17]
- TLC272 dual op amp [Mouser 595-TLC272IP, $.71]
-3.5 mm 4-conductor (TRRR) audio plug [Mouser 171-7435-EX, $2.60]
[-3.5 mm 3-conductor (TRR) stereo audio plug for calibration signals - OPTIONAL]
-9V battery clip
-Small clear plastic box. I used a 2.5 by 3.25 inch "Really Useful Box" from Office Depot, $1.29. This is about as tight as you can get.
#volt-ohm meter (VOM) for calibrating and troubleshooting
Full Circuit - additional parts about $3.00
-bipolar LED [ Mouser 604-WP57YYD, $.46]
-blinking LED [Mouser 696-SSL-LX5093BSRD $.87]
-0.1 uF 100v capacitor [Mouser 594-A104K15X7RH5TAAV, $.50]
-Resistors, ¼ watt: 560 Ω, 330 Ω, 3.3 KΩ, 33 KΩ, 330 KΩ
-6.0 V 1/2 watt zener diode [Mouser 512-1N5233BTR $.05]
[-3.5 V ½ watt zeners (2) [Mouser 771-NZX3V0B,133, $.03 each - OPTIONAL]
-SPDT "range" switch
Step 2: Wiring the TRRR Audio Connector
Almost all smartphones expect the mike and common leads on connectors 3 and 4. Most follow the leader-the iPhone-and put common on ring 2 (connector 3) and the mike on ring 3 (connector 4.) There are reports that Droids reverse that. I’m not sure it makes a big difference, since we’re not going to connect the stereo outputs anyway. However, the shield of the audio cable is probably better off on "common."
Begin by soldering a roughly 1’ length of audio cable to the connectors for the middle and bottom ring of the 4-conductor audio plug. The bottom ring (furthest from the tip) goes to the largest connector. If you’re not going to get all fancy with RCA audio jacks and plugs, just tin or solder a short solid wire to the other ends so that they stick more easily into the protoboard. Do the same with a 1-2’ audio cable for the alligator clips and the leads for the switch(es). Be sure that the alligator clip connected to common is identified as such. When ready you can cut down the breadboard to fit in your plastic box, leaving the rest for other projects.
Step 3: The Minimal Circuit
We’ll begin by sketching the simplest possible circuit and then add improvements. This may help in building confidence if you are new to the analog world (or, like me, hate using more parts than absolutely necessary); and also in understanding what the different components do. If you have electronics experience, just skip through.
The minimal schematic above shows the core circuit and layout on the breadboard. The two op amps on the TLC272IP have the simplest possible configuration, a unity-gain buffer. "A" samples the signal of interest at high impedance so as not to alter that signal, while providing more juice downstream. "B" splits the battery voltage in half, to provide the dual ±4.5 V needed by "A". The trimpot sets the input impedance, helps establish protection for the TLC272, and calibrates the whole system. For the smartphone to recognize an external source, there should also be a resistor around 1.5 KΩ between the mike and common lead, and a capacitor (4.7 uF) isolating the mike input from DC on the preamp output. (If you are simply connecting to a high-level input, like a MacBook Pro, you could leave off the last 2 items.)
The first item to put on the breadboard should be the 1 MΩ trimpot. Use a VOM to set the wiper so that the resistance values between points A-B and B-C are approximately those given in cursive on the schematic. Make sure that whatever future adjustments you make, the resistance between points A and B remains at 500 KΩ or higher. The TLC272 has built-in protection against electrostatic discharge, especially after the circuit is complete; but don’t take chances. Use a ground strap or touch your hand and your VOM to ground before working with it. Assemble the rest of the circuit according to the schematic and the photo. Don't overlook the little wire jumpers. Note that all the "common" points come together. Connect a fresh battery and make sure that the voltage on "common" is halfway between the positive and negative connections (4.5-4.8V). Then, if things looks OK, plug it into the phone and check the results using a small input signal (see "Calibration" for where to get the signal). Initially the voltage range on NFK Oscilloscope Pro should be set around "5."
This limited circuit will work adequately for full scale voltages in the range of 2 to 20 V (±10 V), and the software will let you read down to millivolts. With the power on and the trimpot settings described, the op amp will be very safe from input overvoltages up to at least ±40 V. If you will never go near higher voltages, you might get by with this circuit and nothing more. However, it has several potential limitations: The input range is still rather small, DC on the input might prevent it from working properly, the phone jack might be exposed to transient signals approaching 5V, and you will almost certainly forget to turn it off-thereby running down the battery. So the next circuit adds a higher voltage range, more protection, and a power-indicator LED.
Step 4: The Full Circuit
A blinking LED reminds you the circuit is on and doubles as a battery meter. (Blinking gets more attention while using less power.) For an extra 5 cents, the 6 V zener will dim the LED as the battery voltage drops below 8V, and turn it off entirely below 7.5 V. The stripe on the zener should connect to the positive supply voltage.
To give a second, 10X higher voltage range the triplet of [3.3 K + 33 K] in series with 330 K produces a 1:10 attenuation ratio, and needs no additional calibration. An SPDT switch swaps between the low and high ranges. The 0.1 uF capacitor blocks any DC input.
Overvoltage Protection. The 330 Ω resistor and the bipolar LED limit the voltages reaching the phone to about ±1.8 V, and also warn you when signals larger than that are present. (They almost never should be.) If the trimpot is set to give a 10:1 stepdown, as described above, then a ±40 V input signal will be reduced to ±4 V. This is within the "completely safe" input range of the op amp. On the extended range setting, the op amp would be completely protected to ±400 V; except that the input capacitor and trimpot would likely fail long before that! In addition, the ~900 KΩ trimpot resistance will limit input currents to very small values, which should be handled by the op amp’s ESD protection circuitry. After calibrating I tested my own preamp-with the phone connected-at ±50 V on the low range and ±100 V on the extended range. There were no problems. In fact, the voltage reaching the phone jack never exceeded 100 mV. For exactly 6 cents more, the optional 3.5 V zener diodes (gray outline on the schematic) would provide even more rigorous input protection. However, they also produce a bit of noise, so I took them out.
In the new layout, note that some of the components and wire jumpers from the minimal circuit have been moved to make room for the new parts. When everything is installed, turn the power switch on and make sure that the blinking "power" LED is lit and the bipolar LED is not lit. Check out the voltages as described above, then connect to your phone. Once you are sure everything works and is properly calibrated, hot melt glue is an easy way to stabilize larger components and the wires coming on and off the board. If needed, a bit of foam holds the battery in place when the box is closed.
Step 5: Calibrating the Voltage Settings
Calibrating the Voltage Settings
Some people won’t care whether the voltages are completely accurate; seeing the waveforms and frequency spectra is enough. They can stop here. Otherwise, you will need to fine-tune the trimpot with a source of calibrated low voltage sine waves around 1000 Hz. You can provide this signal with almost any computer or a second smartphone, using the free SourceForge audio program Audacity or the free android app Signal Generator from Radon Soft. Take the signal from the earphone jack using a standard 3.5 mm stereo plug. Ideally, you would have access to another, calibrated scope to match yours against it. Otherwise, as in the picture above, a VOM will get within 5-10 %. First, generate a 1 KHz sine wave tone at high output so you can read it accurately on the lowest AC setting of the VOM. It should be around 0.5 V RMS or somewhat higher. You can then use that signal to carefully adjust the input trimpot on your preamp until your scope value agrees. If you added the extended higher voltage range, calibrate with the SPDT switch connected to the trimpot (lower voltage range), not to the resistance bridge. Remember that an RMS signal of 1.0 volt on the VOM corresponds to a waveform of 2.8 volts peak-to-peak on the scope.
With two voltage scales, a software range setting on the NFX Oscilloscope Pro of "5" is a good compromise; this will provide full-scale ranges of 5 V and 50 V (±25 V), although you could go all the way up to ±100 V. Remember that when using the extended range, 0.1 V on the scope software will correspond to 1.0 V at the alligator clips, 1 V on the scope will correspond to 10 V at the input, etc.
Step 6: Final Notes
ADDENDUM: If you haven't ever used a breadboard, the new photo may be more helpful, with the purple blobs added to show which holes the wires plug into. Round blobs indicate where the visible wires go. Square holes show where the leads go that are covered by components, i.e., the input capacitor and the potentiometer. In each vertical column of 5, the holes are already connected internally. So are the rows of ten at the top and bottom, which connect to the + and - battery leads. The holes are not connected across the middle gap where the op amp and LEDs are plugged in.
1. It doesn’t work: first double-check your wiring!
2. The phone fails to recognize the external input. Try plugging in the preamp before the softward scope app is started. Some phones reportedly may need the 4.7 uF capacitor removed. Some may need a different resistor value. Both of my Droids, my iPad, and my wife’s T-Mobile My Touch work with 1.5 K, but try other values.
3. The bipolar LED is lit. Almost certainly something is wrong. Check that the voltage on "common" is halfway between the battery plus and minus.
4. The preamp doesn’t work right and another scope shows it’s oscillating. Is the 1.5 KΩ output resistor in place? The non-inverting buffer amplifier configuration has a slight propensity to oscillate, and running without any load might set that off.
Using this Circuit With Other Software and Other Gadgets
The audio spectrum/frequency analyzers I tested worked fine, and revealed among other things that both Audacity and Signal Generator produce a much purer sine wave than my old analog signal generator. The photos on the first page come from Audacity, Oscilloscope Pro, and SpecScope.
Smartphones, iPads, and some PC laptops seem to require the audio input connections shown here. Macs and some other laptops need only a standard 3.5 mm stereo plug; for those the 4.7 uF output capacitor and 1.5 K resistor aren’t even necessary. Some PCs seem have automatic gain control (AGC) by default; you can often get around that, and extend the frequency range down to about 5 Hz, by using an audio-USB converter like the Griffin iMic or the Behringer U-control.
ADDENDUM #2: Apple has recently dropped the separate audio high-level line input from the Macbook Pro. The new headset jack seems to be the same as that on the iPad, which works with this circuit. Apple has also dropped the high-pass filter from iOS 6 onward, enabling frequencies down close to 0. However, only the higher-priced SignalScope seems to take advantage of this.
Now go out and measure something!