This is only a preview of the August 2006 issue of Silicon Chip. You can view 37 of the 128 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 "Novel PICAXE LED Chaser Clock":
Items relevant to "Build A Magnetic Cartridge Preamplifier":
Items relevant to "An Ultrasonic Eavesdropper":
Articles in this series:
Items relevant to "Mini Theremin Mk.2; Pt.2":
Purchase a printed copy of this issue for $10.00. |
Amaze your friends
with this highly
visible animated
clock project.
It’s based on
a PICAXE
micro, a
quartz clock
movement
and a large
quantity
of low-cost
diodes and
LEDs. The
results will
surprise you!
Program & circuit design: RON RUSSO
Article & PC board design: CLIVE SEAGER
Clive Seager is Technical Director of Revolution Education
Ltd, the developers of the PICAXE system.
Novel PICAXE
LED Chaser Clock
I
T’S ALWAYS INTERESTING to see
the many and varied projects that
people create using PICAXE chips.
When first introduced to this LED
Chaser Clock from Ron Russo, I was at
first taken aback with the complexity
of the prototype; how could it possibly
have been made by hand? It was intricately assembled by wiring and soldering together well over 200 components,
all without a PC board!
As Ron himself stated, “the wiring
is kept to a minimum by the strategic
40 Silicon Chip
(piggy-back) placement of the shift registers and the unique way I coupled the
two banks of registers with the isolation diodes. The results of this method
appear more like a work of art than a
rats nest, which is the usual outcome
when no circuit board is used.”
However, most of us would not have
a steady enough hand or the patience
to build such a masterpiece. Therefore,
this incarnation of the project does
include a PC board so that everyone
has a chance to build it!
As can be seen from the photos, the
Chaser Clock is a marriage between an
analog quartz clock movement and a
circular array of LEDs. A continuous
visual display is created by synchronising LED effects with the movement
of the clock’s seconds hand.
Once every second, a “chaser” LED
starts from the 12 o’clock position
and appears to move around the dial
in an anticlockwise direction towards
the seconds hand. When it meets
the seconds hand, the LED appears
siliconchip.com.au
to “freeze” under the pointer (ie, it
remains illuminated).
So at each tick of the clock, one
more LED is illuminated. This creates
an arc of light that trails the seconds
hand. When the seconds hand reaches
12 o’clock, the arc closes to form a
complete circle of light, whereupon
all LEDs are turned off and the cycle
repeats over.
It’s difficult to visualise this effect
simply by reading about it, so we’ve
posted a short video of Ron’s prototype
clock in action on the SILICON CHIP
website. You’ll find it in the downloads section for this month.
Circuit basics
The complete circuit diagram for
the chaser clock appears in Fig.1.
A PICAXE-08 microcontroller (IC1)
drives the whole show with the aid
of timing pulses from the analog clock
mechanism.
The clock is used intact, with a pair
of diodes steering the pulses from its
coil to input3 of the micro. A 2.5V
supply for the clock mechanism is
derived from the 5V rail by dividing it
down with two 330W resistors, while
a 100mF capacitor supplies peak coil
current.
All 60 LEDs are driven by 74LS164
8-bit shift registers. Every tick of the
clock, the PICAXE-08 program performs a few simple calculations and
then manipulates the data (A&B), clock
(CLK) and clear (CLR) inputs of the
shift registers to produce the magical
effects mentioned earlier.
The 74LS164 shift registers are divided into two paralleled banks, with
isolation between the banks provided
in the form of series-connected diodes.
Registers SR1-SR8 handle the LED
chase effect, while SR9-SR16 handle
the arc of light that follows the seconds hand.
With this circuit arrangement, about
10-15mA of current flows through each
LED. No separate current-limiting
resistors are required, which greatly
simplifies the assembly task. Some
might be wondering how this simple
scheme is possible; don’t we always
need to limit LED current in a logicdriven circuit?
The answer is usually yes, of
course. However, by design, the 74LS
series TTL logic devices incorporate
a certain resistance in the upper NPN
output transistor’s collector circuit
(see Fig.3). In the case of the 74LS164,
siliconchip.com.au
this amounts to about 120W.
Accounting for the impedance of the
NPN output and the forward voltage
drop of the LEDs and series diodes,
the total current sourced from each
output shouldn’t exceed about 15mA.
This works very well, with the total
power dissipation for each IC remaining within safe limits.
Note that current will vary between
different brands of LEDs and shift registers, so for best results use devices
from the same manufacturer throughout. Do not be tempted to substitute
devices from another logic family.
For example, while 74HC164 devices
are pin compatible with the 74LS164,
they have an entirely different output
structure and will self-destruct in this
circuit!
Power supply
Due mainly to the large number of
LEDs, overall current consumption is
quite high, starting at about 200mA
and increasing to over 900mA as the
arc of light grows. The original circuit
was developed using an on-board
7805 regulator with a 9V supply but
when using this setup the regulator
gets very hot. Although a sizeable
heatsink would keep the regulator
within operating parameters, there is
still the possibility of heat damage to
surrounding materials.
The final version of the clock was
therefore developed for use with an
off-board regulated 5V power sup-
Par t s Lis t
1 PC board
1 2-way 5mm pitch terminal
block
1 miniature tactile push-button
switch (S1)
1 8-pin IC socket
16 14-pin IC sockets
1 analog clock mechanism (see
text)
Semiconductors
1 PICAXE-08 (IC1)
16 74LS164 8-bit shift registers
(SR1-SR16)
1 1N5817 (or 1N5819) Schottky
diode (D1)
2 BAT85 (or 1N5711) Schottky
diodes (D2 & D3)
120 1N4148 small-signal diodes
(D4-D123)
12 5mm yellow LEDs
48 5mm green LEDs
Capacitors
5 100mF 16V
8 100nF polyester
Resistors (0.25W 5%)
1 2.2kW
1 470W
2 330W
Also required (not in kit)
5V DC 1A (minimum) regulated
power supply (eg, Altronics
Cat.M 8909)
The kit includes two quartz
clock mechanisms like the
one shown here. These are
widely available for just a few
dollars. If you want to use
a dark clock face design,
you can paint the black
hands a lighter colour
(eg, yellow) to obtain a
good contrast.
August 2006 41
Fig.1: here’s the (almost) complete circuit diagram for the clock. As noted, we’ve left out some portions to make it
easier to follow. A PICAXE micro (IC1) manipulates 16 shift registers to control the light show, using pulses from the
clock mechanism for timing. Clever arrangement of the shift registers and LEDs allows the use of the smallest PICAXE
device in the range, with the program code consuming only 76 bytes!
ply, such as the Altronics M-8909.
However, if you prefer to build your
own regulated power supply, you’ll
find a suitable circuit in Fig.4. Note
that any supply should be located no
more than 2m from the clock and the
power leads should be formed from
heavy-duty hookup wire.
42 Silicon Chip
Power is connected to the board via
a 2-way screw-terminal block. A diode
in series with the positive input (D1)
is included for protection against accidental reversal of the leads. We’ve
specified a 1N5817 Schottky diode to
minimise voltage losses, so you should
get a reading of close to 4.7V when
measuring between the +5V and GND
rails on the PC board.
Putting it together
Assembly is very straightforward,
but time consuming! The PC board
is a double-sided design (tracks on
both sides), so take care that you have
siliconchip.com.au
the board the right way up. All of the
components except the LEDs mount
on side with the white silk screen
overlay!
Put all of the LEDs aside for the moment and begin by fitting the diodes
and resistors. Take care to insert each
diode around the right way; the cathode (banded) ends must go in as shown
on the overlay diagram (Fig.2). Also,
don’t mix up the 1N4148 and BAT85
types, which may look very similar
depending on the brand supplied.
siliconchip.com.au
Add all the IC sockets next, orienting the notched (pin 1) end as indicated. Follow with the few remaining components, including the reset
switch, terminal block and capacitors.
Note that the electrolytic capacitors
are polarised devices and must be
installed with their positive leads
oriented as shown.
The final task is to install all of
the LEDs. As shown on the overlay
diagram (Fig.2), there are two possible positions for the LEDs. Most
constructors will probably go for the
outer circle but some clock designs
may suit the inner circle. Don’t install
LEDs in both positions.
Before soldering the LEDs, work out
carefully what your clock face design
is going to look like and how it is going
to fit to the PC board – you may wish to
mount the LEDs several millimeters off
the PC board. Whatever your design,
remember that the LEDs are fitted on
the reverse side of the PC board to all
the other components!
August 2006 43
With all the LEDs in place, plug
the 74LS164 shift registers into their
sockets. It’s very important that the
notched end of each IC lines up with
the notch in its socket.
Clock mechanism
This view shows the fully-assembled clock prototype. Note that there have
been some changes to the PC board since this photo was taken – just follow
the parts layout diagram of Fig.2.
The final task is to “hack” the
clock mechanism. This requires a
steady hand and lots of patience!
The aim is to solder four wires to
the clock PC board; one to each
coil end and two to the battery
connection points.
Start by holding the assembly over a tray to catch any
gears that may drop out. Use a
flat screwdriver blade to carefully open the clock’s plastic
case by sliding it under the
tabs on either side of the casing.
Don’t bend the plastic too far or
it will snap!
You then have to remove the
gears to get access to the coil and its
small PC board. It’s a good idea to take
notes as you remove each piece, as
you have to rebuild the gearbox later!
Before lifting out the circuit board,
study the assembly carefully to see
how the two battery connector strips
make contact with the PC board. Make
a note of which PC board pad connects
to the positive side of the battery.
Lift out the PC board complete with
its plastic surround. You will see two
+
–
Start by removing the
back half of the clock’s
casing. This can be
achieved by sliding a flat-bladed
screwdriver under the tabs on
either side of the casing. Don’t bend
the plastic tabs too far or they will
snap!
44 Silicon Chip
After removing
several of the nylon
gears, you’ll be able to
lift out the complete
coil assembly. Solder
light-gauge wires to the
coil and battery pads on the PC board,
positioned as shown here. Make a
note of which wire goes where – so
that you’ll be able to hook them up
correctly once it’s reassembled.
Remove all of the gears and the two
battery contacts from the case half.
Cut a slot roughly as shown to allow
the four wires to pass out of case
once it is closed, then reassemble the
lot in reverse order. Don’t force the
case halves together – it you feel any
significant resistance, then a gear has
most likely jumped out of position!
siliconchip.com.au
Fig.2: follow this diagram and the legend on the board when assembling your clock. Don’t mix up the different types
of diodes and take care with the orientation of the ICs, diodes, LEDs and 100mF capacitors.
Table 1: Resistor Colour Codes
o
o
o
o
siliconchip.com.au
No.
1
1
2
Value
2.2kW
470W
330W
4-Band Code (1%)
red red red brown
yellow violet brown brown
orange orange brown brown
5-Band Code (1%)
red red black brown brown
yellow violet black black brown
orange orange black black brown
August 2006 45
Program Listing: PICAXE Clock
symbol Sec = b13
symbol Leds = b12
symbol TmLength = w0
symbol ChaseClock = 0
symbol NewSec = 1
symbol NewMin = 2
symbol ChaseData = 4
'seconds counter
'chase counter
'duration of pulsout to match chase with second
'pin0
'pin1
'pin2
'pin4 (chase data output & reset input for sync)
MAIN:
pause 100
high NewMin
goto RES_MIN
'settling time
'release SR9-SR16 reset (MR) inputs
'go initilise for start of new minute
LOOP:
input 4
if input4 = 1 then RES_MIN
if input3 = 1 then NXT_SEC
'set pin 4 as input
'if sync button is pressed initialise for new minute
'else a high-going pulse on input 3 indicates one second has elapsed,
'so start a new second
' NOTE: Some analog clocks have low-going rather than high-going pulses (change the above line to suit).
goto LOOP
NXT_SEC:
output 4
if Sec = 0 then RES_MIN
Sec = Sec – 1
'loop until a clock pulse occurs
'set pin4 to output to send chase data
'if min is up then go reset minute
'else one sec has elapsed so decrement secs
' Calculate optimum time factor so that all intended LEDs are illuminated just before the current
' second is up. A multiplication factor of 90 is optimum for the PICAXE-08.
TmLength = 61 – Sec
TmLength = TmLength * 90
CHASE:
high ChaseData
'set chase data bit high
for Leds = Sec To 0 Step –1
'count back starting from relevent second
pulsout ChaseClock, TmLength 'pulse with calculated duration to increment clock input of chase
'regs(SR1-SR8).
low ChaseData
'after first clock pulse, set data low for rest of chase
next Leds
'do rest of LEDs until this sec finished
low NewSec
pause 1
high NewSec
goto LOOP
RES_MIN:
Sec = 60
low NewMin
pause 1
high NewMin
Fig.3: the equivalent circuit
for each output (O0-O7) of a
74LS164 shift register. The
resistance in the collector leg of
the high-side transistor greatly
reduces the maximum current
that these devices can source.
'zero SR1-SR8 outputs, clock SR9-SR16
'make pulse 1ms wide
'return high
very fine wires connecting the coil to
two small pads near the edge of the
PC board. These are only as thick as a
human hair, so you may need a bright
light and a magnifying glass!
Now carefully solder two light-gauge
hookup wires (about 150mm long) to
the coil connection pads. Study the
orientation and dress of the wires in
the photos before you begin.
The kit for this project includes two
PP3 battery snaps that can be sacrificed
for their black and red wires. Simply
cut off the battery snaps and use the
pre-tinned wire ends for the clock connections. Alternatively, you could use
rainbow cable for the job.
Only hold the soldering iron in
'power up or minute is up or syncro reset . . .
'reset all SR9-SR16 outputs to zero
'make pulse 1ms wide
' As the first 4 outputs of SR9 are not connected to LEDs we must send a dummy run of 4 clock
' pulses to shift regs SR9-SR16 to start at LED60 (SR9 output O4). This will also pulse the reset (MR)
' inputs of SR1-SR8, zeroing their outputs ready for the new minute.
for B10 = 1 to 4
pulsout NewSec, 10
next
if input4 = 1 then LOOP
goto NXT_SEC
46 Silicon Chip
'check input again if sync button still pressed
'else go start a new minute
Ron Russo’s prototype was made by
hand wiring over 200 components –
all without a PC board. The ICs were
even piggy-backed!
siliconchip.com.au
place for a fraction of a second – if a
joint is overheated the pad will lift off
or the coil wire come adrift. Next, solder the two power wires. Thankfully,
these are easier to work with, as the
pads are much larger. Be sure to note
the positive (+) and negative (-) wires
for later identification.
Important: it is not necessary to
remove the coil and its PC board from
the plastic surround. However, you
must be very careful not to contact
the gear posts that are part of the
plastic molding with the barrel of your
soldering iron!
Remove the two metal battery contact springs from the plastic casing and
use a sharp knife to cut a small opening
in the plastic to allow the four wires
to pass through (see photos).
You can now reassemble your
clock mechanism, with the aim obviously being to get all of the gears in
the right places! Finally, mount the
clock to the chaser PC board and
solder the four wires in position.
Fit the hands and then you’re
ready to go!
Made a mistake during the
assembly or lost a gear? Don’t
worry; the kit includes a spare
clock mechanism!
Fig.4: the clock must
be powered from a
regulated 5V DC supply
with at least a 1A
capacity. High-power
regulated plugpacks are
readily available but
if you want to use an
unregulated plugpack,
you’ll need to add a 5V
regulator circuit. Here’s
a suitable circuit based
on the popular 7805.
PICAXE program
The PICAXE chip in the kit
is supplied pre-programmed
with Ron’s original program.
However, the fully commented
listing is included here for those
who wish to experiment. In particular, the timing multiple (90)
may need tweaking slightly if your
chaser runs too fast or too slow.
A programming socket is not included on the PC board. However, it’s
a simple matter to reprogram the micro
in any of a number of different project
boards. If you don’t already have a
suitable board and programming cable,
check out the Schools Experimenter
Starter Pack (part. no. AXE092S) or
the PICAXE-08 Starter Pack (part no.
AXE-003). Both are available from
MicroZed Computers; see the adjacent
panel for contact details.
Synchronisation to the seconds
hand is achieved by pressing the
reset button and then waiting for the
seconds hand to reach 60. The LED
display will be blanked and then start
from 1 when the button is released.
The clock will stay in sync until power
SC
is removed.
siliconchip.com.au
This side of the board looks very bland without the clock face. You don’t
get one of these in the kit but you can easily create your own from a
favourite photograph or desktop wallpaper (we used “The Matrix” theme
wallpaper). The numerals can be added in just about any graphics program
and the result printed out on photographic quality stock.
Where To Buy A Kit Of Parts
The PC board copyright for this project is owned by Revolution Education
Ltd. Complete kits (part no. AXE115S) are available from authorized PICAXE
distributors – see www.microzed.com.au or phone MicroZed on 1300 735
420. Note: kit does not include clock face (see above).
August 2006 47
|