An oscilloscope can provide insight into data streams and more. Here's how.
One of the most useful tools for any maker is an oscilloscope. This article is going to examine what an oscilloscope is, how to use one, and how we used it as part of a recent project. The oscilloscope we used was a Jaycar QC1934 and is technically labelled as “Digital Storage Oscilloscope 100MHz 1GSa/s”. But what does that all mean? Let’s start by breaking the title down.
OSCILLOSCOPE: An oscilloscope is a device we use to show the waveform of a signal. That’s useful, but how do you determine the frequency, the voltage, and the pulse width? We’ll get to this shortly.
DIGITAL: Historically, oscilloscopes were known as “CROs” (cathode ray oscilloscope) as they used a cathode ray tube (CRT), similar to what was used in those TVs that were nearly as deep as they were wide - remember them? They were typically partially analogue, and large and heavy. Modern oscilloscopes are digital, use an LCD panel for the display, are relatively small and lightweight.
STORAGE: In the context of this particular oscilloscope, the word “storage” means that it can literally capture a displayed waveform and allow you to examine it long after the signal is no longer available. In the days of CROs, this storage mechanism boiled down to the image being preserved on the face of the CRT itself. This was quite a bit of engineering and really increased the purchase price. These digital days it’s a lot less trouble.
100MHZ: This refers to the frequency range of signals that can be used with the instrument; higher is better and more expensive. For most makers, or those who are only working with audio gear, this is usually more than sufficient for your needs; in fact, 20MHz is probably all you need in most cases.
1GSA/S: This means that one billion digital samples per second of the applied waveform can be taken and used by the oscilloscope. As this is a digital device, it can’t show a varying waveform without determining its amplitude (i.e., its voltage) from time to time. Many samples are required to show the waveform as it really is. If you refer to our Function Generator project in Issue 8, you’ll find additional useful information on this subject. Put simply though, if you are looking at a smooth waveform like a sine wave, the oscilloscope needs many samples to reconstruct it on the screen. We could take just four samples and show a waveform that while nothing like a sine wave, would represent the voltage and frequency .
To make the waveform displayed look more accurate we need to sample it much more often, so that we can follow the undulations of the signal, and make the displayed waveform true to life. The higher the sample rate the better; but again, if you are working with lower frequency signals you probably won’t need such a high sampling rate.
It should be noted, a vital point is missing from the title, as this is a “dual channel oscilloscope”, which means that it can display two separate signals at once, on the same screen.
Now that we understand some of the terminology, let’s dig a little deeper and learn how to control an oscilloscope. While models may vary in terms of their layout, there are basic features that every oscilloscope shares. For example, let’s look at how it displays the captured data samples, and how we can manipulate that display to get more information.
The horizontal aspect of the waveform determines its frequency and/or pulse width. The vertical aspect of the waveform determines its amplitude (its voltage). It often happens that the signal being examined is either too high or too low in amplitude, to be able to see it in any detail. If it is too low, you may see just a line or tiny bumps on the line. If it’s too high, most of it may be off the screen. An oscilloscope has provision for both of these cases.
You can attenuate the signal as necessary. For example, reduce the signal amplitude if it’s too high; or lessen the attenuation, if it’s too low. This allows us to see the waveform from it’s minimum to its maximum, although this is not always required.
We can do something similar on the horizontal axis. Let’s assume we have a relatively high frequency signal. We may see only a blurred block of waves. If it’s a low frequency waveform we may just see half or less of 1 cycle. Neither of these situations allow us to examine the waveform properly.
When you examine an Oscilliscope, you will likely see a group of controls inside a box marked “Vertical” and some more controls marked “Horizontal” in a group .
At the bottom you will see a cable attached and another connector marked “CH2”. As already mentioned, this is a dual channel oscilloscope, so it can display two separate waveforms at once. In the Vertical box you will see two sets of controls: one for each channel.
To make the displayed waveform higher or lower we can use the larger knob with “V mv” marked on it, which means “Volts to millivolts”. In other words, it adjusts the amplitude of the displayed waveform.
In a similar way we can change the horizontal aspect of the waveform with the knob in the Horizontal group marked “S ns”, where “S” refers to seconds, and “ns” to nanoseconds. This allows us to vary how much of the waveform to display or how many cycles to be displayed.
This is helpful, but how do you actually measure the amplitude (the vertical axis) or the frequency (horizontal axis)?
In front of the display is a grid known as a graticule. It is typically marked out like graph paper, with major divisions each centimetre, both vertically and horizontally. Smaller divisions at 2mm distances are included too.
With those knobs marked “V mv” and “S ns” we are not just changing values randomly; instead, they directly set the value (time in the horizontal axis, and voltage on the vertical axis) per centimetre on the graticule.
You could set 1V per centimetre or 1mV per centimetre. Let’s assume you set it to 1V per centimetre, and you have a waveform that is 5cm high. That is, in fact, 5V (peak-to-peak). If you have set the horizontal axis to represent 1ms per centimetre, and the displayed waveform shows one complete cycle over 1cm, then the period of the waveform is 1ms; and therefore the frequency is 1kHz.
As a demonstration, let’s say we change the horizontal setting to be 100us per centimetre (or division). We’ll now see that one cycle of the waveform is stretched out from one division to ten. This allows us to examine it in much more detail. If it’s a pure sine wave then we would see a smooth rise and fall of the waveform. If it was produced by a digital source, we would not expect a smooth waveform but, instead, a step waveform that approximates a sine wave. The more samples that are used to make the waveform, the less obvious those steps will be. You may find that a digitally generated sound is different to your ear than a pure analogue waveform. Now you know why and you can see why. This is the power of using an oscilloscope.
Other controls on an oscilloscope allow you to move the displayed waveform up or down on the vertical axis, or left and right on the horizontal axis. These are invaluable while examining various aspects of a waveform.
There are three buttons in the top right, which are related to the storage facility. There are several other buttons visible, but generally we don’t need to use them.
Many digital oscilloscopes provide a USB port that you can use to store data gathered by your oscilloscope thus providing a level of waveform storage or in a pinch, charge your mobile phone. They also often include a function generator with square, sine, triangle etc waveforms. This is certainly a great addition to any workshop.
It is of little value to have the displayed waveform moving back and forth across the screen. We can trigger the oscilloscope to display at a certain point in the waveform. If it’s quite random, it may be difficult to keep an analogue waveform steady; but for a digital waveform, things are more in our favour. We can set the oscilloscope to trigger off a signal going high, low, or just changing levels. Any oscilloscope you encounter will have a number of trigger options.
To connect the oscilloscope to a signal source, we use specialised oscilloscope leads. These are quite flexible and shielded to minimise electrical interference. They generally have a bare tip that allows connection to any component, but keep a steady hand. An adaptor slides on to the probe to add a spring hook, which allows the probe to be clipped onto a component.
Referring to the images provided earlier, you can see a red slide switch. This allows changing the input impedance and simultaneously the sensitivity of the probe. In the 1:1 position the oscilloscope has a nominal input impedance of 1MΩ. In the 10:1 position it has a 10MΩ input impedance. In the 10:1 position the signal fed to the oscilloscope, reduced to 1/10 of the actual.
It is important to note that a small amount of capacitance is introduced when using an oscilloscope. It may not be relevant to a maker but the odd 20pf can make a difference. Even more so, consider what happens when you connect 1MΩ in parallel with a high value resistor in circuit.
If you connect 1MΩ across 100Ω, there will be no discernible difference. However, if you connect 1MΩ across say a 1MΩ resistor in circuit, you have effectively made that resistor 500kΩ. This may well change the behaviour of the circuit being examined.
There are several USB based devices available for around $200. These are generally fairly bandwidth limited at 20MHz but small and light. They display the output on a laptop.
There are also several 2.4” kit or partial kits oscilloscopes available. These have a bandwidth of 200kHz which may be adequate for some uses. The cost of these is under $50.
Finally, there is the SoundCard Oscilloscope. Yes, this uses the audio hardware of your PC or laptop to give a 20kHz bandwidth oscilloscope. The software is no cost for personal use. It also has a function generator included.
Go big or go home
Tektronix have long been considered the standard in oscilloscopes and formally CRO’s. Their entry-level model looks somewhat similar to the model in this article. It starts at USD470. For USD12,600 you can have a 15.6” screen, with 4 or 8 channels and up to 16 digital inputs. Various models in this range have a bandwidth from 350MHz to 2GHz. The next model with a screen is USD19,200 then they have 3 more models that they don’t care to disclose the price on.
CATHODE RAY TUBES (CRT)
A CRT is a specialised type of thermionic valve, or “vacuum tube” as they may be known overseas. Valves have a glass envelope with a number of metal plates (electrodes) inside them, and nearly all are under a vacuum. A minimal valve has a cathode, which as you know is a negative terminal; and an anode, the positive terminal. While cold cathode valves exist, the cathode is generally heated to 450+ degrees Celsius, and it’s coated in a substance that emits electrons when heated.
What makes a CRT different to a general purpose valve is that a phosphor is applied to the front surface. This phosphor emits light when hit by electrons. We know that the heated cathode emits free electrons, which are attracted to the positive anode, but that electron beam is static (i.e., it doesn’t move). If the CRT was left in that condition it could damage the phosphor coating.
We need a technique to move the electron beam to light a path on the screen; effectively showing the applied waveform. Moving the electron beam uses a technique called “deflection”. Old boxy TVs had CRTs too. Due to their relatively large-sized CRTs they used “electromagnetic deflection” to deflect the electron beam. Here, a number of specially shaped coils (deflection coils) are mounted on the CRT. Current flowing through these coils causes a magnetic field to be induced. Magnetic fields can deflect (move) electrons, so the current fed to the deflection coils is controlled to “sweep” the electron beam from side to side, and top to bottom on the screen.
The strength of the electron beam is controlled to follow the video level of the image being displayed, and the brightness of the image on the screen. Due to persistence of vision, and other factors, a complete image is formed and refreshed regularly, such that a dynamic moving image is displayed.
The CRT used in CROs and similar devices is relatively small, so a different deflection technique can be used, which is called “electrostatic deflection”. Recall that the electron beam is negatively charged and is attracted to a positive charge. By varying the voltage on deflection electrodes in the CRT, movement of the electron beam is managed. Unlike a TV, the whole screen does not need to be scanned regularly. In this case, the electron beam is moved over the screen from left to right and up and down as necessary, to show the applied waveform.
STORAGE CRTS: These have a mesh behind the front surface of the tube, and a separate electron gun that targets the whole surface of this mesh. This mechanism acts to “remember” the displayed waveform.
Examining The Pulse Train
The waveform above is a replica of the actual result we saw while working with the DHT11 temperature and humidity sensor. This device has just three connections, namely 5V, ground and a sense pin. To get reliable results from it, fairly accurate timing is necessary. The sense pin acts as both an input and an output too.
Let’s break down the signalling. This is all done via one digital I/O pin, on an Arduino connected to the sense pin of the DHT11.
- It all starts with a low going pulse on the sense pin of >= 18ms. The part of the waveform marked A is the end of the 30ms ‘wakeup DHT11’ pulse. This tells the DHT11 that we are expecting to read data from it.
- The DHT first responds with a 80us low pulse. This is in fact all of B, C and D, but look at that odd waveform. B is the Arduino pulling the signal up.
- Is the DHT11 trying to pull the signal low.
- The low-going edge between C and D is the Arduino’s pin being set to be an input and hence effectively tri-state or high impedance. In this state it is not outputting a signal at all therefore the DHT11 can pull the signal low.
- After the 80us low pulse the DHT11 gives us a 80us high pulse.
- Between each data bit, the DHT11 outputs a low signal of about 50us.
- This is the 1st data bit.
- This is the 2nd data bit.
- This is the 3rd data bit.
You can see that G and H are narrow, and I is wide. That’s 2 x 0 bits and a 1 bit. This is in fact the start of the humidity value.
The 32 bits of data that we are interested in are:
00101001 00000000 00011011 00000000
This is hard to interpret, so let’s convert it to hexadecimal:
29 0 1B 0
The data is still a bit obscure, so we'll look at it in decimal:
0x29 = 41, 0x1B = 27
Based on this data, the humidity reading is 41.0% and the temperature is 27.0°C.
How was it possible to read the 32 bits of data when previously we saw just three? It’s easy because the oscilloscope has stored all of the waveform, and using the horizontal position control as mentioned earlier, it is easy to move the waveform left or right. In this case, moving it left allows looking at successive bits. Faced with 11 consecutive 0 bits does make it a little difficult to determine one bit from another, but by carefully moving the display for four bits at a time (for example), allows drawing the waveform, or recording the pulse widths as 0s or 1s.
That's a brief introduction to using an oscilloscope which, if you haven’t already discovered, is a must-have tool in every maker’s kit.