This is only a preview of the July 1990 issue of Silicon Chip. You can view 49 of the 104 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 Sine/Square Wave Generator; Pt.1":
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
How many times have you opened up that
favourite board game to find that someone
has pinched the dice? In that case, why not
build this electronic die which uses just
two CMOS ICs? It simulates the roll of a
real die and even turns itself off.
Build this elegant
electronic die
By DARREN YATES
Die or dice - which is correct'?
Let's straighten that question out
right at the start. "Die" is the
singular form of 'dice" so it is correct to term a unit which will randomly indicate 1 to 6 as a die.
There have been a number of
designs over the years for
simulating a 6-sided die but most
either use a 7-segment display to
show up the numbers 1 to 6, or a
row of 6 LEDs to indicate the die
number rolled. But although these
circuits are simple, they don't give
a realistic display.
When you roll a 6-sided die, it
rolls along with the initial momentum of the throw, and then slows
down until it stops. How many times
have you almost seen a "6" turn up
on the die, only to see it turn over
into a lousy "1 " '?.
This circuit cycles through the
numbers 1 to 6, and slows down until it stops on its final number. This
is far more realistic than pressing a
34
SILICON CHIP
button and having the final number
instantly staring you in the face.
Another feature of a real die is
the dots on the faces. This has often
been a tricky task to achieve electronically, and most circuits don't
bother about it. Our circuit has this
built in, with all the displays matching the faces of a real die, including the diagonal "2" and "3".
Fig.1 shows how all numbers are
displayed.
Another problem with electronic
die circuits we have seen in the
past is that it is all too easy to leave
them switched on so that they flatten the battery. This design has no
on/off switch - it turns itself off
automatically, after 50 seconds.
The circuit
Now let's have a look at the circuit diagram - see Fig.2. It uses
only two low-cost CMOS ICs, seven
light emitting diodes (LEDs) and not
much else. ICl is a 4015 dual 4-bit
.. ,..
Fig.1: here's how all the numbers
are displayed by the LEDs. Note
that the displays match the faces
of a real die, including the
diagonal "2" and "3".
+6V
100
+
16VWJ
ROLL
S1
I
C2
33
10VW
+
70
~
1 C
,o.::.-4,___ _;:1---."fg C
4~c,1s"e
R~6_
_
15
D
16
R3
f-...,1Y,Ok~+----'14 R
IC1 !
02
11
00
.,.
00
LED1
LE07
R2
LE03
180k
LE01Q
LE02Q
LED3Q
QLED5
LED4
Q
QLE06
QLED7
CMOS LED DIE
Fig.2: when the ROLL button is pressed, Cl & C2 discharge and oscillator IC2a
clocks 4-bit shift register ICla. ICla in turn clocks IClb and their outputs
drive the display LEDs. As C2 charges, IC2a slows and eventually stops to give
a static display. The LEDs then turn off after 50s.
register while IC2 is quad NAND
Schmitt trigger.
The circuit works as follows . If
you press the ROLL button Sl,
capacitor C2 is shorted out while
Cl is shorted via diode D2. Once the
ROLL button is released, capacitors
Cl and C2 begin to charge again
and while they are doing so, the
rest of the circuit can function.
Also, when the ROLL button is
pressed, capacitor C4 quickly
charges via the 560kn resistor R4.
These two components are part of
an oscillator associated with
Schmitt trigger NAND gate IC2a.
C4 is charged via R4 as just noted
but once the capacitor voltage
reaches the positive threshold of
IC2a, its output flicks negative and
then C4 is discharged via diode Dl
and the series lOkQ resistor. This
happens repeatedly and results in a
series of short negative going
pulses (at pin 3 of IC2) which
decrease in frequency until they
stop altogether after about 5
seconds. This 5-second time period
is set by the charging of capacitor
C2 and the negative threshold of
IC2a.
The pulses from IC2a clock the
circuit and simulate the roll of a
real die, whereby the LEDs cycle
very rapidly at first and then slow
to a complete stop to give one of the
static displays shown in Fig.1.
The clock pulses are fed to pin 9
of ICla, a 4-bit shift register which
is connected as a D-type flipflop.
ICla is made to function as a
flipflop by connecting its Q0 output
at pin 5 to the D input at pin 7 via inverter IC2b. The Q0 output of ICla
is also used to drive LED 4 which
is on for all the odd-numbered
displays; ie, 1, 3, and 5.
The output of IC2b is also used to
clock the second 4-bit shift register,
ICl b. The D input of IC1 b is tied to
the positive rail so that on each
clock pulse, a "high" is shifted to
each output from Qo to Ql to Q2
(pins 13, 12 & 11, respectively).
Pin 11 drives LEDs 6 & 2, pin 12
drives LEDs 1 & 7 and pin 13 drives
LEDs 5 & 3. These LEDs produce the
even-numbered displays 2, 4 & 6.
When Q0 of ICl b goes high, LEDs
5 & 3 come on to produce the
displays 2 & 3. On the next clock
pulse, Ql now also becomes high so
that the displays 4 & 5 are produced as LEDs 1 & 7 are now also lit.
On the third clock pulse, Q2 goes
high as well, lighting LEDs 6 & 2
to produce the displays 5 & 6.
Die sequence
Let's just go through the sequence whereby the circuit produces the die displays.
SC08107901
Fig.3: here is a full-size reproduction of the PC artwork.
JULY 1990
35
PARTS LIST
1 PC board, 105 x 57mm,
code SC08107901
1 momentary contact
pushbutton switch, DSE Cat.
S-1201
4 1 .5V alkaline AA cells
1 4 AA-cell holder
1 9V battery snap
4 PC standoffs (plus screws
and split washers)
Semiconductors
1 4015 dual 4-bit shift register
(IC1)
1 4093 quad NANO Schmitt
trigger (IC2)
2 1 N914 silicon diodes
(01 ,02)
7 red LEDs
Capacitors
1 1OOµF 16VW PC electrolytic
1 47µF 25VW LL (low leakage)
electrolytic (C1)
1 33µF 25VW LL electrolytic
(C2)
2 .O1µF metallised polyester
(C3 ,C4)
Resistors (0.25W, 5%)
1 1 MO
2 10kQ
1 560k0
1 3 .3k0
1 180k0
1 1.8k0
The first clock pulse to ICla
causes its pin 5 to go high and light
LED 4 - the display for "1 ". The
next clock pulse causes LED 4 to go
out and pin 13 of IClb to go high, to
light LED 5 & LED 3 - the display
for "2" . The next clock pulse
causes LED 4 to come on again
while LEDs 5 & 3 remain alight, giving the display for "3 " .
The next clock pulse causes LED
4 to go out while LEDs 5 & 3 remain
on and pin 12 of ICl b goes high to
light LEDs 1 & 7, giving the display
for "4". With the next clock pulse,
LED 4 comes on again while LEDs 5,
3, 1 & 7 remain alight to give the
display for "5". Next, LED 4 goes
out again and pins 11, 12 & 13 of
ICl b are all high to light LEDs 5, 3,
1, 7, 6 and 2 to give the display for
''6''.
The next bit is devious. In order
for the die to cycle from a "6" back
to a "1 ", IC2c and IC2d form an
AND gate to check when Q2 of ICl b
is high, indicating a 6 on the
display, and when Q0 of ICla goes
high again.
When this occurs, the output of
IC2c goes high, resetting ICl b and
forcing all its outputs to go low.
This now makes the output of IC2c
go low again since the Q2 output of
ICl b is no longer high.
The resulting output of the AND
gate IC2c/d is a brief positive pulse.
The output of IC2c also drives the
reset pin of ICla via a time constant
consisting of R3 & C3. The pulse is
not there long enough to cause ICla
to reset while the display is cycling,
allowing the display to go from a
"6" back to a "1" again. If we
removed R3 & C3 and then replaced
R3 with a wire link, the display
would cycle through 1, 2, 3, 4, 5, 6,
0, 1, 2, etc.
Of course, you would have to
slow down the clock pulses considerably to be able to see this sequence of events as we have
described it.
Auto turn off
As noted previously, the circuit
turns itself off automatically, to
save the battery and to avoid the
need for a separate on/off switch.
The 47µF capacitor Cl and the lMO
resistor Rl are used to provide this
auto turn-off feature.
As Cl charges slowly through
resistor Rl, the voltage at their
junction, pin 8 of gate IC2c, slowly
.
F
~
.01;
I
.
e-{J]I}-e
~
rf°_rqb~'::,j__
+ -
6V BATTERY
Fig.4: install the parts on the PCB as
shown here. Make sure that all the
parts are correctly oriented and note
that LED 1 faces in the opposite
direction to the other LEDs.
decreases. About 50 seconds after
the ROLL button is released, the
voltage at pin 8 reaches the lower
threshold level of the gate, forcing
its output at pin 10 high.
Register ICl b is reset instantly
and when capacitor C3 is sufficiently charged via 10k0 resistor
R3, ICla is also reset, forcing all
outputs low and turning off the
display. The current consumption
of the circuit then drops from about
3mA to approximately lµA.
Construction
The board is designed to sit as
either a unit on its own or to fit into
a small zippy box, such as DSE Cat.
H-2851.
All the components, including the
pushbutton switch, fit onto a PC
RESISTORS
No
□
□
□
□
□
□
36
1
1
1
2
1
3
SILICON CHIP
Value
1MO
560k0
180k0
10k0
3 .3k0
1.8k0
4-Band Code (5%)
5-111~ Coda (1'1,)
brown black green gold
green blue yellow gold
brown grey yellow gold
brown black orange gold
orange orange red gold
brown grey red gold
brown black black yellow brown
green blue black orange brown
brown grey black orange brown
brown black black red brown
orange orange black brown brown
brown grey black brown brown
board which measures 105 x 5 7mm
(code SC 08106901).
Before you begin assembly, check
that there are no shorts or breaks
in any of the tracks.
Fig.4 shows the wiring details of
the circuit board. Start by installing
the wire links and then follow with
the lower profile components such
as the resistors and diodes. Make
sure you check the resistor values
with your multimeter as you install
each one. This done, the capacitors
can all be installed (watch the
polarity of the electrolytics ).
Next, install the seven LEDs and
the two CMOS ICs. Make sure they
are inserted the right way around
before you power up, otherwise
they may be damaged.
Finally, solder in the pushbutton
switch (note the flat on the switch
body) and the battery snap connector. If you intend to mount the die in
a zippy box, we suggest that you
solder in four PC stakes in the position of the switch and then solder
the switch to the PC stakes to raise
it off the board.
This way, the board can then be
screwed to the lid of the box with
the switch protruding through it.
Once the board has been completed, connect up the battery pack
and press the button. You should
see a flash of LEDs as the circuit
fires into action.
When you release the button, you
should see the cycling rate begin to
decrease until it stops on the final
number. After about 50 seconds,
the LEDs should go out.
All that remains to be done is to
pull out that favourite board game
and enjoy the fruits of your labour.
Troubleshooting
If it doesn't work, check carefully
for wiring errors. Are all the parts
in the right way around? Have all
the wire links been installed? Are
there shorts between adjacent IC
pins or PC tracks?
If any of the LEDs fails to light,
check that it has been correctly installed. Note that if you do install a
LED the wrong way around, its
series partner also won't light (eg,
if LED 1 is the wrong way around,
LED 7 will also remain off).
Finally, don't just rush out and
replace the !Cs. That seldom solves
anything.
~
BOOKSHELF
Music Applications
of Microprocessors
Musical Applications of Microprocessors, by Hal Chamberlin. 2nd
edition published 1985 by Hayden
Books, Indianapolis, Indiana, USA.
Hard covers, 162 x 238mm, 802
pages. ISBN O 672 45768 7. Price:
$59.95.
While there are any number of
books available on computers and
microprocessors, there are precious few books on electronics in
music and of those that are
available, very few are of any real
use. This book, by contrast, is excellent, and worth every cent of its
price. Having said that , I must point
out that this second edition was
written in 1984 and there have
been a few developments in electronic music since then.
Where to start? There is so much
in its 802 pages that it is difficult to
know which sections to highlight in
this necessarily short review.
Therefore I'll start with chapter 5
which is the last of the introductory
background section of this text and
it is the first devoted to microprocessors. It covers microprocessor terminology and gives the
early history, particularly with
respect to the first personal computers such as the Commodore PET,
TRS-80 and the Apple.
Also covered in this chapter are
peripheral devices such as printers, plotters and modems. This is
very good background and worthwhile reading for anyone who
was not into electronics or computing before the 80s.
All told, there are 21 chapters,
divided into four sections, the first
of which I have already mentioned.
The second of these sections, which
has 6 chapters, is devoted to " Computer Controlled Analog Synthesis". Chapter 6 starts with
basics such as voltage controlled
oscilla tars, amplifiers and filt ers
and chapter 7 goes on to treat
digital-to-analog (DI A) converters.
Chapter 8 is on computer control
and chapter 9 on keyboard interfaces, while chapters 10 and 11
round out the section with coverage
of other input devices and displays.
This is very well written.
The third section is entitled
"Digital Synthesis and Sound
Modification" and a large part is
devoted to digital tone generation
techniques. Fourier transforms are
covered in detail, as are Fast
Fourier Transforms (FFTs) and FFT
Algorithms. Chapter 14, the third in
this section, is devoted to digital
filtering, which will be of great interest to anyone involved in digital
technology, particularly as it covers
reverberation simulation (as used
in the Yamaha DSP-1 and similar
products).
Chapter 15 covers percussive
sound generation, again using
digital techniques, while chapter 16
is on source signal analysis, mainly
spectral analysis, in 2 and 3dimensional form.
Chapter 17 is on digital hardware while chapter 18 complements this with coverage of
digital software.
The last section of the book, with
three chapters, is entitled " Product
Applications and the Future " .
Chapters 19 & 20 mainly cover
music synthesisers while chapter
21 looks to the future .
Quite frankly , as I write this
continued on page 95
JULY 1990
37
|