This is only a preview of the December 2002 issue of Silicon Chip. You can view 25 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:
Items relevant to "The Micromitter Stereo FM Transmitter":
Items relevant to "A Windows-Based EPROM Programmer; Pt.2":
Items relevant to "Build The Decision Maker":
Articles in this series:
Items relevant to "SuperCharger For NiCd & NiMH Batteries; Pt.2":
Articles in this series:
Items relevant to "Simple VHF FM/AM Radio":
Purchase a printed copy of this issue for $10.00. |
Decision
Many years ago, you could buy gimmicky little devices which helped
make decisions: just press the button and you got a “yes” or a “no”
immediately. Here’s the modern day version: you don’t just get a yes
or a no – you get one of four different decisions: an emphatic “definitely”, a “maybe”, a “no way” and even a “try again”! With just a
handful of components, it’s a great first electronics project to build.
C
an’t make a decision? Worried
that if you make the wrong
choice you’ll get the blame?
Well, here’s your saviour: press the
button and the decision is made for
you. Instantly.
And if that decision turns out to be
the wrong one, you can always say to
your mum/dad/teacher/partner/boss/
etc, “Look, it’s not my fault. That was
the decision the box made . . .”
How it works
There are two main parts to this
project – an oscillator (based on IC1)
and a LED driver (based on IC2).
In a nutshell, when you press the
pushbutton, power is supplied to the
circuit and the “reservoir” capacitor
on the main supply rail charges to
the battery voltage (3V). At the same
time, the resistor and capacitor around
one of the Schmitt NAND gates (IC1c)
cause it to oscillate.
The word NAND is a contraction of
NOT & AND. The “AND” part means
that both inputs to the gate need to be
a logic “high” for the gate to operate
and the “NOT” means the output is
opposite, or inverted, to the input.
There is a “truth table” shown in
Table 1 which shows what happens
to the output, depending on what is
occurring at the input.
The “Schmitt” part of the name refers to a feature of the threshold points,
or triggering, of the gate. The voltage
levels at which it triggers, either low
or high, are quite precise but more importantly, are widely separated. This
makes a Schmitt trigger more immune
to noisy triggering waveforms.
As you can see, the two inputs to the
gate are connected together, effectively
turning it into an inverter. As such,
the input and output can never be the
same state – when the input is high,
the output must be low and vice versa.
When you press and hold the button, the IC is powered up but at that
instant the inputs are in a low state
Project by:
Trent Jackson
Words by:
Ross Tester
Should you build this project?
Hey, the answer is already
given for you!
40 Silicon Chip
www.siliconchip.com.au
ID
Maker
(because the 1µF capacitor is not
charged). Therefore the output is high.
The capacitor then starts to charge
via the 68kΩ resistor from output to
input.
When the capacitor voltage passes
the gate’s upper threshold voltage
(ie, the input goes high), the output
goes low. The capacitor then starts
to discharge, the voltage eventually
dropping below the gate’s lower
threshold voltage. The output then
goes high again.
This keeps happening as long as
power is applied to the circuit. It’s
called a “relaxation oscillator” and is
a very easy way to make any form of
pulse generator.
How fast?
The frequency at which it operates
is determined by the values of the
resistor and capacitor. The formula is
1/0.55 x RC, where R is in ohms and
C is in Farads (note that – Farads, not
microfarads).
Therefore if the resistor is exactly 68,000 ohms (unlikely!) and the
www.siliconchip.com.au
capacitor is exactly 1µF (even more
unlikely!), the frequency of this oscillator circuit will be 1/ 0.55 x 68,000 x
0.000001, or 1/0.0374, or approximately 26Hz (actually 26.7Hz).
Why did we say it was unlikely that
the resistor and capacitor wouldn’t be
exactly what their marked value said?
If the resistor has a 1% tolerance,
its actual value could be anywhere
from 99% of 68,000 ohms (67,320Ω)
to 101% (68,680Ω). And capacitors
normally have a much wider tolerance
– as much as 20% or more. So you can
see we are not talking exact values in
a simple circuit such as this.
Kept up so far?
OK, here’s a quick quiz to see if
you’ve kept up with us so far. If we
increased the resistor to 100kΩ and
decreased the capacitor to 470nF,
what would the oscillator frequency
be?
If you answered about 36Hz, well
done. If you had the right digits but
were out by several factors of 10,
it’s time to brush up on your na-
P
R
EA
1 ST
O
JE
CT
nofarads, microfarads and Farads!
(1nF= 0.000000001F; 1µF = 0.000001F).
So we have an oscillator running
at 26Hz or thereabouts. Its output is
a square wave with a “duty cycle” of
50% – that means its “high” state is
the same length of time as its “low”
state.
NAND gates
The square wave is fed into a second
NAND gate, IC1d (also connected as an
inverter) which ensures it is nice and
clean. This acts as a “buffer”, making
sure that any load connected to the
gate won’t interfere with the charging/
discharging cycle of the capacitor in
the oscillator.
It is then fed into yet another NAND
gate, IC1b, this time wired as a true
NAND. In a NAND gate, the output
will be low only if both inputs are
high. If either or both inputs are low,
the output will be high.
Here, one of the inputs (pin 6) is
connected to the pushbutton switch
via a 4.7kΩ resistor. Normally this input is at a logic “low”, courtesy of the
December 2002 41
L
Everything except the battery is mounted on the PC board.
Provision is made for either a supercap or a smaller electro.
100kΩ resistor to earth. But when the
pushbutton is pressed, it is taken to a
logic “high”. When a logic “high” is
also present at pin 5 (when the output
of IC1d goes high), IC1b’s output will
go low.
Conversely, when either input
goes low (because the pushbutton is
released or when IC1d’s output goes
low) the output goes high.
But IC1d’s output (and IC1b’s pin 5
input) continues to go high and low,
courtesy of the oscillator. While that
pushbutton remains pressed, IC1b
allows the pulse train through.
Finally, the pulse train is put
through yet another NAND gate (IC1a),
again wired as an inverter.
To be truthful, this final pulse inversion is not necessary but we had
a spare gate in the IC anyway (it’s a
“quad” NAND gate).
Into the counter
The square wave output from this
series of gates is fed to a 4017 decade
counter. Now you might be thinking,
“how come a decade counter – doesn’t
that mean ten?” And you’d be right.
But the 4017 is a clever device – it
can count to one, to two, to three .
. . and so on, all the way up to ten.
All you have to do is “reset” it when
it gets to the number you want it to
count to.
On the circuit diagram, you will
note that Q4 (pin 10) and MR (pin 15)
are connected. Q4 goes high on the
fifth count (after Q0, then Q1, then Q2,
then Q3). When Q4 goes high, it tells
the reset pin (15) to reset the counter
to zero and start all over again.
Those other outputs we mentioned
(Q0-Q3) are each connected, via a transistor, to a LED. As each goes high in
turn, it turns the associated transistor
42 Silicon Chip
And here’s what it looks like assembled. This is an early
prototype – some components have been moved slightly.
on, which causes its LED, between
emitter and earth, to light.
Because of the speed of the oscillator (26Hz, remember), the four
LEDs flash much faster than the eye
can follow, so all look like they are
permanently on.
How fast do they flash? That’s easy:
26/4 or about 6.5Hz. That means that
there are six-and-a-half cycles of the
lamps each second, faster than the eye
can follow.
Incidentally, IC2 has its pin 13 input
tied low and its pin 14 input used as
the clock input. What this does is make
the IC respond to low-to-high logic
transistions.
Now, what happens when you let
go of the pushbutton?
The battery is no longer connected
to the circuit. While there is still a supply line to the counter circuit (courtesy
of the charged “reservoir” capacitor),
one of IC1b’s inputs is isolated from
the supply by the series diode. So the
pulses stop.
But as we said, the counter section
still has a supply, as do the collectors
of the four transistors. So that section
of the circuit continues working.
Whatever output of IC2 that was high
at the instant that the pulses stopped
remains high, holding on its particular
transistor and of course LED, at least
for a short time while the capacitor
discharges.
So one LED – and only one LED –
remains lit. And which particular LED
is lit is completely random, depending
Table 1: the INPUT
“truth table” for A
B
a NAND gate.
0
0
Only when both 1
0
inputs are high
0
1
is the output
1
1
low.
OUTPUT
1
1
1
0
entirely on when you released the
pushbutton.
Due to the fact that the oscillator is
running at 26Hz, it is impossible for
you to let go the button to achieve a
particular result. You would have to
be able to not only accurately judge
periods of 40 thousandths of a second but also release the button at
the exact point in time required. The
person who can do that hasn’t yet been
born!
About that capacitor
We mentioned before that a “reservoir” capacitor connected to the supply line charges when the pushbutton
is pressed and discharges through the
circuit when it is released.
Eventually, the point is reached
where the charge is too low to push
enough current through the LED, so it
dies. You can see this happen: the LED
doesn’t suddenly go out but gradually
gets dimmer.
The time it takes to go completely
out depends entirely on the size of the
capacitor used to hold the charge. With
a 3300µF capacitor, it lasts for a little
over a second – just long enough for
you to get an answer – but it could be
longer! How?
You’re probably one step ahead of
us by now – with a larger capacitor,
of course.
How long? How does 30 seconds
sound? We replaced the 3300µF capacitor with a so-called supercap-acitor,
rated at 0.5F. Yes, that’s right – half a
Farad, or 500,000µF.
These capacitors are usually used
for much the same reason as we use
it here – to hold a charge for a short
time in the absence of power (eg, when
there is a power supply dropout or
glitch).
www.siliconchip.com.au
They’re not as cheap as “ordinary” electros – probably
about $4 each or so – but they really do hold a charge.
Whether you want to use one of these or go for the much
cheaper 3300µF is entirely up to you – and your pocket.
There is one other “little” problem with using a supercap
– it’s not so little. You may need to use a slightly larger case
to fit it in. But we’ll look at this further on.
The 3300µF will normally be rated at 16V while the
supercap is much lower – 5.5V is common. But with a 3V
supply rail, 5.5V is plenty.
Another thing you could do is use some superbright LEDs
in place of the standard LEDs. These are more expensive
– perhaps three or four times the price as standard LEDs
– but are much more efficient at converting current into
light so they are brighter.
Building it
All components are mounted on a single PC board measuring 46 x 63mm and coded 08112021. With the 3300µF
electro, it just fits into a small (83 x 55 x 28mm) zippy box,
sitting on top of the 2 x AA battery holder, with the pushbutton switch and four LEDs just poking through the top.
With the supercap, you’ll need a larger case.
Begin construction by comparing your PC board with
the published pattern. These days, problems with commercially-made boards are very rare but it is good practice to check every board before attacking it with your
soldering iron.
Solder in the resistors first and use two of the resistor
lead off-cuts for the two links on the board. Then put the
diode in (the right way around!). Next are the four transistors. The transistors mount down on the board as far
as they will go.
The two power supply PC stakes, or pins, can go in
now. These actually mount upside-down to the way
we normally use them – their longer length goes on the
copper side of the PC board. Don’t solder the battery
connections yet!
Next, solder in the capacitors. First to go in is the 100nF
polyester, followed by the 1µF timing capacitor.
Two points to note here: first, make sure you get the
The assembled
project, using
the 3300µF
electrolytic
and the Jaycar
box. With a
supercap
the larger
DSE box is
required.
www.siliconchip.com.au
December 2002 43
Parts List – Decision Maker
1 PC board, 46 x 63mm, coded 08112021
1 plastic utility case, either 83 x 54 x 31mm (eg, Jaycar HB6015) or 85 x 56
x 40mm (eg DSE H2874) – see text
1 SPST momentary action pushbutton switch, PC mounting (Jaycar
SP-0720, Altronics S1094 or similar)
1 2 x AA battery holder (with battery snap if required)
2 PC stakes
Semiconductors
1 4093 quad NAND gate (IC1)
1 4017 decade counter (IC2)
4 BC548 transistors (or similar general purpose NPN) (Q1-Q4)
1 1N4001 power diode (or similar general purpose power diode) (D1)
4 red LEDs, 5mm (normal or ultrabrite – see text) (LED1-LED4)
Capacitors
1 3300µF 16VW electrolytic or 1 0.5F 5.5VW supercap
1 1µF 16VW electrolytic
1 100nF MKT polyester
Resistors (0.25W, 1%)
1 100kΩ
1 68kΩ
5 4.7kΩ
4 100Ω
electro’s polarity right (the “–” goes
to the outside of the PC board) and
second, leave enough lead length so
that it can lie flat on the board. Better
still, bend the leads down 90° before
soldering it in.
The supply “reservoir” capacitor
goes in next. If you are using a 3300µF
electrolytic, it goes in the same way as
the 1µF timing capacitor (ie, bent over
90°). If you are using a supercap, it goes
straight down, as you would normally
mount a capacitor on a PC board.
Now solder in the four LEDs, taking
care again with polarity. If you are
using a supercap, there needs to be a
good 3-5mm between the top of the
capacitor and the top of the LEDs, so
that they can poke through the case lid.
Next solder in the two ICs. Both
orient the same way (notch towards the
centre of the PC board) but of course
they must go in their right spots. When
soldering their pins, make sure you
don’t bridge solder between them.
The pins are very close together and
it’s easy to do.
Finally, solder in the pushbutton
switch. It goes in so that the flat on
its body runs parallel with the longer
sides of the PC board. It can easily fit
the other way around but if you put
it in like this, all you’ll have will be
a dead short!
Apart from the battery connections,
44 Silicon Chip
board should fit inside the Jaycar
HB6015 jiffy box (or similar) with the
battery holder underneath.
If you’ve used a supercap, it’s likely that it will be just a smidgeon too
high, meaning you won’t be able to
get the lid on!
Fortunately, there is an alternative box, the Dick Smith Electronics
H-2874, which is 40mm high (compared to 28mm high). So that will give
you all the clearance you need.
But remember that the LEDs will
need to be mounted higher and you
may even need to mount the push-button switch on tiny “stilts” (resistor
pigtail offcuts are ideal).
The front panel label will fit either
box – glue the label to the lid and drill
your holes to suit.
If you find the board slops around
inside the case, put a small piece of
foam plastic between it and the battery holder to force it right up against
the lid.
Decision time . . .
your board is now complete. Give it a
good check to make sure you haven’t
got any shorts, solder bridges, dry
joints, etc.
If everything checks out, solder
on the battery leads (but don’t
have the batteries in place when
you do). The black lead is the one
closest to the corner of the board.
Now, there’s a decision to be made.
Do I use the supercap or smaller capacitor?
Gee, I wish I had something to help
SC
me decide!
Checking it out
The only easy way to check it
out is to use it! Pop the batteries
into their holder (the right way
around). Hopefully, absolutely
nothing happens (ie, no LEDs
light). If they do, you have a short
somewhere.
Now press the push-button
switch – all the LEDs should
come on together. So far, so good.
Let the switch go and
hopefully one LED is
on and all others are off.
Wait a while (depending on which capacitor
you’ve used) and the
LED should dim and die.
If so – it’s finished,
apart from mounting it
in its case.
Same-size artwork for the PC board
and front panel. When you photocopy
the front panel, make two copies and
you can use one as a drilling template.
A good case
If you’ve used the
3300µF capacitor, the
www.siliconchip.com.au
|