This is only a preview of the November 2024 issue of Silicon Chip. You can view 46 of the 112 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 "Variable Speed Drive Mk2, Part 1":
Articles in this series:
Items relevant to "Surf Sound Simulator":
Items relevant to "JMP014 - Analog pace clock & stopwatch":
Items relevant to "JMP013 - Digital spirit level":
Items relevant to "FlexiDice":
Items relevant to "0.91-inch OLED Screen":
Articles in this series:
Items relevant to "3D Printer Filament Dryer, Part 2":
Purchase a printed copy of this issue for $13.00. |
Mini Projects #014 – by Tim Blythman
SILICON CHIP
Analog Pace Clock
& Stopwatch
Despite the commonality of digital
clocks, analog Pace Clocks are
still prevalent, being used for
purposes like timing swimming
laps. This version is driven
by a microcontroller, so it can be
started and stopped and even used
as a stopwatch.
As well as the mounting and wiring arrangements, you can also see the jumper
wire connected between D8 and ground to force the Pace Clock to operate when it
is powered on. If wiring up the switches, they connect to D8-D12 and GND.
P
ace Clocks are used by swimmers for training and practice.
It is claimed they were invented on
Sydney’s Northern Beaches, just up
the road from the Silicon Chip office.
A pace clock has a solitary hand,
and the face is marked out in seconds,
making it easy and quick to check lap
times. It is usually marked with a 60
(or zero) at the top and a 30 at the bottom. The hand sweeps one revolution
per minute, allowing times to be measured by simply glancing at the clock
at the end of each lap.
It would be easy to make a Pace
Clock using just the second hand of
a standard quartz analog wall clock,
but using a stepper motor and a microcontroller gives us several advantages.
Firstly, the stepper motor is much
more powerful than the motor in a
quartz clock, so the Pace Clock can
be built with a bigger face and longer
hand, making it more visible.
Secondly, adding a microcontroller
means it is possible to turn the Pace
Clock into a stopwatch. Our Pace Clock
can be started, stopped and reset. Since
this can be done using digital inputs
on the microcontroller, you could even
Parts List – Pace Clock (JMP014)
1 5V Stepper Motor with Controller [Jaycar XC4458]
1 Arduino Leonardo main board [Jaycar XC4430]
6 male-female jumper wires [Jaycar WC6028]
1 male-male jumper wire [Jaycar WC6024]
power supply for the Leonardo (eg, a USB power supply & micro-USB cable)
2 M4 × 15mm panhead machine screws [Jaycar HP0453]
4 M4 flat washers [Jaycar HP0465]
2 M4 hex nuts [Jaycar HP0462]
Nylon M3 screws, nuts and washers to mount the Leonardo & stepper driver
5 SPST momentary pushbutton switches (optional)
wire to connect switches to Leonardo board (optional)
1 sheet of cardboard, Corflute or thin ply
1 printed clock face (see text)
1 clock hand (eg, cut from cardboard or 3D-printed)
space-filling glue such as epoxy, hot melt glue or neutral-cure silicone sealant
siliconchip.com.au
Australia's electronics magazine
use it for automated race timing with
the right accessory hardware.
You can see a short video of the
Clock in operation at siliconchip.au/
Videos/Pace+Clock
The Leonardo board we are using
(like many Arduino-compatible
boards) has a crystal oscillator, so
it will be pretty accurate, typically
within 50ppm; that’s certainly accurate enough for an analog clock that
is meant to be read by eye.
We’ll detail the construction of our
prototype, which is based on a clock
face around 20cm across (allowing it
to be printed on A4 paper). But you
should have no trouble scaling up your
version to be larger if needed.
Circuit details
Fig.1 shows the circuit. The stepper motor and its controller are on the
right and are connected by a harness
terminated with a polarised plug, so it
can only plug in one way. The boxed
area shows the parts on the stepper
motor control module. Note how they
connect to the motor and the Arduino
Leonardo microcontroller board.
This stepper motor has four windings, each of which is positioned in
conjunction with an arrangement of
fixed metal teeth. When energised
November 2024 59
ALL DIMENSIONS ARE IN MILLIMETRES
sequentially, they attract the corresponding teeth on the rotor. Because
the teeth are positioned at intervals,
the motor’s position can be set quite
accurately.
The motor we are using has 32 teeth
and is also connected to a 1:64 reduction gearbox. That is equivalent to a
simple stepper motor with 2048 teeth,
which is more than enough to count
out seconds with precision.
The driver IC is a ULN2003 chip
with open-collector Darlington transistor outputs; only four of its seven
channels are used. The ULN2003
pulls its outputs to ground when the
corresponding input is driven high.
In addition to the connections to the
motor windings, there are four LEDs
with series resistors. Their anodes are
connected to 5V and the cathodes to
the outputs, so the LEDs light up as
each winding is activated.
Since the stepper motor is a unipolar type, this simple control system
works well. A bipolar stepper motor
type would require a more complex
circuit, such as an H-bridge, that can
drive positive and negative voltages.
60
Silicon Chip
Six jumper wires provide power and
control signals from the Leonardo to
the stepper motor controller. For more
information on stepper motors, see
our primer article (January 2019 issue;
siliconchip.au/Article/11370).
To build a functioning circuit, you
need only the first five items in the
parts list. You might like to test and
assemble them first to get a feel for the
stepper motor’s operation.
Assembly
We tested our prototype with an
Arduino Leonardo, so we know that
it works, but just about any Arduino
board with enough pins should also
work. The functions of the pins are
set by #defines in the sketch so that
they can be changed if needed. The
motor draws around 100mA, which
any Arduino board can supply from
its 5V pin.
Connect the six jumper wires
between the Leonardo and driver
board as shown in Fig.1. For testing,
connect an extra jumper wire between
D8 and ground; that will start the clock
when it is powered on (you can see this
Australia's electronics magazine
in our lead photo showing the back of
the Clock).
Software
You’ll need the Arduino IDE software to upload the sketch to the board.
It can be downloaded from:
siliconchip.au/link/aatq
Once it is installed and running,
choose the Leonardo board and
its corresponding serial port in its
menus. Download the PACE_CLOCK
sketch from our website (siliconchip.
au/Shop/6/486), open it in the IDE
and upload it to the Leonardo board
(Ctrl-U). The default sketch scans all
the switches shown in Fig.1; they are
simply ignored if they are unconnected.
You should see the LEDs on the
driver board start to move in a quick
sequence. Connect the motor and it
should start to rotate at 1 RPM. If the
motor buzzes or hums without turning,
check that all the wires are connected
and in the correct sequence.
You can test the other switch functions by disconnecting the jumper
wire from D8 and touching it to each
siliconchip.com.au
Fig.1: the driver module and
pluggable wiring harness make this
a very easy project to build, at least
electronically. Take care with the
wiring between the Leonardo and
the driver module and you should
have no trouble getting this circuit
up and running.
Fig.2: the dimensions for mounting
the stepper motor. The larger 9mm
hole accommodates the boss that
protrudes from the body of the
motor; the shaft is only 5mm in
diameter and 3mm across the flats.
The centre of the 9mm hole also
marks the centre of the clock face.
of D9-D12. The function pins are set
out in the sketch. When the Start
switch is pressed, the clock begins
delivering the sequence to the control board needed to advance the
clock hand.
When the Stop switch is closed, the
sequence is paused. Pressing Reset
causes a faster sequence to be generated in reverse order, which rewinds
the hand to the zero position. All we
need to do this accurately is to keep
count of the steps that the hand has
moved.
The Trim+ and Trim- buttons only
work when the hand is stopped. They
move the hand forwards and backwards at a moderate pace, to allow it
to move to a new zero position, such
as when first powered on. This also
resets the step number.
Clock face
An online image search for “pace
clock face” gave us many samples that
could be printed out for use on the
Pace Clock. We simply printed ours
on a sheet of A4 copy paper and glued
it to a piece of cardboard.
siliconchip.com.au
Our clock face was printed on a sheet of A4 paper and glued to a piece of
cardboard. The metal screws retain the stepper motor while the plastic
screw heads are for the Leonardo and driver module; the positions of the
latter are not critical.
If you want something a bit more
polished, Bunnings has sheets of white
Corflute (corrugated plastic sheet) that
would also work quite well as a baseboard.
We used Fig.2 to mark out the holes
we would need and carefully cut them
out with a sharp hobby knife. Wad
punches would work quite well if you
have them.
Use M4 machine screws to mount
the stepper motor to the board, with
just the shaft poking out the front.
The driver board and Leonardo have
3mm mounting holes, so they can be
mounted with the Nylon M3 hardware.
The positions are not critical; we recommend placing the Leonardo near
the bottom of the clock so its power
lead can hang down.
We also designed a 3D-printed hand
and a bracket to help mount a custom-
built hand to the stepper motor’s shaft.
These are available as part of the software download. We printed ours on a
resin printer, and you can see them in
our finished clock in the photos.
A simpler approach would be to use
a cardboard cutout for the hand. When
Australia's electronics magazine
The hand on the right has a socket
on its underside, like the bracket at
lower left, that makes it a friction fit
to the stepper motor shaft. You might
like to add some glue to help secure it.
November 2024 61
gluing the parts, apply the glue and
then rest the clock face-down. That
will prevent the glue from running
back up the shaft and into the workings of the motor.
Customisation
Our Pace Clock is not waterproof at
all, so you will need to install it in a
waterproof enclosure for use around
the pool or at the beach.
For simplicity, we left the control
switches off our prototype. You could
mount the Trim switches on the back
since they won’t be used often. You
could mount the Stop, Start and Reset
buttons remotely, so that they can be
controlled from a convenient location.
If you want to make your Pace
Clock more robust, something like the
XC4482 prototyping shield could be
used to mount the wires and switches.
A few #defines in the sketch can
be used to customise the Pace Clock.
The PERIOD #define sets the time for
one revolution and could be changed
if you wanted a different period (eg,
30 seconds or two minutes).
We have seen some Pace Clocks at
swimming pools with dual opposing hands of different colours, so you
The Palm Beach Scientific Training Group poses with the world’s first
swimming pace clock at the Palm Beach rock pool north of Sydney, Australia.
Source: https://swimswam.com/history-swimming-pace-clock/
Songbird
don’t have to wait as long for one to
reach the zero.
If you need the clock to operate anti-clockwise, use the ANTICLOCKWISE #define in the code.
An easy-to-build project
Unfortunately, this will not make time
run backwards. As noted earlier, the
nine I/O pins that are used are also set
by #defines, so you can change them
SC
too if you wish.
that is perfect as a gift.
SC6633 ($30 plus postage): Songbird Kit
Choose from one of four colours for the PCB (purple, green, yellow or red). The kit includes nearly all
parts, plus the piezo buzzer, 3D-printed piezo mount and switched battery box (base/stand not
included). See the May 2023 issue for details:
siliconchip.au/Article/15785
62
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
|