This is only a preview of the September 2023 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
y
h
c
n
d
e
Anal
s
i
n
o
r
o
gu
eC
lo c
G P S Ge of
-S
f
a
r
G
s
’
m
ha
k
w
it
h l
o n g b at t e ry
e
f
li
This GPS Clock Driver converts an ordinary wall clock into a highly
accurate timepiece that will keep exact time (within seconds) for up to
eight years using a pair of C cells. You need not touch the clock during
that period; it will automatically adjust for daylight saving by adding
and subtracting an hour exactly when needed. This is a clock you can
rely on to tell you the correct time.
18
Practical Electronics | September | 2023
I
t is amazing how useful it is
to have at least one highly accurate
clock in the house. At a glance, you
know the correct time without having
to remember if that clock is running
slow or fast and by how much.
Most people would be happy with
a wall clock that was accurate to the
minute, but with this project, it will be
accurate within a few seconds. Even
better, any inaccuracy will not accumulate – the clock will remain that
accurate for the life of its battery.
Adjusting for daylight saving is an
annoyance with traditional quartz wall
clocks. Twice a year, it forces you to
get up on a chair or step stool to take
down the clock and adjust its hands.
Our GPS Driver automatically makes
those adjustments for you.
At 2am on the day specified for the
start of daylight saving, the clock will
begin running fast until it has added
the required hour. Then, at 3am on
the day specified as the end of daylight saving, the clock will run slow or
stop until it has returned to the non-
daylight saving time.
This is accomplished using a GPS
module to get the precise time from
the network of GPS satellites and
some clever software to control the
clock’s hands.
We have published similar designs
many years ago (the last was in PE,
February 2018), but they all had a
relatively short battery life. By using
ultra-low-power components and
some extra tricks in the firmware, this
design will run for about two years on
a pair of AA cells and up to eight years
with C cells.
It will work with most wall clocks
on the market. All that is needed is a
modification to connect wires to the
stepper motor in the clock’s movement. Luckily, that is usually easy.
Stepping clocks
There are two types of analogue wall
clocks: stepping clocks, where the
second hand steps once a second, and
sweep clocks, where the second hand
moves smoothly around the dial. Stepping clocks are more common than
sweep types. They have a Lavet-type
stepping motor consisting of a small
magnet that rotates between a coil’s
magnetic poles.
The clock driver delivers alternating positive and negative pulses to this
coil, and the rotor rotates 180° with
each pulse. These pulses are about
40ms in duration, and one is delivered per second (as shown in Scope 1),
causing the second hand to advance
once per second.
Stepping clocks vary considerably
in quality and price. We purchased
Practical Electronics | September | 2023
Scope 1: the output of the GPS Clock Driver for a stepping movement consists of
alternating positive and negative pulses that drive the rotor in the clock’s motor
to make a 180° step with each pulse. Each pulse is about 40ms in duration, and
they are delivered once per second.
Scope 2: the output driving a sweep movement; a continuous stream of positive
and negative pulses at 8Hz. Each pulse is 31.25ms long with 31.25ms between
pulses, resulting in 16 pulses per second. At low battery voltages, the clock
driver lengthens the pulse time by 24% and reduces the idle time by the same
amount, delivering more energy to the clock’s motor.
an example for testing from a budget
store for a couple of quid, and while
it was not the best, it was also not the
worst clock movement. Its accuracy
was terrible but, as we are replacing
its driving circuit with our own, that
doesn’t matter.
Typically, stepping clock movements have a coil resistance between
200W and 500W, with a higher resistance indicating a longer battery life
(the budget special was 375W).
Sweep clocks
The alternative sweep clock movements, sometimes called ‘silent’ or
‘continuous’ movements, have a similar drive motor except that it is driven
by a continuous stream of positive
and negative pulses at 8Hz, as shown
in Scope 2. This continuously spins
the rotor, with its momentum keeping it moving between each pulse, so
it does not make individual steps like
the stepping type movement.
As a result, the second hand moves
continuously (sweeps) around the
dial, and the clock is near silent. This
contrasts with the stepping types,
which make an audible tick sound
every second.
Each ‘sweep’ pulse is 31.25ms
in duration with a dwell time of
31.25ms between pulses, resulting
in 16 pulses per second. Because the
motor is drawing current 50% of the
time, you would expect the battery to
be flattened in no time compared to
a stepping clock. Sweep movements
avoid this by using a coil with many
more turns and a higher resistance
(typically 5kW).
19
Einstein’s theory of relativity and GPS accuracy
GPS satellites circle the Earth at an altitude of 20,000km and are used at ‘trilateration’ locations using precise onboard clocks. In their high-altitude orbits,
the clocks experience a weaker gravitational field, so spacetime is warped differently for them compared to clocks on Earth. The effect is that the clocks
speed up at a rate of 45μs/day.
The satellites are also whizzing around at pretty high speeds (about
14,000km/h), and the time dilation predicted by Einstein’s special theory
amounts to slowing the clocks by 7μs/day. Together, these effects amount to
a net speeding up of 38μs/day.
That doesn’t sound like much, but ignoring it would lead to a vast inaccuracy in the global positioning system within a few hours. Light travels over
10km in 38μs, and that sort of error in position per day would not make for
accurate navigation.
The solution is to slow the satellite clocks by a precise amount calculated
using Einstein’s theory of relativity so that they match time measured on the
Earth’s surface. This allows the system to work to accuracies of metres rather
than kilometres.
Edited excerpt from ‘Why does E=mc2’ by Brian Cox and Jeff Forshaw, ISBN
978-0-306-81758-8
Sweep clocks are more expensive,
typically £30 to £80 (and up). However, we found an excellent example
at IKEA (called ‘TJALLA’) for just £9,
and it performed pretty well, rivalling a genuine Seiko sweep movement that we purchased for around
£17.50. The only problem with the
IKEA movement was that it was difficult to pull apart to modify– and
even harder to reassemble.
Keeping perfect time
When the clock is running, the GPS
Clock Driver will need to occasionally
add or subtract a second to keep the
hands accurate. This is easy for a stepping movement; the Driver delivers
two pulses in one second to advance
the clock by one second, or no pulses
for a second to retard it by one second.
With daylight saving, this is more
noticeable. When daylight saving
starts, the hands need to advance by
one hour and to do this, the Driver
generates two steps every second for
an hour until the hands have reached
the correct daylight saving time. At
the end of daylight saving, the clock
will stop stepping for an hour until
the time catches up with the position
of the hands.
Sweep movements need a different
approach because we must maintain
the momentum of the spinning rotor; it
cannot simply go twice as fast or stop/
start. So, the adjustment must be more
subtle. To add or subtract a second,
the movement is run 12.5% faster or
slower for eight seconds.
With daylight saving, this means
that it will take eight hours to add the
required hour and a similar time to
retard by an hour. While this is a long
time for the clock to be catching up,
it only happens twice a year. Instead,
you could disable daylight saving in
the setup and manually adjust the
hands when required.
How the Clock Driver works
Fig.1 shows the GPS Clock Driver
block diagram. Microcontroller IC1
generates a sequence of positive and
negative pulses that are buffered by op
amp IC2. IC2 drives the motor in the
clock movement.
A crystal oscillator running at
32768Hz (215) drives a 16-bit counter/
timer in IC1 to generate the precise
timing required. Importantly, this
timer can operate while the microcontroller’s core is in sleep mode, so
it only consumes a few microamps.
The microcontroller spends most of
its time in this low-power sleep mode.
When it is time to generate an output
pulse, the timer wakes the CPU to drive
the output pin to start the pulse, and it
resets the timer to wake again when the
pulse is due to finish. When it wakes
again, it terminates the output pulse,
sets the timer for the next pulse and
goes back to sleep.
This continues forever, with the
microcontroller jumping in and out
of sleep and toggling the output pin to
generate the pulse train for the clock’s
motor. The CPU’s running time is short
compared to the sleep time, so the
average current drawn by the micro
is very low.
The sequence of pulses to the clock’s
motor alternate between positive
and negative, with a dwell time in
between. This is achieved by switching the pin between high, low and
high-impedance.
Op amp IC2 buffers this signal to
drive the clock by bringing its output to
the positive terminal of the upper cell
or the negative terminal of the lower
cell, or the junction for the dwell time
between pulses. This divides the load
between the cells, with each providing half the power for the clock motor.
GPS synchronisation
Not shown in Fig.1 is the boost voltage
regulator that powers the GPS module. Occasionally, after delivering a
pulse to the motor, the firmware will
not put the CPU to sleep but will keep
running and enable the boost regulator, which delivers a regulated 4V to
the GPS module. It will then get an
accurate time from the constellation
of GPS satellites.
Generally, it takes less than a minute
for the GPS module to locate sufficient
satellites and return the precise time.
When the microcontroller has received
this time, it shuts down the regulator
Fig.1: the GPS Clock Driver uses a crystal oscillator running at 32768Hz and a 16-bit counter/
timer within microcontroller IC1 to generate the precise timing required to drive the clock motor.
IC1 generates a sequence of positive and negative pulses that are buffered by op amp IC2 to drive
the clock movement motor. IC1 spends most of its time in sleep mode to extend battery life.
20
Practical Electronics | September | 2023
and makes some calculations to determine any timekeeping errors. After this,
it reverts to its regular strategy of sleeping until the next pulse is due.
Initially, the time between GPS synchronisations is set to 12 hours, but
over time the firmware will increase
this to five days. The average battery
power required for GPS synchronisation is minimal, so this process does
not materially affect the battery life.
The firmware keeps track of the
position of the clock’s hands as the
number of seconds since 1 January
2000. The GPS time is also converted
to this format, so it is easy for the firmware to compare the two and calculate
any correction that may be required.
The difference between the two
numbers represents the error in the
32768Hz crystal oscillator, which is
used to keep the time between GPS
synchronisations. By working out this
error, the firmware can correct for it
over the next period between GPS synchronisations by occasionally adding
or skipping a second as needed.
This will start working following the
second GPS synchronisation and will
keep the clock accurate regardless of
any error in the crystal, including compensating for additional errors due to
temperature and ageing of the crystal.
The practical effect is that, apart from
the first day, the clock’s hands will
always be accurate within a few seconds between GPS synchronisations.
Also, the next GPS synchronisation
should not need a large correction;
maybe only a second or two (or possibly none).
When the boost regulator and the
GPS module are initially powered,
they can draw a lot of current, especially if the cell voltages are low. This
cannot be sustained by a battery on its
last legs, so the firmware measures the
battery voltage when running the boost
regulator. If it is below 2.25V (1.125V
per cell), it will skip any subsequent
GPS synchronisations.
This will have little effect on the
clock’s accuracy as it will only occur
towards the end of the battery’s life,
and by then, the firmware will have
a good idea of any error in the crystal
and will continue to compensate for it.
Circuit details
The full circuit, shown in Fig.2, is based
around a Microchip PIC16LF1455
microcontroller. It is an extra-lowpower device that can operate with
a supply voltage as low as 1.8V (0.9V
per cell in this case). Most clock movements will stop running between 0.9V
and 1.0V per cell, so the microcontroller will run for as long as the clock’s
motor can keep going.
Practical Electronics | September | 2023
This microcontroller also has USB
support, so a mini Type-B socket is
provided for configuration (CON4).
When a host is connected or removed,
the microcontroller will detect the
USB +5V voltage on its pin 9.
The 5V is dropped to 2V by the
10kW/6.8kW resistive divider, so it will
not damage the microcontroller when
the battery is at 1.8V. It will still be
recognised as a high logic level when
the microcontroller runs from a fresh
battery (3.2V).
Any change in the voltage on pin
9 will cause the microcontroller to
restart. If, upon restarting, the USB
voltage is present, the firmware will
set the microcontroller’s clock speed
to 16MHz and enable the USB interface. LED1 will flash three times to
indicate that the firmware is in configuration mode.
If the USB voltage is not detected on
startup, the clock speed will be set to
4MHz, and the USB controller will be
disabled (both to save power). The firmware will go through the usual clock
startup routine, flashing LED1 twice.
The PIC16LF1455 has an unusual
feature: it can use the host’s USB signalling rate to fine-tune its internal
clock. The USB specification requires
a high accuracy in this timing and that
generally requires a 12MHz, or similar,
crystal oscillator. But the PIC16LF1455
does not need this, which frees up two
pins and makes for an easy-to-implement USB interface.
The microcontroller steps the clock
movement by driving its pin 8 high for a
negative pulse, low for a positive pulse
or setting it to high impedance for the
idle time between pulses. This controls
op amp IC2 (MCP6041), which uses the
centre point of the two cells as its reference and drives its output either positive or negative relative to that.
The MCP6041 has several desirable characteristics: its output will
swing rail-to-rail, which means that
little of the precious battery voltage
is lost within the op amp. It also has
an extremely low quiescent current
(less than a microamp), so the battery
is conserved between pulses, and it
will operate at a supply voltage well
below 1.8V (0.9V per cell).
Boost regulator
When the microcontroller needs to
get the GPS time, it drives its pin 7
high, enabling boost regulator IC3,
The GPS Clock Driver on the back of an IKEA ‘TJALLA’ sweep clock. The
movement has been modified to bring the connection to the clock motor’s
coil out through a hole. The Driver PCB was designed to be small as there is
often little space behind a wall clock.
21
GPS Analogue Clock Driver
Fig.2: the Microchip PIC16LF1455 microcontroller (IC1) runs the show. It steps the clock movement by driving its
pin 8 high for a negative pulse, low for a positive pulse or setting it to high impedance during the idle time between
pulses. Op amp IC2 buffers this signal and uses the centre point of the two batteries as its reference to drive its output
either positive or negative. When the microcontroller needs to get the GPS time, it drives its pin 7 high, causing the
boost regulator (IC3) to start running and power the GPS module.
a Microchip MCP16251. It generates
about 4V at its pin 5. This is set by the
ratio of the 2.2MW and 1MW resistors;
4V was chosen so that the regulator
will have some headroom to regulate
the output voltage with fresh cells.
The MCP16251 disconnects its output when it is disabled by a low voltage
on its pin 3. This is unusual in a boost
regulator, and is an important characteristic as it prevents the GPS module
from draining the battery when it is
not being used.
The output from the GPS module
(VK2828U7G5LF) is a standard asynchronous serial stream at 9600 baud
with TTL signalling voltages. To protect the microcontroller when the battery voltage is low, BAT85 diode D1
clips its output to just a little over the
battery voltage.
The module comes with a connector and colour-coded flying leads, as
shown in Fig.2. It also has two indicator LEDs; the red LED, which indicates
power, while the green LED will flash
at one pulse per second.
Battery life
The main factors determining how
long the batteries will last are the
22
current drawn by the clock’s motor and
the quality of the cells used.
Our budget stepping clock drew
an average of 170µA while the IKEA
sweep clock averaged 135µA (both
with a drive signal of 1.5V peak-topeak), typical of these types of movements. Because the GPS Clock Driver
powers the motor from both cells, the
typical average current drawn from
each is 70-85µA.
The average current drawn by the
microcontroller is about 18µA, which
applies to both cells. The shutdown
current of the boost regulator and a
few other sources add about another
3µA per cell.
Finally, there is the current consumed by the periodic operation of
the GPS module. The peak current
is up to 100mA, but it is only drawn
for a short period every five days, so
its long-term average is quite low at
about 5µA.
Adding all of this together means
that a typical clock will draw about
100µA from each cell.
To keep the clock running for longer
on low battery voltages, the firmware
changes the pulse train duty cycle if
the battery voltage is less than 1.125V
per cell. It lengthens the pulse time
by 24% and reduces the idle period
by the same amount. The waveform’s
frequency is the same, so it does not
affect the timekeeping accuracy, but
it delivers more energy to prevent it
from stalling.
This allows a sweep clock to continue operating below 1V per cell,
thereby using the last drop of energy
in the cell and lengthening the running
time. The effect on a stepping clock is
not as significant, but most will last
until 1V is reached.
By the way, if you are testing the
minimum running voltage for your
clock, you need to mount it in a vertical position. The effort required to
raise the second hand against gravity
will cause the clock to stop early compared to if it is mounted horizontally.
Also, if you are not concerned
with having a second hand, you can
remove it, and the clock should run
for a few weeks longer because it
does not have to put in that additional effort.
Good-quality alkaline AA cells
have a capacity of 2000mAh or more
with light loads (terminating at
1.0V) so, with a total current draw of
Practical Electronics | September | 2023
100µA, you could reasonably expect
the battery to last about two years.
Obviously, this can vary considerably depending on the quality of the
movement and the cells, but it is a
reasonable estimate.
If there is room behind the clock,
you could separately mount two C
cells which have a capacity about four
times that of the AA cell, so you could
expect up to eight years of operation
(see below). The limiting factor would
be the quality of the cells and their rate
of internal self-discharge.
Programming and sourcing the parts
You will need to program the microcontroller yourself. There are six solder pads on the PCB for mounting a pin
header. This enables you to program
the chip in-circuit – you just install the
header and connect a PIC programmer
such as a PICkit 3 or PICkit 4.
The firmware is available from the
September 2023 page of the PE website at:
https://bit.ly/pe-downloads
You can also access the firmware from:
http://geoffg.net/gpsclockdriver.html
It is worth checking http://geoffg.net
for updates from time to time, as there
is the possibility that a bug will be
found and fixed.
Besides the PCB and microcontroller, the other project components are
standard and can be purchased from
the usual suppliers.
Do not substitute the BAT85 diode
with another type. It is a schottky type
for a low voltage drop, but it also has a
low reverse leakage, which is needed
to extend the battery life.
We have specified the V.KEL
VK2828U7G5LF GPS receiver, a great
performer that is readily available at a
good price. If you want to use another
module, that will probably be OK. Just
make sure it uses TTL signalling and
not RS-232 levels.
The project’s firmware will automatically try the typical communication speeds used by these modules
(4800, 9600 or 19,200 baud). It uses
the NMEA RMC message generated by
the GPS module, which is standard
across all manufacturers.
When purchasing the clock, you
could choose a clock design that is
attractive but swap out the movement for something else. Most highend clock manufacturers have standardised the physical dimensions of
the clock movement and its mounting
arrangement. However, this does not
apply to cheap clocks, which do not
follow any standard.
You can also buy movements online
with a wide variety of matching hands.
So, making your own clock with a
unique clock face is also an option.
Practical Electronics | September | 2023
Construction
The GPS Clock Driver is built on a 97
× 55.5mm PCB, coded 19109221. It is
available from the PE PCB Service and
is shown in Fig.3. It was kept small
as there is often little space behind a
wall clock.
You can cut off the end section of
the Driver PCB containing two AA
cell holders if you want to use separately mounted batteries. That results
in a 64.5 × 55mm PCB that should fit
almost anywhere.
If cutting the board, do that before
fitting any components. Use a metal
ruler and a sharp craft knife to deeply
score the PCB on both sides deeply,
then snap the board apart and tidy up
the edge with a file.
The first component to solder is
IC3, the MCP16251 in a 6-pin SOT23 package. It is quite small but not
overly difficult with a steady hand.
First, determine its orientation. It has
a laser-etched dot on the top near pin
1, but it is faint, so it is easier to read
the four letters engraved on the chip
and use them for orientation.
You will need a x10 or more magnifier to read these letters (some smartphone cameras will do it too). The first
two should be ‘MB’, while the last two
can be anything. Pin 1 is at lower left
with the letters the right way up.
To solder the chip, first coat the PCB
pads with flux paste, then place a tiny
solder bump on a corner pad. Position
the chip and, while holding it down,
apply the iron to that pad.
With the first pin tack-soldered and
the chip held in position, check and
adjust the orientation of the other pins
before soldering them. Always apply
plenty of flux and use minimal solder
on your iron.
Next, fit the USB connector. This has
two small plastic posts on the underside
that go into two holes in the PCB to position it. Coat the pins and PCB pads with
flux gel and, with a small amount of solder on your iron’s tip, slide it across the
PCB pad to the connector’s pins. When
the tip of the iron hits the pin, the solder should magically flow around it.
With these small devices, it is easy to
create solder bridges between the pins,
but they can be removed using solder
wick (braid). Finally, check all joints
with a powerful magnifier (x10 or x20)
to ensure that each joint is correctly
soldered with no bridges. Don’t forget to solder the larger mounting tabs.
The inductor is the last SMD. Start
by placing a small solder bump on one
PCB pad, and then, while holding the
inductor in place, apply heat to that
pad. That should secure it in place.
Then, use rosin-cored solder wire to
solder the other lug before refreshing
the first solder joint.
The remaining components are all
through-hole types. Start with the
low-profile items like resistors before
moving on to higher-profile components such as the LED and cell holders. You can use IC sockets for IC1 and
IC2 as these will make removing the
device easy if you suspect it is faulty.
A clock using separately mounted C cells for power. C cells have a capacity
about four times that of AAs, so a lifetime of up to eight years is possible.
However, that will depend on the cells’ quality and their internal selfdischarge rate. The PCB is much smaller without the onboard cell holders.
23
Fig.3: assembly of the GPS Clock Driver is pretty straightforward. Start by soldering the three SMDs (IC3, L1 and
CON4) and check carefully that they all have good solder joints before fitting the through-hole parts. The cell holder
polarity is critical, while the LED needs to have its longer anode lead inserted into the pad labelled ‘+’. The ICs and
diode also need to be oriented correctly.
Like the ICs, LED1 and D1 are polarised, so they must be oriented as
shown in Fig.3.
The GPS module can be secured
to the PCB using double-sided adhesive foam tape. The ceramic antenna
should be on top, with the module’s
metal shield and label against the PCB.
Typically, the antenna should be
horizontal and facing the sky for the
best sensitivity. If you have the space,
you could separately mount the module with the antenna in this orientation. However, our tests showed that
the module worked just as well when
pointing to the horizon, mounted on
the PCB and attached to the back of
the clock.
The GPS module is supplied with
a connector and colour coded-leads
which go to the solder pads on the
right-hand side of the PCB. Trim the
leads to length and solder them to the
respective pads: ‘WH’ means white,
‘RE’ red, ‘BU’ blue and so on.
If using external cells, wire them
to the four ‘EXT BAT’ solder pads.
These can be used for terminating
soldered leads or a 0.1-inch 4-pin
header and socket.
Modifying the clock movement
The idea is to disconnect the clock’s
stepping motor coil from its control
board and connect two flying leads to
the coil. All clock movements are different, so we can only give you general
guidance here.
The process involves freeing the
clock’s movement from the clock housing, dismantling it, making the modification and reassembling it.
First, remove the housing holding
the front glass of the clock. Generally,
this is held in place with screws accessible from the back. Then remove the
hands. Generally, the second hand
is a friction-fit on a pin in the centre
of the shaft, so a gentle pull on this
should free it.
Next is the minute hand; in most
high-end clocks, it is held down with
a circular threaded nut. However, in
cheaper clocks, it is often a friction fit
The fully populated Driver PCB. The tactile switch for adjusting the second
hand is near the top edge, alongside the USB connector for configuring
the firmware. On the far top right are the inductor and other components
associated with the boost regulator that provides 4V for the GPS module.
24
on the minute hand shaft. The hour
hand is likely a friction fit on the
hour hand shaft and should be gently
pulled free.
With the hands removed, you will
find that the movement is held onto
the clock face with a hex nut on the
threaded shaft. Remove the nut and
it should come free. Some cheaper
clocks do not use a securing nut;
instead, the movement is held in place
by plastic clips on the rear of the clock.
Take photographs of the movement
and the layout of the gears before you
start dismantling it, then take additional photos as you progress. It is
very easy for the gears to fall out while
you are handling the movement, and
it will then be tough to reassemble it
without a guide.
In most cases, the movement will
have a top cover held on by clips to
the base. You can lever off these clips
to remove the cover and gain access
to the motor and gears. Inside, you
need to identify the motor’s coil (this
will be obvious) and the wires from
the coil, which will be soldered to the
PCB with the control chip (normally
under a blob of black epoxy).
The wires are very fine, so the best
method of disconnecting the control
chip is to cut one of the tracks leading from the coil’s termination on
the control PCB. You can then solder
your flying leads to the coil’s termination points and feed these out of
the movement – you will probably
need to drill a hole in the top cover
to do this.
Finally, reassemble the clock
and terminate the flying leads on a
2.54mm-pitch 2-pin crimp plug.
If you have a stepping movement,
you can test your work by connecting
a 1.5V AA cell across the leads and
reversing it. Every time you reverse
the cell, the clock should step by
one second.
Practical Electronics | September | 2023
Configuring the Clock Driver
By default, the Clock Driver is set up
for a stepping-type movement with
no daylight saving compensation.
If that is all you need, you can just
insert the cells and start the clock
running (see ‘Powering it up’ below).
Otherwise, you will need to configure the Driver.
Plug the USB connector into a computer or laptop and insert the cells. The
Clock Driver will connect to your computer as an asynchronous serial port
over USB, and the LED will flash three
times to indicate that the firmware
is working in configuration mode.
Ensure that fresh cells are installed;
partially exhausted cells may not be
able to deliver the correct USB signal
levels, causing errors.
The Driver imitates the Microchip
MCP2200 USB/serial converter. Windows 10 and 11 are delivered with the
correct driver installed, but for other
operating systems, you may need to
load a driver. You can find this on the
Microchip website: www.microchip.
com/wwwproducts/en/MCP2200
You will also need terminal emulator software to send your keystrokes
to the clock driver and display anything sent back. For Windows, the sotware we recommended Tera Term is:
http://tera-term.en.lo4d.com
This is free to download and use.
PuTTy is another popular emulator
that will also work.
The terminal emulator needs to
know the number of the virtual serial
port generated when the clock is connected. For Windows, you can find it
using Device Manager. Other details
such as the baud rate are unimportant
and can be ignored.
With everything set up, hit the
Enter key on your keyboard, and you
should see the configuration header
as in Screen 1.
The first question asked by the firmware is ‘Sweep (Y/N)’. If you type ‘Y’
then Enter, you will configure the clock
driver for a sweep movement. If you
enter ‘N’ instead, it will be configured
for a stepping clock movement.
The next question is ‘Use daylight
saving (Y/N)’, and if you reply ‘N’,
you do not have to do anything else; it
will save the settings and you will be
prompted to unplug the USB cable. If
you replied ‘Y’, you will need to enter
the specifications for the start and end
of daylight saving.
Configuring daylight saving
The firmware can cope with the daylight saving requirements for most
countries worldwide, although some
are just too complicated or vague (for
example, Iran’s). Table 1 shows the
Practical Electronics | September | 2023
Parts List – New GPS-Synchronised Clock
1 double-sided PCB coded 19109221, 97 × 55.5mm available from the PE
PCB Service
1 V.KEL VK2828U7G5LF GPS module or similar (MOD1)
1 32768Hz watch crystal (X1)
1 4.7μH 4.3A 6×6mm ferrite-cored SMD inductor (L1)
[eg, EPCOS B82464-A4]
1 4-pin low-profile tactile pushbutton switch (S1) [Altronics S1120]
1 2-way 2.54mm polarised right-angle header with plug and pins (CON1)
1 SMD mini type-B USB socket (CON4) [Altronics P1308]
1 6-pin header (CON5; optional)
2 PCB-mounting single AA cell holders (BAT1, BAT2) [Altronics S5029]
1 14-pin DIL IC socket (optional)
1 8-pin DIL IC socket (optional)
Semiconductors
1 PIC16LF1455-I/P microcontroller
programmed with 1910922A.HEX, DIP-14 (IC1)
1 MCP6041-I/P 600nA rail-to-rail input/output op amp, DIP-8 (IC2)
1 MCP16251T-I/CH DC-DC boost converter with disconnect, SOT-23-6 (IC3)
1 5mm red LED (LED1)
1 BAT85 30V 200mA schottky diode (D1)
Capacitors
2 10μF 16V X7R multi-layer radial ceramic [eg, TDK FK26X7R1C106M]
1 100nF 50V X7R multi-layer radial ceramic
2 22pF 50V C0G/NP0 radial ceramic
Resistors (all 1/4W 5% or better)
1 2.2MW
2 1MW
1 820kW
3 10kW
1 6.8kW
1 1kW
settings required for Australia and
New Zealand.
For both the start and the end of
daylight saving, you will need to enter
three numbers:
1) The month when daylight saving
starts/ends (1 to 12 – where 1 represents January).
2) The day of the week when daylight
saving starts/ends (with Sunday
being day 1).
3) The week of the month it falls in,
with 1 being the first week and 4
meaning the last week.
Then you will be asked for your time
zone. This should be entered as the
number of hours before or after UTC.
So, for example, Sydney and Melbourne are +10, Adelaide is +9.5 and
Los Angeles is –7.
When you press Enter after that, you
will see ‘Configuration Saved, Disconnect USB’. Disconnect the USB cable
and the clock driver will restart as if
the battery has just been connected (ie,
it will wait for the next precise half/full
hour then start running, as described
below). It will remember the settings
you have entered, so you never have
to re-enter them, even when replacing the cells.
Daylight saving starts at 2:00am and
ends at 3:00am. The one exception is
the United Kingdom, where it needs
to start/end one hour earlier. The firmware determines if the clock is running
in the UK by checking the time zone
offset, which is zero in the UK.
Powering it up
All you need to do is set the hands to
the next half hour or full hour (whichever is closest) and insert the cells,
then hang the clock back on the wall.
The clock will wait until the next
half/full hour is reached and automatically start running. From then
on, it will keep precise time until the
battery is exhausted.
Do not put cells into the clock’s
movement. The GPS Clock Driver
wholly replaces the controller board
inside the movement, so it does not
need to be powered.
The onboard LED informs you of
the progress during the startup process. When the cells are inserted, the
LED flashes twice to indicate that the
microcontroller and firmware are running. The firmware then powers up
the GPS module, flashing the LED
briefly at 1Hz while it is searching
for satellites.
When the GPS module has a lock
(ie, it has the accurate time), the LED
will change to a long flash every second. Finally, when the clock starts
running, the LED will turn off.
With a new GPS module, it can
take some time (up to 45 minutes)
to find enough satellites. That delay
might result in the clock starting at
the wrong time. So, when you first
use the clock, keep an eye on when
it gets a satellite lock and readjust
the hands if necessary. Once the GPS
module has its first lock on the satellites, it is generally much faster, with
25
GPS Clock Driver v1.0
Sweep Clock (Y/N) ? Y
Use Daylight Saving (Y/N) ? Y
Start Daylight Saving Month (1-12) ? 10
Start Daylight Saving Day (1=Sun) ? 1
Start Daylight Saving Day in Month (1 to 4=Last) ? 1
End Daylight Saving Month (1-12) ? 4
End Daylight Saving Day (1=Sun) ? 1
End Daylight Saving Day in Month (1 to 4=Last) ? 1
Time Zone (-12.5 to +12.5) ? +10
Configuration Saved
Unplug USB ❚
Screen 1: configuring the clock driver using the USB interface. In this case,
sweep clock drive has been selected and daylight saving has been configured to
suit NSW/Vic/Tas/ACT. These settings are remembered, so you never have to reenter the configuration details, even when replacing the battery.
subsequent attempts typically taking
under a minute.
Adjusting the second hand
All clock movements allow you to
adjust the hour and minute hands,
but the second hand will probably not
be at the 12 o’clock position and will
be stuck somewhere around the dial.
To correct this, you can hold down
the tactile switch on the PCB while
the clock is waiting to start, and the
firmware will drive the second hand
around the dial. Release it when it
reaches the 12 o’clock position.
That way, the clock will start with
the second hand indicating the correct second.
A problem with some movements
is that when the clock starts running,
the movement might start driving
the hands a few seconds early or
late. While not a big deal, you can
adjust for even this slight error while
the clock is running. Hold down
the tactile switch when the clock is
running until the LED illuminates.
If you then immediately release the
button, the firmware will advance
by one second.
On the other hand, if you keep
holding down the button until the
LED goes off again before releasing
it, the firmware will retard the hands
by one second.
Remember that a sweep clock will
need eight seconds to gain or retard
its hands by one second. So, if using
a sweep movement, you should wait
for a while to check the effect of
the last adjustment before making
another one.
You can verify your clock is accurate using a time source such as
www.time.gov which will give you
the exact time to the second – even
compensating for delays over the
Internet. With this as your reference, you can use the tactile switch
26
to bring the second hand to an exact
agreement with this source and compensate for any starting error.
You should correct for any startup
error immediately after the clock
has started running. This is so that
you do not inadvertently adjust for
an error in the crystal’s frequency,
which will be automatically corrected by the firmware after the first
12 hours of running, following the
second GPS synchronisation.
All clock movements use a type of
stepping motor that is locked to the
pulse train delivered by the microcontroller. So, once the hands are
accurately set, they will never lose
or gain a second unless the battery is
exhausted or the movement is faulty.
Therefore, in the normal scheme of
things, you should never have to
adjust the clock again after compensating for any initial startup error.
Troubleshooting
To test your clock, insert the cells
and observe the LED sequence as
described above. Hopefully, it will
run through the starting sequence,
and the clock will start running. If
it does not work as expected, use the
LED to help track down the problem.
The LED should flash twice when
the cells are inserted (and the USB
is not connected). If that does not
occur, the fault could lie with the
cells, the microcontroller or the LED.
Check that the LED is the right way
around and that it works before looking for other causes.
If you do not see the double-flash,
check the voltage between pins 1 and
14 of the microcontroller. It should be
the same as the battery voltage (3.2V
with new cells). If that is OK, check
the microcontroller. Is its orientation
correct? Has it been properly programmed? If you used an IC socket,
check that it is properly inserted,
with no pins folded underneath.
After the double flash, the firmware will power up the GPS module.
Within a few seconds, you should
see a brief flash every second on
the LED indicating that data is being
received from the module. If you do
not see this flash, the problem could
be with the boost voltage regulator
or the GPS module.
Check the voltage between ground
and the red wire to the GPS (marked
RE on the PCB). It should be about
4V; anything else indicates a problem with the regulator and its associated components.
If the regulator is OK, the fault
must be with the GPS module. Check
that it is connected correctly and that
it uses one of the supported serial
communication speeds (4800, 9600
or 19,200 baud).
GPS satellite lock
After a while, the GPS module will
get a lock on sufficient satellites to
obtain an accurate time. When that
happens, the boost regulator will
shut down and the LED will change
to a long flash every second. Usually
this will be within a minute or two,
but it could take some time.
There might not be a strong
enough signal to get a lock. Take the
clock outside and place it so that
the antenna is pointing directly at
the sky, and leave it that way for at
least an hour.
Typically, if the GPS module could
gain a lock when you inserted the
Table 1 – DST rules for AU and NZ (not observed in Qld, NT and WA)
NSW, Vic, Tas and ACT South Australia
New Zealand
Start month
10
10
9
Start day
1
1
1
Start day in month
1
1
4
End month
4
4
4
End day
1
1
1
End day in month
1
1
1
Time zone offset
+10
+9.5
+12
Practical Electronics | September | 2023
cells, it should be able to get a lock
on subsequent synchronisations.
However, a marginal signal level or
moving the clock might change that.
When the cells are inserted, the
firmware will wait forever to get a
GPS signal. However, after that first
time, the firmware will wait for just
30 minutes to get a signal and then,
if unsuccessful, it will give up and
retry in 24 hours. To indicate this,
the LED will then flash briefly every
second until a subsequent attempt
is successful and an accurate time
is obtained.
If you find that your clock is inaccurate, check the LED. If it is flashing, that indicates there was an insufficient GPS signal to get the accurate time.
If you find that you are getting a
short battery life, check the voltage
of the exhausted batteries when you
replace them. Most movements will
keep going down to 1.0V. If it stops
at a voltage significantly higher than
that (say 1.2V), the movement has too
much friction and should be replaced.
We experienced this with a cheap
movement that failed after a few
years, so it might be prudent to purchase a spare movement (or clock) as
a backup in case you need to swap
out an old movement. That way, you
The inside of a typical wall clock movement modified for our GPS Clock
Driver. The motor coil is at upper right while the blue control board is on
the left, with a blob of black epoxy hiding the control chip. This has been
disabled by cutting a PCB trace, and flying leads have been soldered to the
motor coil termination points.
are guaranteed a replacement that
will fit your clock and accept the
same hands.
Teach-In 8 CD-ROM
Exploring the Arduino
Reproduced by arrangement with
SILICON CHIP magazine 2023.
www.siliconchip.com.au
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 8
FREE
CD-ROM
SOFTWARE
FOR
THE TEACH-IN
8
SERIES
FROM THE PUBLISHERS OF
This CD-ROM version of the exciting and popular Teach-In 8 series
has been designed for electronics enthusiasts who want to get to
grips with the inexpensive, immensely popular Arduino microcontroller,
as well as coding enthusiasts who want to explore hardware and
interfacing. Teach-In 8 provides a one-stop source of ideas and
practical information.
The Arduino offers a remarkably effective platform for developing a
huge variety of projects; from operating a set of Christmas tree lights
to remotely controlling a robotic vehicle wirelessly or via the Internet.
Teach-In 8 is based around a series of practical projects with plenty of
information for customisation. The projects can be combined together
in many different ways in order to build more complex systems that can
be used to solve a wide variety of home automation and environmental
monitoring problems. The series includes topics such as RF technology,
wireless networking and remote web access.
PLUS: PICs and the PICkit 3 – A beginners guide
The CD-ROM also includes a bonus – an extra 12-part series based around the popular
PIC microcontroller, explaining how to build PIC-based systems.
£8.99
INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
• Programming – powerful integrated development system
• Microcontrollers – understand control operations
• Communications – connect to PCs and other Arduinos
PLUS...
PIC n’MIX
PICs and the PICkit 3 - A beginners
guide. The why and how to build
PIC-based projects
Teach In 8 Cover.indd 1
04/04/2017 12:24
PRICE
£8.99
Includes P&P to UK if
ordered direct from us
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
ORDER YOUR COPY TODAY!
JUST CALL 01202 880299 OR VISIT www.epemag.com
Practical Electronics | September | 2023
27
|