Best oscilloscope app so far...

Yes, it's out now and it's a beauty. It's a very nice app, the most satisfying to date and something I'd wanted to do for a long while now. I mean oscilloscopes are great things. First they look good. Lots of controls which look mind bogglingly complicated - check. A dot that pings across the screen like a life support machine - check. The ability to actually see what is going on in a circuit in real time - check. Probes that look like surgical instruments - check.

I used to have two 'scopes (as they are affectionately known) before the family arrived but they had to go because an oscilloscope is not exactly a small thing. Mainly due to the cathode ray tube and the corresponding circuitry to produce the extremely high voltages to persuade the electrons from the gun to fling across the length of the tube. However the architecture of an analogue oscilloscope is very simple. Once the correct voltages are applied to the cathode ray tube the gun will emit a stream of electrons that accelerate towards the screen at great speed due to the high voltage potential in grids inside the tube. When they hit the screen it glows green (traditionally) due to a phosphorescent coating on the inside of the screen.

That setup alone produces a dot in the middle of the screen. Not that exciting, we need a trace. The axis on a 'scope is time on the horizontal and amplitude on the vertical. In the tube there are vertical and horizontal deflection plates. To achieve a trace a sawtooth oscillator acts on the horizontal plates. The amplitude of the sawtooth defines how far from the centre of the screen the trace will track (that's one control we need to adjust) and the frequency will define the time a trace takes to travel from left to right. The only tricky part is to ensure the sawtooth oscillator provides a separate pulse during the step part which is fed into the grid amplifiers to ensure the beam is stopped during the fly back phase. Horizontal is mapped to time and time should only go one way!

With that in place the central dot becomes a moving dot, with its speed depending on the sawtooth frequency. Due to the phosphorescent coating on the screen it continues to emit light after the beam has moved away. This means when the sawtooth frequency is increased the moving dot appears as a constant line. When televisions had cathode ray tubes they relied on exactly the same trick.

The final step is the easiest. The input signal to the scope is amplified and then fed to the vertical deflection plates. Now the beam will draw whatever signal is applied to the input on the screen. For more detail the vertical deflection amplifier gain can be increased.

That gives the basics of a scope. We can now check a signal and instantly get a feel for it's content. Has it any obvious noise or distortion, low frequency content, high frequency content, the sizes, any regular patterns? Most of this is hidden to a multimeter which has to average out to give a single reading.

However this basic setup has a key problem. It is very hard to view repetitive waveforms, like a basic sine wave. Due to the phosphorescent coating the screen continues to emit light after the beam has moved on. This is a good thing and prevents flicker and makes slow frequency timebases easier to view. However on fast timebase frequencies this persistence means several traces will appear to be on the screen at the same time and actually mask the real shape of the true signal.

Oscilloscope waveform with no trigger
Where's the sine wave here? Without trigger the true signal gets lost in overlapped waveforms

The phosphorescent coating is a physical thing so cannot be adjusted to switch this off for higher frequencies. Even if it could it would result in the display becoming very dim.

Instead to get around this issue scopes have a trigger section.

The trigger circuit freezes the sawtooth timebase oscillator in the flyback position. In other words the trace is blanked and about to begin, so nothing is seen. The trigger circuit compares the input voltage to the vertical amplifier against an adjustable trigger voltage. Only when the input level crosses this level does the trigger circuit allow the timebase oscillator to continue unobstructed until the next blanking phase where again the trigger circuit will force it to wait until the trigger threshold has been crossed. That a ensures that the start of the trace always occurs when the input waveform is at the same position so it will appear stationary on the screen. It's important to realise the input signal must cross the trigger threshold to trigger the trace. Scopes will have an option to trigger on a positive edge (signal going from below threshold to above) or negative (signal going from above the threshold to below)

Oscilloscope waveform with trigger switched on
With trigger switched on the waveform no longer moves so we can see it - a perfect sinewave!

This can be initially confusing if the signal is always below or due to a DC component always above the threshold level. The trigger threshold will never be crossed, so nothing is seen on the screen. The threshold level must be adjusted carefully to ensure the signal triggers to see the trace.

Sometimes the trigger function is not required or does not suit the input signal. In this case the trigger section can be switched to "Auto". This setting means the trigger circuit will automatically fire on each blanking phase ignoring the state of the threshold. In other words the trigger section is effectively switched off.

Overall this neat design mean once a scope is calibrated it is both accurate and reliable. There's not really much to go wrong. Which makes it a great tool.

Now with advent of flat screens and capable cpu's I thought it time for me to model an oscilloscope in an app. It is fairly straightforward to draw a signal on the screen but it was really important to me that the app should behave and look like a real cathode ray tube oscilloscope in real time. This made development much more tricky but in the end worthwhile. To me it has that analog scope feel but fit's in my pocket!

Tags: ios