Chapter 4. Sound Card-based Oscilloscope
The title of this chapter is Sound Card-based Oscilloscope; however, I am going to start by highly recommending an external USB sound card such as this one from Creative Labs:
This model from Creative Labs (http://us.creative.com/p/sound-blaster/sound-blaster-x-fi-surround-5-1-pro) has very impressive specifications. Whether you decide to go with an internal or external card, you will want one with similar specifications:
Playback: Up to 24 bits/96 kHz 5.1
Signal-to-Noise ratio (SNR): Less than 100 dB
Total harmonic distortion + noise at 1 kHz: 0.01 percent
Recording: Up to 24 bits/96 kHz
Note the 96 KHz sample rate. This gives us a maximum measurable frequency of 48 KHz at an SNR of less than 100 dB. You most likely won't get these specifications from an internal card. Get the highest sample rate and highest SNR your budget will allow.
We will start with a description of the output section of the project. I know that oscilloscopes don't have outputs but sound cards do, and a number of software vendors have used this to their advantage. We will cover the details of that subject later. In the meantime, let's look at the output circuit.
The following circuit diagram shows the output buffer circuit. This circuit is used to isolate the soundcard from the circuit being tested.
The circuit may look odd to some of you, but there is method in our madness. Many operational amplifiers have extremely high bandwidth at unity gain. This causes them to oscillate. So the easiest way to avoid this is to add some negative feedback.
In this case...
The input amplifiers are a bit more complex. The input is AC coupled with U1, which has very high input impedance. AC coupling means that the DC component (offset) from any input signal will be removed. The gain of the first amplifier is R2/R1, or 1 in this case.
Oscilloscope probes come in times-one or times-ten varieties. In fact, some have an X1/X10 selector switch, as shown in the following diagram:
A times-ten oscilloscope probe multiplies the input impedance of your scope by a factor of 10. So your 1-megohm input scope now has an input impedance of 10 megohm. However, since nothing in life is free, it also reduces the signal level by a factor of 10. So, if it is not corrected, a 1-volt signal will appear as a 0.1-volt signal on your scope. Many modern scopes do this automatically. Ours has a switch instead.
The reason modern oscilloscopes have this option is that a 10-megaohm probe will tend to load a high impedance less than a 1 megohm probe...
Now that we have a better understanding of how the circuitry works, it is time to heat up our soldering irons and get to work on assembling the actual hardware.
Here we have the two PCBs ready for final assembly. Notice that the 5/8" standoffs on the output board, on the left, have 4 to 40 threaded studs on the bottom. You will see why in the following image:
In the preceding image, we see the two boards mounted one on top of the other. I had to do this in order to make them fit in the case I chose. I also had to use 90-degree mounted connectors. Depending on the case you choose, you may or may not have to do this.
Here we see the SoundBlaster and PCBs installed in the case and ready for the wiring harnesses. I would recommend that the SoundBlaster be held in place with Velcro for easy removal. Once you have it installed, you are ready for the final assembly.
In the preceding image, we see the case almost...
Now that we have the hardware built, it is time to put it to use. A simple Google search turned up several free and commercial packages. I have included the free ones for download from the Packt Publishing site.
Sound card oscilloscope program
One of the more useful packages I found was called
sound card oscilloscope, which is available for download from http://www.zeitnitz.de/Christian/scope. The following screenshot was taken from this package when it was in use. The only downside of this package is that it does not use the full 96 KHz sample rate of the sound card I am using.
The preceding screenshot shows the signal generator window, which is detachable from the main scope window—a handy feature in my opinion.
The preceding image shows the resulting output from our black box. Unfortunately, we only have a 48 KHz sample rate, so the highest frequency we can generate is about 24 KHz. Also, the software can only use 16 of the 24 bits, so the sine wave is not as clean as it would have been if we had been able to use all 24 bits.
You will recall that the interface has a times-ten and a times-one probe selector switch. The following screenshots are of the main oscilloscope...
Another interesting commercial package is the one available from Zelscope, and a 14-day trial version can be downloaded from their website at http://www.zelscope.com/.
This is a commercial package but it has some very useful features. The main window looks very much like (and has many of the same features as) an actual oscilloscope.
The software has a number of useful modes including an audio spectrum analyzer. The following screenshot shows the same 1 KHz sine wave shown in the preceding screenshot in the spectrum window:
In my search for interesting software, I found a very interesting and useful package called Visual Analyzer. It is written by an Italian gentleman named Alfredo Accattatis (http://www.sillanumsoft.org/intoduction.htm).
The software can be downloaded from http://www.sillanumsoft.org/download.htm.
The software is "donate ware," which means that it is free for you to use but you get additional support if you make a donation via PayPal. It is well worth a generous donation in my opinion. The following screenshot is of the main window.
One annoying thing that I discovered about the site is that the pages are not linked together very well, so I am including useful links wherever I can.
The main window displays two functions simultaneously. The top half is the oscilloscope view and the bottom half is the audio spectrum analyzer view.
The oscilloscope window contains all the controls that you would expect to find on a bench oscilloscope...
One feature that I did find fascinating though was a built-in ZRLC meter. This meter measures impedance (Z), resistance (R), inductance (L), and capacitance (C).
The software's author describes a simple test fixture for use with this feature. After some digging, I managed to find a schematic for the circuit he was referring to. The schematic is shown in the following diagram.
The following diagram shows an improved version of the hardware we will be using:
How the circuit is used to measure ZRLC is described at http://www.sillanumsoft.org/ZRLC.htm.
However, I have made some of the improvements that he suggested and corrected an error on the schematic he included. My circuit works mostly the same as he described. The TL082 operational amplifier has a FET (short for Field Effect Transistor) input, which gives it a very high input impedance. This is important because as the author says, the input and output impedances of the sound card adversely...
The test procedure on the web page is a bit hard to follow, so I have included my own version here. I have not had an opportunity to build and test the fixture, so the following steps are based on my understanding of how the jig is supposed to work:
Make sure that the Device Under Test (DUT) is not connected to the jig.
Choose a proper range, starting from the lowest if you are not sure of the value of the device.
Click on the Measure button and the ZRLC meter will begin its calibration cycle.
Wait until the Connect DUT message appears.
You should see the Over Range message on the display. This is because you haven't connected the unknown device yet.
Now you are ready to make the actual measurement. Connect the DUT and click on Measure again.
At this point, one of these four will happen:
The measurement is correct and you simply read the value from the display.
The measurement is OK but a (u) symbol appears. In this case, switch to the next higher range and start again from...
The following diagram shows a simple test setup used to measure the audio frequency response of a device:
In the preceding diagram, the device is shown as an amplifier, but it could just as easily be an active or passive filter, for example a speaker cross-over network.
In any case, the basic technique is the same. What you do is set up so that the time for one sweep and the time base of the oscilloscope are the same. This means one sweep covers the full width of the oscilloscope screen.
You hook the test as shown and sweep away. You may have to play with the sweep times and the oscilloscope time base to get an accurate display. Unless you can find a generator program with a logarithmic sweep, the entire response might not fit on one screen. You may have to sweep the test circuit in bands such as high, low, and mid-range in the case of a simple speaker crossover network mentioned earlier.
We covered a great deal of content in this chapter. We built and tested a frontend for a software oscilloscope and an audio signal generator. We also looked at several useful software packages available for free in some cases. We also saw some additional hardware that allows us to use the sound card to measure impedance, inductance, resistance, and capacitance. In addition we also learned how to build an active rectifier / envelope detector.
You will find the ZRLC and envelope detector printed circuits on the same panel for manufacturing. That way, if you order your boards from EasyPCB, you will get three of each. In the next chapter, we will be venturing into the mystical world of RF design. In spite of what some HAMs may tell you, there is nothing magical happening here (at least at these frequencies)—just a few simple rules that, if followed, will lead to success.