This is only a preview of the April 1998 issue of Silicon Chip. You can view 32 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. Articles in this series:
Articles in this series:
Items relevant to "An Automatic Garage Door Opener; Pt.1":
Articles in this series:
Articles in this series:
Items relevant to "40V 8A Adjustable Power Supply; Pt.1":
Articles in this series:
Items relevant to "A Chook Raffle Program For Your PC":
Purchase a printed copy of this issue for $10.00. |
PC-controlled 0-30kHz
sinewave generator
Based on the ML2036 audio generator IC, this
simple project hooks up to your PC’s parallel
port and generates a sinewave output from
0-30kHz. The output frequency and level are
controlled via the on-screen display.
By MARK ROBERTS
This simple audio oscillator uses
just a handful of parts and will only
take about 10 minutes to assemble. It’s
low in cost too (just $30), since you
don’t need to buy fancy digital dis
plays, or frequency and level controls,
or an output level meter – at least not
in hardware form. Instead, that’s all
taken care of by the software which
generates a “virtual” instrument panel
on your PC’s monitor.
66 Silicon Chip
Fig.1 shows what the on-screen
display looks like. As can be seen, it
has a digital frequency display (with
up to five digits), digital and analog
output level meters, and controls to
set the output frequency and level.
The output frequency is set by either
rotating the Tuning knob (by dragging
it with the mouse) or by clicking the
up and down buttons to change the
reading in 1Hz, 10Hz or 100Hz steps.
You can also change the output
frequency by clicking at any point on
the circumference of the Tuning knob.
When you do this, the red dot on the
tuning knob jumps to the new setting
and the display changes accordingly.
The signal level can be varied
from 0-4V in 10mV steps by clicking
another pair of up/down buttons. Alternatively, for more rapid changes in
output level, you can drag the slider
bar between these two buttons. The
accompanying 3-digit display shows
the output level (in Vp-p), or you can
read the level off the analog meter.
Immediately to the right of the output level control are three other buttons. The top button (shown as 100Hz
in Fig.1) lets you toggle between 1Hz,
10Hz and 100Hz frequency steps. The
middle button is labelled “Help” but
no help functions were available at
Fig.1: the sinewave generator is controlled via this virtual instrument panel which is generated by the software.
Specifications
Frequency Range: 0-30kHz
sinewave
Frequency Steps: 1Hz, 10Hz &
100Hz
Output Level: 0-4Vp-p (.01V
steps)
Frequency Response: flat from
0-30kHz
Total Harmonic Distortion: less
than 0.5% from 2Hz to 30kHz <at>
1.066V RMS
the time of writing. The third button,
labelled Exit, shuts down the program.
There are also three memory channels, situated immediately to the right
of the analog level meter. You can
program three spot frequencies (eg,
1kHz, 10kHz and 20kHz) into these
channels, each with a different output level if so desired. Programming
is easy – you simply click a memory
button, set the frequency and output
level, and then click the R/W button
(below the memory buttons).
Performance
Figs.4 & 5 show the performance
details. As shown in Fig.5, the total
harmonic distortion at 1V RMS is less
than 0.5% over the frequency range
Fig.2: the circuit is based on IC2 which is an ML2036 sinewave generator.
It’s output frequency is set by the voltage applied to its VREF input from
IC1, a 10-bit digital-to-analog converter. The output from IC1, in turn,
depends on the data applied to it via the parallel port of the computer.
April 1998 67
from 20Hz to 30kHz and is generally
less than 0.2% above 1kHz.
We also checked the output level
as a function of output frequency. It’s
dead flat, with 0dB variation over the
full frequency range.
Power for the circuit is derived
directly from the parallel port, so no
external power supply is required. A
+5V rail is derived from pin 9 of the
parallel port and this is fed to pins
13 and 8 of IC1 and IC2, respectively.
In addition, the +5V rail is fed to pin
8 of IC4, a 7660 switched-capacitor
inverter. This device produces a -5V
rail at its pin 5 output and this is fed
to pins 1 & 2 of IC2.
Circuit details
Fig.2 shows the circuit details. It’s
based mainly on IC2 which is a Micro
Linear ML2036 programmable sine
wave generator capable of producing
frequencies from 0-50kHz (only
0-30kHz used here). In this circuit, IC2
is controlled by a 3-wire input from
the parallel port, the signals being
applied to pin 5 (SCK – serial clock),
pin 6 (SID – serial data input) and pin
7 (LATI – latch input).
IC2’s output frequency is programmed by a 16-bit serial data word
which is applied, via the parallel port,
to pin 6 (SID). An 8.388MHz crystal
between pin 14 and ground provides
the internal clock signal and sets the
upper frequency output to 30kHz.
The output level is set by the voltage
applied to pin 9 (VREF) of IC2 and this
in turn is set by IC1, a MAX504 10-bit
digital-to-analog converter (DAC). The
serial data generated by the software is
fed into pin 2 (DIN), while SCLK and
CS-bar are the clock and chip select
inputs, respectively. The converted
analog output voltage appears at pin
12 (VOUT).
IC3 is a Dallas Semiconductor
DS2401 “Silicon Serial Number”. This
3-pin device comes in a standard TO92 package but only two of its pins
(ie, Data and GND) are used. Each one
of these devices comes with a unique
64-bit regis
tration number and this
Construction
Fig.3: install the parts on the PC board
as shown on this wiring diagram.
number is read by the software (via pin
15 of the parallel port). If the number
matches the number programmed into
the software, the software functions
normally. Conversely, if the numbers
don’t match, the software still boots
but goes into a demonstration mode
only.
This means that the software supplied with each individual DS2401
is tailored to match that device. The
same software will not work with other
devices because the code number will
be different.
All the parts, including the BNC
output socket and the DB25 connector,
are installed on a PC board measuring
77 x 55mm. Fig.3 shows the assembly
details.
Begin the assembly by installing the
three wire links, then install the resistors and capacitors. This done, install
the three ICs and the 8MHz crystal.
Take care to ensure that the three ICs
are correctly oriented (they all face in
the same direction) and don’t get the
MAX504 mixed up with the ML2036.
Finally, complete the assembly by
fitting the BNC socket and the DB25M
connector. Check that both these
devices lie flat against the PC board
before soldering any of their pins. Go
over your work and check carefully for
mistakes before connecting the unit to
a computer, ready for testing. You can
either plug the unit directly into the
parallel port or connect it via a DB25
male-to-female cable.
Installing the software
The software comes on three floppy
discs and runs under Windows 3.1x,
Windows 95 and Windows NT. You
install it by running setup.exe on the
Where To Buy Parts
Parts for this design are available from Softmark, PO Box
1609, Hornsby, NSW 2077 (phone/fax 02 9482 1565).
ML2036 programmable sinewave generator ...............$18
MAX504 10-bit digital-to-analog converter ....................$9
ICL7660 voltage converter ............................................$4
8.388608MHz crystal ....................................................$3
PC board .....................................................................$10
BNC and DB25M connectors ........................................$7
Software (three discs) with DS-2401 ..........................$32
Optional LPT2 card .....................................................$15
Fig.4: this scope shot shows the residual hash at the output
of the generator, as well as the distortion. The upper
wave-form shows the output signal at 1kHz.
68 Silicon Chip
Payment by cheque or money order only. Please add $5
for postage. Note: the software associated with this design
is copyright to Softmark.
AUDIO PRECISION ext
5
THD+N(%) vs FREQ(Hz)
P.C.B. Makers !
18 FEB 98 16:07:21
If you need:
• P.C.B. High Speed Drill
• P.C.B. Guillotine
• P.C.B. Material – Negative or
1
Positive acting
• Light Box – Single or Double
Sided – Large or Small
• Etch Tank – Bubble or Circulating
0.1
– Large or Small
• U.V. Sensitive film for Negatives
• Electronic Components and
0.010
•
•
0.001
20
100
1k
10k
30k
Fig.5: this graph shows the total harmonic distortion of the generator over the
range from 20Hz to 30kHz.
first disc and following the on-screen
instructions. In Windows 95, you click
Start, Run and then type A:\setup.
exe in the space provided (assuming
that the floppy disc is in the A: drive).
The installer program creates the appropriate program group and installs
a shortcut in the Start menu.
In Windows 3.1x, you click File,
Run and type A:\setup.exe. Alternatively, you can double-click
the setup.exe file from within File
Manager or, in Windows 95, from
the Explorer.
When you boot the software, it
opens a dialog box that lets you select
between two printer ports (LPT1 and
LPT2). LPT2 is the initial default but
most users will need to select LPT1.
You then click OK to bring up the
instrument panel shown in Fig.1. Ini
tially, all the displays will be off, since
the Power is off. You turn the display
on by clicking the Power button.
By the way, once you’ve selected a
port, the software always boots up with
the new port as the default, unless you
change it again.
It’s now just a matter of checking
that everything works. Check that you
can vary the output frequency and
level and that all the other “controls”
work correctly. The default frequencies programmed into the memory
buttons are 1kHz, 2kHz & 3kHz.
The output of the oscillator is best
Parts List
1 PC board, 77 x 55mm
1 PC-mount DB25M connector
1 PC-mount BNC connector
1 3-disc software package
Semiconductors
1 MAX504 10-bit DAC (IC1)
1 ML2036 programmable
sinewave generator (IC2)
1 DS2401 silicon serial number
(IC3)
1 ICL7660 switched capacitor
inverter (IC4)
1 8.388608MHz crystal (X1)
Equipment for
TAFEs, Colleges and Schools
FREE ADVICE ON ANY OF
OUR PRODUCTS FROM
DEDICATED PEOPLE WITH
HANDS-ON EXPERIENCE
Prompt and Economical Delivery
KALEX
40 Wallis Ave E. Ivanhoe 3079
Ph (03) 9497 3422
FAX (03) 9499 2381
• ALL MAJOR CREDIT
CARDS ACCEPTED
Silicon Chip
Binders
REAL
VALUE
AT
$12.95
PLUS P
&P
Capacitors
1 100µF 16VW PC electrolytic
5 10µF 16VW PC electrolytic
1 0.1µF monolithic
Resistors (0.25W, 5%)
1 1kΩ
1 200Ω
checked on a scope. If you don’t have a
scope, feed the signal into an audio amplifier and listen while the unit is swept
over the frequency range. Of course,
you won’t be able to hear anything
much above about 15kHz, depending
on your hearing and the loudspeaker
used, but this is still a good check that
the unit is working.
SC
★ Heavy board covers with 2-tone
green vinyl covering
★ Each binder holds up to 14 issues
★ SILICON CHIP logo printed in
gold-coloured lettering on spine
& cover
Price: $A12.95 plus $A5 p&p each
(Australia only)
Just fill in & mail the handy order form
in this issue; or fax (02) 9979 6503;
or ring (02) 9979 5644 & quote your
credit card number.
April 1998 69
|