Tuesday, February 10, 2015

Beyond the noodlescope

A few months back, when I was starting to get interested in building electronic circuits again, I thought it would be useful to have an oscilloscope. I came across several web pages describing how to use the headphone/microphone socket on an Android phone with some open source software to make a really cheap scope that would work at audio bandwidths. Based on one of the pages (which I can't find now), I knocked up a 10:1 probe consisting of a FET, a capacitors for uncoupling the DC and some resistors. I tried this with a couple of programs: OsciPrime and XYZ-Apps Oscilloscope, running on a very old Nexus 1.

I connected it up to a small, fixed frequency oscillator with sine, square and triangle wave output, this Velleman kit. Here's how the sine wave looks on OsciPrime:

If you can tell from the out of focus photograph, it looks OK.

Here's the triangle wave:
As you can see, it's different from the sine wave, but far from triangular.

Here is the alleged square wave:
This is surely the most horrible square wave in the world. And it's strange as well. If it was just losing the higher harmonics, you would expect each pulse to be symmetrical in time.

Many months later, a kind friend made me guardian of his old Tektronics 465 so now I can see what the Velleman signal generator is really producing. Here's the square and triangle waves:
You can see the square wave is pretty clean (as you'd expect - the circuit is a 555 and a filter network to remove the harmonics). The triangle wave is a bit soft edges, but is also noticeably more symmetric.

So what was going on with the square wave and to a lesser degree with the triangle wave? Based on some simulation, I think it that as well as losing the higher harmonics, there is a phase shift on the remaining ones, and the shift is different at each frequency. 45 degrees on each of the odd harmonics results in something close to the observed square wave. I assume the Androids audio circuitry or the software behind it does this. I wonder why.

No comments: