This is only a preview of the August 2002 issue of Silicon Chip. You can view 24 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Digital Storage Logic Probe":
Items relevant to "A Digital Thermometer/Thermostat":
Items relevant to "Sound Card Interface For PC Test Instruments":
Items relevant to "Direct Conversion Receiver For Radio Amateurs; Pt.2":
Purchase a printed copy of this issue for $10.00. |
Add a digital ’scope to your test
bench for the price of a large pizza!
By PETER SMITH
Do you own a computer with a sound card?
If you do, then all you need is this simple
project, a little spare time and some free
software to build your own ultra-low cost
digital oscilloscope – and more.
The sound card in your computer is
useful for a lot more that just recording
and playing audio tracks. With the
right software, you can have a virtual
electronics lab full of digital test &
measurement tools that won’t crowd
your bench or break the bank!
Sounds too good to be true? Admittedly, the sound card is an audio
device, so the “virtual” test instru58 Silicon Chip
ments will be limited to work within
the audio spectrum. They also lack
some of the goodies that are available
on their physical counterparts, such
differential inputs and direct (DC)
coupling – but the price is right!
This project will enable you to use
your PC as a digital oscilloscope, spectrum analyser and signal generator.
Other more specialised instruments
are also available in software form,
such as signal processors, loudspeaker
analysers and enclosure design
ers,
radio demodulators and decoders,
and so on.
If you work in education, are new
to electronics or would simply like to
learn about digital instruments, then
this project is for you.
A sound background
In basic terms, a PC sound card provides an interface between the analog
world and the digital internals of a PC.
Signals appearing on the sound card
inputs are first coupled to an analog
multiplexer/mixer and then piped to
an A-D (analog-to-digital) converter. Depending on your application
www.siliconchip.com.au
Fig.1: simplified block diagram for a typical PC sound card.
software, the resultant “stream” of
digitised data from the A-D converter
may be further manipulated (filtered,
enhanced, etc), transported elsewhere
(eg, to the Internet) or just saved as a
file to the hard disk.
During playback, the reverse process
occurs. The digitally encoded audio
data is converted back to analog format
by the sound card’s D-A converter,
then filtered, amplified and fed to
the loudspeaker and/or line output
sockets.
For the technically curious, a
simplified block diagram of a typical
sound card is shown in Fig.1. As you
can see, there’s a little more to it than
we’ve described. Analog and digital
audio from a range of sources can be
mixed and level-shifted along both the
input and output signal paths.
Software-based instruments that
provide stimuli, such as sound generators, utilise the sound card’s D-A
converter and analog output circuitry.
Generally, sound card outputs can di
rectly drive external circuitry, so no
additional hardware is required.
By contrast, instruments that need
to acquire data, such as oscilloscopes,
do so via the sound card’s analog
input circuitry and its A-D converter.
Software is then used to interpret the
digital data stream and generate a
graphical waveform display similar in
appearance to conventional CRT-based
(analog) oscilloscopes.
All that’s left to do then, is to apply
the signals to be examined to the sound
card’s inputs in suitable form. And
that’s where the hardware part of our
project comes in.
Getting attached
This simple adapter circuit provides
a simple oscilloscope-like interface between the signals we wish to measure
CHOOSING SOFTWARE
This adapter circuit is basically
designed to allow you to connect
test probes to your PC’s sound
card. Once the signals are in,
software does the rest.
There are many digital instrument software packages available
via the Internet, either as freeware
or shareware. Our feature article
on page 7 has a rundown on the
some of the more popular packages that you can use.
www.siliconchip.com.au
August 2002 59
Parts List
1 PC board, code 04108021,
125mm x 62mm
1 plastic instrument case, 129 x
67 x 42mm (L x W x H)
(Altronics H-0203)
2 single-pole 12-position PCmount rotary switches (S1, S2)
2 knobs to suit above
1 M205 500mA fast-blow fuse
1 M205 in-line fuseholder (DSE
P-9962)
4 M3 x 10mm pan head screws
(to attach shield)
8 M3 nuts
11 M3 flat washers
1 M3 star washer
1 M3 solder lug
1 2m length medium-duty figure-8 cable
1 80mm length light-duty hook-up
wire
1 75mm length (approx.) tinned
copper wire for links
1 PC board pin (“matrix” pin)
Semiconductors
2 TL071CP JFET-input op amp
ICs (IC1, IC2)
1 TC7660HCPA (Microchip
Technology) or ADM660N
(Analog Devices) 120kHz
voltage inverter IC (IC3)
(Farnell 703-655)
2 1N751A 5.1V 0.5W zener
diodes (ZD1, ZD2)
4 1N4148 small-signal diodes
(D1 - D4)
1 3mm high-efficiency red LED
(LED1)
and the line input on the sound card.
Although we could connect our test
probes directly to the sound card’s
input, we’d be limited to measuring
signals of just 0-2V peak. Not only
that, but the card’s input would “load
down” high impedance circuits such
as op amp inputs and the like.
To overcome these problems, the
adapter provides a fixed high (1MΩ)
input impedance, as well as a 6-stage
attenuator to allow signals of up to
10V peak to be measured. And with
a x10 oscilloscope probe, the range is
extended to 100V peak.
In addition, an op amp stage amplifies the input by a factor of 10,
thereby significantly improving the
60 Silicon Chip
Capacitors
1 220µF 16VW PC electrolytic
2 100µF 16VW PC electrolytic
2 10µF 16VW SMD tantalum
(surface mount)
2 0.1µF 100V MKT polyester
4 0.1µF 50V monolithic
2 56pF 50V ceramic
2 18pF 100V ceramic (Farnell
236-950)
Resistors (0.25W, 1%)
2 1.5MΩ (Farnell 336-701)
2 1MΩ
2 3kΩ
2 200kΩ
2 1kΩ
2 150kΩ
2 470Ω
4 100kΩ
1 330Ω
2 27kΩ
2 100Ω
4 20kΩ
2 10Ω
Connectors
2 horizontal PC-mount BNC
sockets (Altronics P-0529)
1 3.5mm sub-miniature
PC-mount stereo socket
(Altronics P-0096)
1 2.5mm PC-mount DC socket
(Altronics P-0621A)
1 2.5mm cable-mount DC plug
1 15 pin male ‘D’ connector with
backshell
Miscellaneous
Shielded stereo cable for connection to sound card (3.5mm plug to
3.5mm plug); 125 x 62mm sheet of
stiff cardboard/elephantide or lightgauge aluminium for shield (see
text); oscilloscope probes.
signal-to-noise ratio when measuring
low-level signals.
How it works
Fig.2 shows the complete circuit
diagram of the adapter. There are three
main sections, labelled “Channel 1”,
“Channel 2” and “Power Supply”. As
the two channels are identical, we’ll
only describe channel 1.
Signals applied to the BNC connector (CON1) are AC-coupled to the
input circuitry via an 0.1µF capacitor.
A string of resistors to ground along
with an 18pF capacitor provides
the necessary high input impedance
(1MΩ). In conjunction with rotary
switch S1, these resistors also function
as a voltage divider for input signal
attenuation.
In all, six ranges are provided, with
the topmost position passing the signal through to op amp IC1 without
attenuation.
To protect the op amp (and therefore
the sound card) input, signal levels are
clamped by D1 and D2 to within 0.6V
of the positive and negative supply
rails. The 1kΩ resistor shown to the
left of the diodes limits the current
through D1 and D2, while the 470Ω
resistor limits the current into the op
amp’s non-inverting input (pin 3).
Zener diodes ZD1 and ZD2 also form
part of this protection scheme. Because
the impedance of the supply rails is
quite high, they could easily be driven
above their nominal values by a large
input excursion. ZD1 and ZD2 prevent
this from happening by breaking down
above 5.1V. This scheme also protects
the inputs when power is not applied
to the adapter.
Input protection is limited to ±
100V maximum. This allows for times
when you are measuring a level above
10V using the x10 attenuation of your
probe but forget to slide the atten
uation switch from x1 to x10. Don’t
be tempted to poke around in high
voltage equipment (live mains circuits, for example) – you will certainly
“smoke” the adapter and perhaps
your PC and yourself into the bargain!
Op amp IC1 (TL071) is a high
input-impedance, low-distort ion
amplifier designed for audio work. In
this circuit, it is configured for a gain
of 10, with a frequency response of
about 100kHz. The 100Ω resistor in
series with the output provides short
circuit protection and isolates the op
amp from the cable and sound card
input capacitance.
To keep costs to a minimum and
eliminate the need for yet another
plugpack, we decided to power our
project directly from the PC’s +5V
supply rail. As luck would have it, the
+5V rail is accessible via the sound
card’s joystick port connector, usually
situated right beside the audio input/
output sockets.
Power enters the adapter via a
standard 2.5mm DC socket. A little
“brute-force” filtering is then applied
using a 220µF capacitor followed by
a low-pass RC filter formed by the
combination of a 10Ω resistor and a
100µF capacitor.
www.siliconchip.com.au
Fig.2: this is the complete circuit diagram for the adapter. It consists of two switched attenuator channels which drive
op amp output stages IC1 & IC2. Power (+5V) comes from the PC games port, with IC3 (a charge-pump voltage inverter)
generating a -5V rail.
www.siliconchip.com.au
August 2002 61
now slide all the way into the case.
That done, you can complete the
case preparation by drilling and filing
the required holes in the lid and sides.
The easiest way to get everything to
line up properly is to photocopy the
templates in Fig.6, cut them out and
tape each one to the indicated faces of
the case. You can then centre-punch
directly through the templates to get
accurate targets for drilling.
Always start with a small drill size
and work up to the required size in
several stages. The larger holes can
be finished off using a tapered reamer.
Board assembly
Fig.3: follow this diagram when installing the parts on the PC board. Note that
the two 10µF SMD (surface mount) capacitors adjacent to IC3 are installed on
the copper side of the board, as shown in one of the photos.
The TL071 op amps (IC1 & IC2)
require both positive and negative supply rails. The negative rail is obtained
by inverting the +5V rail using a charge
pump voltage inverter (IC3). We chose
a TC7660H device for this job because
its 120kHz switching frequency is well
above the audio spectrum. In addition,
we’ve used surface-mount capacitors
in the pump circuit to reduce radiated noise that could otherwise easily
find its way into the high impedance
attenuation networks.
The -5V (nominal) output on pin 5
of the inverter is cleaned up using a
second low-pass filter, which removes
most of the ripple and noise. Finally,
high frequency decoupling of the 5V
rails is provided using four 0.1µF ceramic capacitors.
Preparing the case
Before mounting any components
on the PC board, you will need to
perform some minor surgery on the
case internals (assuming that you are
using the recommended case).
Initially, the PC board should fit
neatly inside the lip of the case but
will rest on top of the integral guides.
If it’s a little oversized, then trim the
board to fit using a fine file.
Next, cut away all of the guides with
sidecutters or a sharp knife so that
you’re left with reasonably smooth
internal surfaces. The PC board should
Table 1: Typical PC Sound Card Specifications
Frequency response ..................................................................20Hz - 20kHz
Signal to noise ratio ...............................................................................>90dB
Total harmonic distortion .........................................01% <at>1VRMS into 10kΩ
Line-in impedance ...................................................................................47kΩ
Line-in sensitivity .................................................................................. 2V P-P
CD audio-in impedance ...........................................................................50kΩ
CD audio-in sensitivity .......................................................................... 2V P-P
Microphone-in impedance .......................................................................600Ω
Microphone-in sensitivity ..........................................................10-200mV P-P
A-D & D-A resolution .............................................................................16 bits
Sample rate ........................................................................................ 4-48kHz
Output power (speaker-out) ........3W into 32Ω (6W into 4Ω on some models)
62 Silicon Chip
Using the overlay diagram of Fig.3
as a guide, begin by installing the three
wire links and all the resistors. Follow
with the capacitors, noting that the
electrolytic types are polarised and
must be oriented as shown.
The two 10µF tantalum capacitors
are miniature surface-mount devices
that need to be mounted on the solder
(copper) side of the board. The mounting area must be well tinned, clean
and free of excess solder. Position the
banded (positive) end as shown in
Fig.3 and solder the device in place
using a fine-tipped iron.
After soldering, use your meter to
check for solder bridges between pads,
as they can be difficult to spot with
the naked eye.
Install the diodes (D1-D4, ZD1, ZD2)
next, aligning the cathode ends (mark
ed with a band) as shown.
IC1, IC2 & IC3 can go in next and
again, orientation is important.
These are static-sensitive devices, so
it’s a good idea to wear an earthed
antistatic wrist strap and to use a soldering iron with an earthed tip. Once
they’re in, install the four connectors
(CON1-4) and the GND pin. Before
soldering, ensure that they’re seated
squarely against the surface of the PC
board.
The two rotary switches (S1 & S2)
are next on the list. Before installation, they need to be reconfigured to
limit their rotation from the default of
12 positions to just six positions. To
do this, remove the nut, washer and
locking ring. Notice how the tab on the
locking ring can be inserted into one
of 10 holes, numbered 2-11. Re-insert
the tab in the number “6” hole and
check that you have six possible shaft
positions.
Repeat this procedure for the secwww.siliconchip.com.au
This is the completed PC board assembly, ready to be attached to
the lid of the case. Note the metal shield which is mounted on the
copper side of the board using machine screws and nuts. The inset
at top left shows how the two 10µF SMD capacitors are installed.
ond switch and then solder them into
position. Once again, make sure that
they are seated firmly against the PC
board surface.
The last component to be mounted
is LED1 (the power indicator). Slip the
LED into place with the flat (cathode)
side aligned as shown in Fig.3 but
don’t cut the leads short or solder it
just yet.
Next, remove the nuts and washers
from the rotary switches, leaving the
locking rings in place, and fit the case
lid. That done, turn the assembly upside-down and manoeuvre the LED
into its hole in the lid. Ideally, the
shoulder of the LED should be slightly
proud of the inside surface of the lid.
Now solder and trim the leads.
hold on the cable to prevent stress on
the solder joints.
Making the power cable
Testing the power cable
Fig.4 shows the wiring for the power
cable. You can see that we’ve opted to
fuse the +5V rail right at the source,
using an in-line fuse. This provides
an extra measure of safety should the
tip of the DC plug accidentally contact
something that it shouldn’t!
To protect the cable and provide
effective strain relief, use a couple of
layers of heatshrink tubing or insulation tape on the cable at the point
where it passes through the backshell
clamp. The clamp needs to have a firm
Don’t be tempted to skip this step!
Before connecting the cable, use your
multimeter to verify that the positive
and nega
tive wires are not shorted
together. Next, plug the cable into the
joystick port and with your multi
meter set to “DC Volts”, carefully
measure the voltage at the DC plug.
The tip (or “centre”) of the plug should
measure +5V (±0.25V) with respect to
the outer shell.
If you measured +3.3V instead of
+5V, then unfortunately you have one
Table 2: Resistor Colour Codes
No.
2
2
2
4
2
4
2
4
1
2
2
www.siliconchip.com.au
Value
1.5MΩ
1MΩ
200kΩ
100kΩ
27kΩ
20kΩ
3kΩ
470Ω
330Ω
100Ω
10Ω
4-Band Code (1%)
brown green green brown
brown black green brown
red black yellow brown
brown black yellow brown
red violet orange brown
red black orange brown
orange black red brown
yellow violet brown brown
orange orange brown brown
brown black brown brown
brown black black brown
5-Band Code (1%)
brown green black yellow brown
brown black black yellow brown
red black black orange brown
brown black black orange brown
red violet black red brown
red black black red brown
orange black black brown brown
yellow violet black black brown
orange orange black black brown
brown black black black brown
brown black black gold brown
August 2002 63
losses in the voltage inverter circuitry
and the ±5% margin on the +5V rail,
the negative rail should fall within
approximately -5V to -4.55V.
Finally, rotate S1 and S2 to position
“6” (fully clockwise) and measure both
op amp outputs. They should be with
in a few millivolts of the ground rail.
Shield’s up
Fig.4: these diagrams show how to make the power supply cables. Note that the
cable at right is only necessary if your games port supplies +3.3V instead of +5V.
of the few late-model cards that provide this lower, non-standard voltage
on the game port connector (so much
for backward compatibility!). In this
case, you will need to delve into your
PC’s internals to get access to the +5V
rail. A spare disk drive power connector is a convenient connection point.
Fig.4 also shows the wiring details
for this alternate power supply connection scheme.
Basic checks
Before we’re ready to connect the
stereo cable and launch the software,
we need to perform a few quick DC
voltage checks on the completed
board.
The following measurements are
all with respect to ground. Simply
connect the negative lead of your multi-meter to the ground point provided
by the PC board GND pin (between
CON2 & CON4) and use the positive
lead to make each measurement.
Apply power and check that you
have +5V (±0.25V) at pin 8 of IC3, pin
7 of IC1 and pin 7 of IC2. Next, check
for -5V at pin 5 of IC3, pin 4 of IC1
and pin 4 of IC2. Note that with the
The metal shield is
exactly the same shape
and size as the PC
board. It can be made
from a thin sheet of
tinplate or by gluing aluminium foil to a piece
of stiff cardboard or
elephantide insulation
material.
64 Silicon Chip
The adapter’s high input impedance
makes if susceptible to radiated noise
in its immediate environment. Typically, the 240V AC mains and your
PC’s monitor are the worst noise generators. To minimise noise pick-up, the
adapter could be installed in a metal
case but to keep costs to a minimum,
we’ve presented the finished project
in a plastic instrument case instead.
We achieved good results without a
metal enclosure by fitting a shield (or
“ground plane”) to the underside of
the PC board.
The shield is exactly the same
dimensions as the PC board and can
be fashioned from a variety of materials. We glued ordinary heavy-duty
aluminium cooking foil to one side
of a sheet of elephantide material and
then cut out the required shape with
kitchen scissors. Any thin conductive
material should be suitable but ideally,
it should be insulated on one side so
as not to short protruding component
leads to ground.
An old scrap of blank single-sided
PC board material would also be a
good choice.
To fix the shield to the underside of
the board, first insert an M3 x 10mm
screw in the corner hole closest to
IC1. This screw will be used as the
ground connection point, so place
a star washer and solder lug under
the head before winding up a nut
from the copper side of the board.
That done, fit screws and nuts to the
remaining three corners, then invert
the board and place flat washers on all
four screws.
Next, with the conductive side
facing away from the PC board, slide
the shield over the screws (you remembered the holes, right?), install
another four flat washers and wind on
the remaining nuts.
Make sure that all component leads
are well clear of the shield and use
your meter to verify that the shield
makes good electrical contact with
the lug. To finish the job, connect the
solder lug to the ground pin (between
www.siliconchip.com.au
The DC power socket and the output socket (for the sound card) are accessed
through matching holes in the rear panel.
CON2 & CON4) using a short length of
light-duty hook-up wire.
Signal generator cable
Well, that completes the hardware
that you’ll need to use with the oscilloscope and spectrum analyser
software. If you’d also like to use the
sound generator included with many
software packages, then the only additional requirement is a simple cable
– see Fig.5.
All analog signals from your sound
card are AC-coupled to their output
sockets, hence the need for the termination resistors. Be sure to insulate
all connections and use insulated
crocodile clips or probes.
Quantifying measurements
Most digital instruments provide
some degree of input level (gain/attenuation) selection. Add to this the
range switches on the adapter, and it
can all seem a little confusing! Just
how do you determine the magnitude
of your measurements?
The 2V positions on the adapter’s
range switches pass the measured
signal without any change in level.
Ranges below this point provide amplification (gain) of the input signal,
whereas ranges above provide attenuation. The table included on the front
panel (see Fig.6) lists a multiplier, or
scale factor, that can be used to calculate the actual signal level.
For example, with 8.5V input to the
adapter and a switch position of 10V,
the voltage applied to the sound card
input will be 8.5 x 0.2 = 1.7V.
Let’s try that in reverse. If your digital oscilloscope is set to 500mV/div
and the waveform peak measures 1.5
divisions, then the voltage at the sound
card’s input must be 750mV. So, if the
Fig.5: this cable can be used if you’d
also like to use the signal generator
instrument included with many software packages.
MINI SUPER
DRILL KIT IN
HANDY CARRY
CASE. SUPPLIED
WITH DRILLBITS
AND GRINDING
ACCESSORIES
$61.60 GST INC.
www.siliconchip.com.au
August 2002 65
The completed adapter is shown here fitted
with two oscilloscope test probes, plus the
power supply and sound card cables.
adapter range switch is set to 500mV,
then the actual applied voltage is 1/4
x 750mV = 187.5mV (or 132mV RMS).
Note that if you set your oscilloscope to read 2V/div, then the adapter
switch positions now directly reflect
what you see on the screen. With the
adapter switched to 200mV, you’re
reading 200mV/div; and at the 500mV
setting, you’re reading 500mV/div, etc.
Digitally accurate?
It’s important to be aware of the limitations of your new digital instruments
before relying on them for serious
work. In practice, the resolution and
The PC board is installed by first inserting the BNC connectors through their
holes and then flexing back the rear of the case slightly as the back of the board
is lowered into position.
66 Silicon Chip
accuracy of any measurement system
that relies on a sound card depends
on the characteristics of the card itself.
Table 1 lists the specifications of a
typical sound card.
The frequency response of the card
will also be the band
width of the
digital instruments (’scope, multi
meter, spectrum analyser, etc). This
assumes that you’ve set the sampling
rate to maximum (usually either 44kHz
or 48kHz). This also means that it
you measure signals above 22kHz,
the results will be inaccurate. That’s
because the sampling rate must be at
least double the signal frequency.
A sound card’s 16-bit A-D converter
can measure 65,535 discrete voltage
levels, so with a 2V span it has low
µV resolution. However, this doesn’t
mean that your digital instruments
will be able to measure signals in the
µV range! In practice, the PC power
supply, sound card, cable and adapter
all add a certain amount of low-level
noise (called the noise “floor”), so that
the smallest voltage you’ll be able to
measure accurately will be in the mV
range.
Our prototype showed less than
www.siliconchip.com.au
1mV RMS noise but this will almost
certainly be different on your system.
Most software includes at least rudimentary calibration for the line-in
socket. You’ll need a sinewave signal
generator and multimeter for some,
while others utilise their inbuilt digital
signal generators and a line-out to linein loop cable for the task. Be sure to
check the documentation for details,
as methods vary considerably.
If you wish, you can include the
adapter in the signal loop during calibration to improve overall accuracy. Be
sure to set the rotary switches to the
2V positions for 0dB gain.
The maximum voltage that can be
applied to the sound card’s line-in
socket is 2V P-P, or about 1.4V RMS.
In practice, we found that our Sound
Blaster Live card began clipping at
just over 1V RMS. To ensure accurate
measurements, it’s a good idea to use
the ’scope to check for clipping before
switching to other instruments such as
the spectrum analyser.
Staying alive
To wrap up, a word of warning about
measurement techniques is in order.
Be aware that the ground (0V) line
of a PC’s power supply is connected
to mains earth. Because the adapter
is effectively an extension of the PC
circuitry, it’s BNC connectors are also
at mains earth potential. This doesn’t
cause a problem if the circuit you’re
probing is floating (ie, isolated from
earth). If, however, the circuit has a
return path to earth, then be sure to
connect your probe’s ground clip to
a point that’s also at earth potential.
If the chosen point is above earth
potential, then current will flow
around an earth “loop”. If the potential difference is high, the results can
be disastrous! A good example is the
primary side of any off-line switchmode power supply. Connecting a
probe ground clip to most points in
one of these suckers will generate more
fireworks than New Year’s Eve on the
Sydney Harbour Bridge!
Some readers would undoubtedly
point out that this problem could be
overcome by floating either the circuit under test or the test equipment
itself (eg, by lifting the earth or by
using an isolation transformer). Our
advice is simple – don’t do it! Seek
advice from an experienced technician if you’re not sure what you’re
SC
doing!
www.siliconchip.com.au
Fig.6: here are full-size artworks for the front panel (top), the front and rear
panel drilling templates and the PC board pattern.
August 2002 67
|