This is only a preview of the May 1999 issue of Silicon Chip. You can view 33 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 Line Dancer Robot":
Items relevant to "An X-Y Table With Stepper Motor Control; Pt.1":
Items relevant to "Three Electric Fence Testers":
Items relevant to "Heart Of LEDs":
Items relevant to "Build A Carbon Monoxide Alarm":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Tell someone you love them!
a
e
v
a
H art
e
H
Now is the month of May-ing,
when merry lads are play-ing,
Fa-la-la-la and as everyone knows,
it will soon be Mother’s Day.
So we have produced a project for Mother’s
Day and for any other day that you want to tell
someone you love ’em. It is the Heart of LEDs.
Build it now and you’ll be in that special
someone’s “good books”.
by LES GRANT*
56 Silicon Chip
B
ACK IN NOVEMBER 1998 we
published the “Christmas Star”.
It turned out to be very popular
and just the ornament for the top of
the Christmas tree.
We’re taking the same basic idea
and indeed the same circuit to produce a version for Mother’s Day: the
Heart of LEDs.
Now you can have something different to give to that special Mum or
Grandmother. Or you may be able to
redeem yourself if you forgot St Valentines Day!
Either way, the
Heart of LEDs will
certainly last a
lot longer than
the traditional
bunch of flowers!
O r, i f y o u
don’t want to
give your heart
away, you can
actually wear it
“on your sleeve”
or better still, on
your lapel.
This is readily
done if the Heart
of LEDs is powered
from four AA cells
and these could be installed in a 4‑cell holder
which you keep in your
pocket.
The Heart of LEDs is a modestly sized PC board with an array of
30 LEDs arranged in two concentric
heart‑shaped patterns, ie, one heart
inside the other. Driven by a single
IC microcontroller, it flashes the LEDs
in a seemingly endless sequence of
patterns.
For those who don’t like microcontroller projects, just pretend the
micro is a dedicated LED driver IC
that happens to have been designed
to control 30 LEDs in the shape of a
Heart (what a stroke of luck!).
And it won’t be declared obsolete
just after publication like a purposedesigned IC might be!
As the design is derived from the
Christmas Star, those readers who
saw that article will notice that the
schematic is very similar.
In fact, you might think it is identical but the row connections to the
microcontroller are different.
The major differences between the
Heart and the Star are in the shape of
the PC board, the physical layout of
the LEDs and the software.
Why use a Microcontroller?
Using a PC parallel port to control
external devices is a popular approach
these days but imagine the response
when you present your Mum with a
flashing Heart attached to an umbilical cable running into the next room!
No, self‑contained is better.
The answer is to use a small micro-
Heart of my heart: give this to your Mum
on Mother’s Day or wear it on your lapel
when you’re out and about. This board
has the 8‑pin socket for an optional
EEPROM but this can be left out.
controller. They are cheap and easy to
use. And if the software doesn’t work
first time (when does it?), you simply
change the program and re‑program
the micro.
As this project demonstrates, by
changing the software you can make
a circuit which originally did one job
do something quite different.
Now we’re not going to go into the
ins and outs of the circuit because that
was done in the November 1998 issue
of SILICON CHIP. We’ll just mention
that the microcontroller is the Atmel
AT89C2051 and is a version of the
8051 family.
Here it is used to drive 30 LEDs
which are connected in an X‑Y matrix;
ie, the LEDs are interconnected in 6
rows and 5 columns.
The appropriate combination of
LEDs in a column is switched on for
a short time (about 2ms)
and the process is repeated for each column,
taking just 10ms
for a full cycle.
Provided the
multiplexing
is done quickly enough, the
persistence of
vision “fills in
the gaps” and
we see all combinations of
LEDs without
any flicker.
The power
supply uses
a 7805 3‑terminal regulator
with 0.1µF bypass
capacitors at its input
and output. Diode D1
provides reverse polarity
power protection. The maximum current drawn by the
Heart is about 140mA with all
LEDs on but less than about 50mA
for most patterns. It is powered by a
9V DC plugpack. Do not use a 12V
DC plugpack as the higher output
voltage will cause excessive heat in
the 3‑terminal regulator.
The software
As with the Christmas Star, the
basic source code for the Heart will
be available free (you can download
it from www.grantronics.com.au). An
extended version that uses an optional
24C16 EEPROM for storage may also
eventually become available.
The software is written in C language using the low cost Dunfield
Development Systems Micro/C compiler. There is nothing particularly
smart or tricky about the software – it
was written to be easy to understand
and to encourage use of small micros.
Consequently, there are no interrupt routines and no use of the
MAY 1999 57
Fig.1: the microcontroller (IC1) drives the 30 LEDs in a 5 x 6 matrix, with 5 columns and 6 rows. The EEPROM is
optional, to store extra patterns in the future. It can be left out.
counter/timers, the UART or the
comparator though Micro/C can make
use of these resources.
The software is table driven. This
means that the display patterns and
sequences are determined by data
stored in a table (an array of bytes).
There is a simple interpreter that
scans through the table to perform the
specified operations.
The defined byte values are listed
in Table 1. Note that the software for
the Heart is a little smarter than for
the Christmas Star – so it can do more
Table 1: Software Table
Byte value or range
01 to 30 (0x01 to 0x1e)
33 to 62 (0x21 to 0x3e)
64 (0x40)
65 to 79 (0x41 to 0x4f)
128 (0x80)
129 to 191 (0x81 to 0xbf)
253 (0xfd)
254 (0xfe)
255 (0xff)
58 Silicon Chip
Operation
Turn on LED 1 to 30
Turn off LED 1 to 30 (LED number = byte ‑ 32)
Go back to byte after loop start
Loop start, count = byte ‑ 64
Delay (use last delay count), each count = 10ms
Delay, count = byte ‑ 128, each count = 10ms
All LEDs on
All LEDs off
End of table
complex pattern sequences.
Note also that there are still quite
a few undefined values so future expansion is possible.
Putting it together
Assembly of the PC board is quite
straightforward. You will need a
soldering iron with a fine tip, preferably temperature‑controlled to about
320°C.
The first step is to carefully check
for shorts between tracks and broken
tracks. Fit the smallest parts first, the
wire links, followed by the resistors
and diodes.
Next, fit the crystal (or resonator)
and the IC socket for the micro. Then
install the transistors, capacitors and
LEDs.
Pay particular attention to the orientation of the LEDs – they all point the
same way but they don’t work when
installed backwards!
Finally, install the 3‑terminal regulator and the 2.1mm DC power socket.
Don’t insert the micro into its socket
just yet.
Do another close visual inspection,
looking for solder bridges especially
on the transistor pads. Then apply
power and check for the presence of
5V between pin 20 (+) and pin 10 of
the socket for IC1.
If all is OK, remove the power, plug
in the micro (make sure it’s the right
way around) and apply power again.
The micro then generates quite a
range of patterns with the LEDs which
then repeat after a while.
Running it from batteries
Earlier, we mentioned the possibility of running the circuit directly from
four AA cells; ie, 6V. To do this, you
would need to omit the 7805 regulator
and connect a link from D1 to C5.
This will give a supply rail of close
to +5.4V. Note that the diode must be
present because the maximum supply
for the microcontroller is 6V.
The hole near LED2 may be used to
hang the Heart. If you hard‑wire the
power supply, you may be able to use
this hole as a strain relief and hang the
Heart on the power wires.
Finally, the appearance of the Heart
may be enhanced by placing a piece of
red cellophane over the front.
Fig.2: the component
overlay. Make sure that
you insert all the LEDs
correctly. The cathode or
flat side is oriented away from
the DC socket in all cases. Don’t
insert the micro until you’ve done a
voltage check on the board (see text).
– it is so easy to change the behaviour
by changing the software. And what
about the optional 24C16 EEPROM?
Well, an enhanced version of the
Heart would read its data from the
EEPROM for much longer sequences.
To check out the latest version of
Fault finding
If the 5V DC is not present, check
the applied power polarity. The centre pin of the 2.1mm DC socket (SK1)
must be positive.
Check that D1 is correctly fitted, and
check the tracks from SK1 via diode
D1 and the 7805 to IC1 for breaks or
shorts. If one LED does not work, it
may be inserted backwards or it may
be shorted by a solder bridge between
its pads.
If one group of adjacent LEDs does
not work, check the circuitry and soldering around the appropriate column
drive transistor.
If several individual LEDs do not
work, check the corresponding row
drive circuitry. Remember, faulty
components are rare but soldering
faults are common.
The future
The Heart is still evolving. That is
part of the attraction of using a micro
the software, log in at http://www.
grantronics.com.au If you don’t have
Internet access, send a stamped ($1)
self‑addressed envelope with an IBM
format 3.5‑inch disc to Grant-ronics
and you will be sent the current
software files.
Parts List
1 Heart‑shaped PC board, code 08205991
1 2.1mm DC connector (SK1)
1 crystal or ceramic resonator, approx 12MHz (X1)
1 20‑pin IC socket
1 9V DC 150mA plugpack or
4 AA cells and
1 4 AA cell holder
Semiconductors
1 AT89C2051 programmed microprocessor (IC1) # – See next page
1 7805 5V regulator (REG1)
30 red LEDs (LED1‑LED30)
5 BC557 PNP transistors (Q1‑Q5)
1 1N4002 power diode (D1)
1 1N4148, 1N914 silicon diode (D2)
Resistors
5 2.2kΩ
6 120Ω
(code: red red red brown or red red black brown brown)
(code: brown red brown brown or brown red brown black brown)
Capacitors
1 10µF 16VW electrolytic
3 0.1µF monolithic or MKT polyester
2 27pF ceramic
(code: 104 or 100n)
(code: 27 or 27p)
MAY 1999 59
Included more for interest than
anything else, this “accidental” photo
clearly shows the multiplexing of the
LEDs as they are being scanned in a
linear motion. No, LEDs do not light
up in stripes!
Acknowledgement:
I would like to thank the people at
BEC Manufacturing who rushed the
prototype boards through in time for
publication.
SC
* Les Grant is the Engineering Director at Grantronics Pty Ltd, electronics
design engineers. Grantronics are the
Australian distributors for Dunfield Development Systems low priced software
development tools. See the advertisement in the Market Centre.
Fig.3 actual
size artwork
for the PC board.
#Where to buy the kit
Jaycar Electronics stores will have the complete kit available for $29.95.
Alternatively, Grantronics Pty Ltd can supply the programmed microprocessors for $10 plus $5 for packing and postage. Send remittances to Grantronics
Pty Ltd, PO Box 275, Wentworthville, NSW 2145. Phone (02) 9896 7150.
When you need mains power and there's no power outlet available, look to Bainbridge Technologies. Look at
the superb 1800W "Pure Sine Wave" inverter - because
it's sine wave you'll have no trouble with delicate test
equipment, computers, communications equipment,
tools... anything.
Don't need 1800W? Bainbridge Technologies have
you covered – with 150W output, the 150i 12V to 240V
inverter is ideal for consumer equipment including TVs
and VCRs.
There's a Bainbridge Technologies inverter to suit YOUR
requirements. Call today for more details!
60 Silicon Chip
|