This is only a preview of the July 2025 issue of Practical Electronics. You can view 0 of the 80 pages in the full issue. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Items relevant to "180-230V DC Motor Speed Controller":
Articles in this series:
Items relevant to "Repurposing the Mains Power-Up Sequencer":
Articles in this series:
Items relevant to "Intelligent Dual Hybrid Power Supply,.Part 2":
|
Constructional Project
PROJECT BY TIM BLYTHMAN
This handy, portable, rechargeable
device combines a clock, timer and
stopwatch and can display different
time zones. It has an internal crystal
and incorporates a WiFi time
source, so it is always accurate,
even if a leap second occurs.
COMPACT
OLED CLOCK/TIMER
Y
OU MIGHT THINK THAT WHAT THIS
CLOCK/TIMER does could easily be
done by an app on a smartphone,
and you are probably right. In fact,
many of the ideas we have for electronic projects are dismissed because
they could be ‘just an app’.
However, there is a good reason
to make the Clock/Timer a separate
device. My wife runs a business where
she needs to keep track of time spent
with clients.
Using a phone app to do that tends
to drain the phone’s battery and makes
it difficult to use the phone for other
purposes.
So, a separate device that can keep
track of time has its place. The Compact OLED Clock and Timer also makes
it easier to keep track of time in different time zones. This is another
handy feature if you arrange appointment times with people in different
locations.
It has an alarm feature that is tied to
a ‘home’ timezone. This means that if
you are travelling, you can be alerted
each day at the same time in that zone,
even if you are using the Clock to see
the local time in a different time zone.
This feature is notably absent from
most clock apps.
There are countdown timer and
stopwatch functions that can work in
the background. For example, you can
set the countdown timer running and
then switch to the clock or stopwatch.
The timer will still alert you when it
is finished.
Internally, time is kept by a watch
crystal. An integrated WiFi time source
is also used to keep the time updated
OLED Clock & Timer Features & Specifications
»
»
»
»
»
»
»
»
»
»
»
»
14
Clock with multiple time zones
Automatic daylight saving adjustments
Alarm with day and repeat options
Countdown timer up to 99 hours
Stopwatch up to 99 hours
Rechargeable 600mAh battery
Battery charging and status display
OLED screen with adaptive brightness
Resolution: one second
Crystal timekeeping backed by integrated WiFi time source
Current draw: 15-20mA during operation, 5mA with screen off
Current draw during WiFi operation: up to 80mA (typically for 30s per day)
and trim out any crystal errors. Time
is kept to the nearest second, so you
should never be more than a few seconds out.
Compact case
The clock fits in a UB5 Jiffy box and
its blue front panel is the back of the
PCB that hosts most of the components.
Its user interface comprises a small
OLED screen that shows through a hole
in the PCB/panel, and four pushbuttons to control its functions. As most
of the parts are surface-mounted, there
are no solder joints on the front.
We think this size and shape work
well for a clock. The box can sit on its
edge with the display clearly visible,
but it is also unobtrusive.
While the form factor is similar, this
design uses a different processor from
the Pico Audio Analyser, and the circuitry is quite different.
Circuit details
The complete circuit diagram of the
Clock/Timer is shown in Fig.1. Instead
of a Pico microcontroller board, it is
controlled by a PIC16F18146 microcontroller (IC1). Since this IC is capable of low-current operation, we can
dispense with the complexity of providing an on/off switch.
Microcontroller IC1, in combination
with 32768Hz crystal and its two 4.7pF
load capacitors, is responsible for timekeeping. IC1’s oscillator can remain operating even when it is in deep sleep
Practical Electronics | July | 2025
OLED Clock and Timer
Fig.1: microcontroller IC1 keeps time with crystal X1 and displays it on OLED screen MOD1 by updating it over
an I2C serial bus. IC1 can also control the power supply to all other components, keeping the idle current low. The
battery is kept charged by IC2, which also drives LED1 to display the charge status.
power-saving mode so that it continues
to keep track of the passage of time.
IC1 also drives OLED screen MOD1
via an I 2C serial bus to update the
display. The display’s power supply
comes from digital output RB4 of IC1
(pin 13), so it is powered down when
not in use by pulling that pin low or
powered by bringing it high. The I2C
bus pullup resistors are on MOD1; IC1
uses ‘bit-banging’ to drive SDA and
SCL since high-speed data transmission is not required.
MOD2 is a Raspberry Pi Pico W
board programmed as a WiFi time
source with an NMEA output compatible with GPS modules. We previously described how that works in
the June 2024 article on a Wi-Fi Time
Source for GPS Clocks. Important to
the operation of the circuit is that the
Pico W has a schottky diode between
its VBUS pin, pin 40 (anode) and its
VSYS pin, pin 39 (cathode).
This diode feeds microcontroller IC1
Practical Electronics | July | 2025
when USB power is available since it
will supply a higher voltage than the
battery via schottky diode D1. This arrangement removes the load from the
battery while it is charging, allowing
it to charge fully.
The remainder of IC1’s various I/O
pins manage the clock functions and
user interface. A 10kW resistor pulls up
IC1’s reset pin 4 to allow normal operation, except when a programmer is
connected at optional ICSP (in-circuit
serial programming) header CON2.
Four tactile pushbuttons, S1-S4,
connect to pins 8, 16, 12 and 11 of
IC1. These pins are set to have internal pullup currents, so the closure of
the pushbuttons can be detected when
the pin is pulled to ground. Pin 17 is
connected to piezo transducer SPK1
to create alarm sounds.
Pin 13 of IC1 also powers a divider formed by the 1MW resistor and
LDR1. The 100nF capacitor smooths
the resultant voltage and provides a
low-impedance input to IC1’s ADC
(analog-to-digital converter), sampled at pin 10 to measure the ambient light level.
Pin 9 connects to the 3V_EN pin of
MOD2. When this is pulled low by
IC1, the 3.3V regulator on the Pico W
is disabled and MOD2 is shut down.
If it is allowed to float, it is weakly
pulled up by the Pico W so it can operate. IC1 can thus choose to enable
the time source only when needed.
The NMEA data stream from pin 1
on MOD2 is fed to pin 5 of IC1 via a
10kW resistor. Software running on IC1
decodes this data, including the time
the time source has obtained via NTP.
By comparing an internal 2.048V reference to its supply voltage, IC1 can also
monitor the battery level or note that
USB power is being supplied.
IC1 can shut down all of the surrounding circuitry by bringing its pins 9
and 13 low. The normal operating current draw is dominated by the OLED
15
Constructional Project
Screen 1: the initial screen; if you see
the “NO DATA” message for more than
a few seconds, check that the WiFi
time source’s LED is on or flashing.
Once the time has been acquired,
check that IC1 has shut it down. The
battery life will be severely affected if
the Pico W does not shut down.
Screen 2: this will briefly appear to
show that the time has been updated.
The Clock/Timer can be powered from
the Pico W’s USB socket, allowing
you also to use the time source’s USB
interface for debugging. The 5V lines
of the sockets are joined, so don’t plug
into both simultaneously.
Screen 3: the Clock mode display. The
default time zone is Sydney (the same
as Melbourne, Canberra and Hobart).
To access the settings, press and hold
the MODE button until SETTINGS
appears on the screen. All settings are
kept in EEPROM and generally take
effect immediately.
module, except for the brief periods
when MOD2 is enabled.
Mini Type-B USB socket CON1 provides 5V power to the circuit. It goes
directly to IC2, an MCP73831 Li-ion
battery charging IC. 10μF bypass/filter
capacitors are provided for its input
and output, while the 10kW resistor on its PROG pin sets the battery
charge current to 100mA. The battery is connected to the BAT+ and
BAT− pads.
IC2 also provides a status indication at its STAT pin. Bicolour LED1
connects between the STAT pin and
a pair of 1kW resistors between the
5V rail and ground. The STAT pin is
low during charging and the red LED
is driven. When charging is complete,
the STAT pin goes high, allowing the
green LED to light.
When 5V power is unavailable, the
STAT pin is high-impedance and LED1
does not light. The power from the battery feeds IC1 via schottky diode D1.
IC1 is powered at pins 1 and 20, with
the standard 100nF bypass capacitor
across them.
an outline resembling a battery icon.
We have designed the front panel
PCB to sit over the edge of the enclosure rather than recess into it. This
makes the Clock slightly deeper, giving
more room for the battery and other
components.
While we generally use USB-C
sockets for power these days, we have
stuck with a mini Type-B USB socket
here to save a little more space; the
USB-C sockets require two extra resistors to communicate the role of
the device.
The various headers connect via
surface-m ounting pads, allowing
wires to connect to devices in the
space behind the PCB. The battery
and speaker are both on flying leads
to allow this.
PCB arrangement
We’ve crammed an awful lot into
a small enclosure, so we’ve opted for
some creative assembly options. The
pushbuttons and OLED display are
reverse-mounted to protrude or show
through the PCB that also forms the
enclosure’s front panel.
The LDR peeks through a hole in the
front of the case too, while the LED
shines through the PCB substrate from
the back of the panel. We’ve used the
copper layer and solder mask to create
16
Parts List – OLED Clock and Timer
1 double-sided PCB coded 19101231, 83 × 53mm
1 UB5 Jiffy box (83 × 53 × 30mm) [eg, Mouser 563-CU-1941]
1 single AA cell holder with flying leads
1 14500 (AA-sized) Li-ion rechargeable cell with nipple
(LiFePO4 type recommended)
1 1.3-inch (33mm) OLED module (MOD1) [Silicon Chip SC5026 or SC6511]
1 Raspberry Pi Pico W programmed as WiFi Time Source for GPS Clocks
(MOD2) [Firmware: siliconchip.com.au/Shop/6/188]
4 reverse-mount SMD tactile switches (S1-S4) [Adafruit 5410]
1 SMD mini-USB socket (CON1)
1 5-pin male header, 2.54mm pitch (CON2; optional, for ICSP)
2 4-pin male headers, 2.54mm pitch (for MOD2)
1 single-pin header (for MOD2)
1 100kW (light) to 10MW (dark) 5mm LDR (LDR1)
1 32768Hz watch crystal (X1)
1 passive piezo element (SPK1) [eg, DigiKey 433-PT-1306T-ND]
1 small tube of neutral-cure silicone sealant or similar
4 small self-adhesive rubber feet (optional)
Semiconductors
1 PIC16F18146-I/SO microcontroller programmed with 1910123A.HEX,
SOIC-20 (IC1)
1 MCP73831-2ACI/OT Lithium battery charge regulator, SOT-23-5 (IC2)
1 SS34 40V 3A schottky diode, DO-214 (D1)
1 bi-colour red/green 3mm LED (LED1)
Capacitors (all M3216/1206 size, X7R ceramic unless noted)
2 10μF
2 100nF
2 4.7pF C0G (to suit crystal X1)
Resistors (all M3216/1206 size, 1% ⅛W)
3 10kW
2 1kW
1 1MW
Practical Electronics | July | 2025
OLED Clock and Timer
Screen 4: the OK button will cycle
through the available fonts used for
all large time displays. The UP and
DOWN buttons trim the horizontal
position of the display. Adjust the
position until the box characters in
both lower corners look the same as
the one between the arrows.
Screen 5: MODE cycles between the
SETTINGS pages. GPS refers to the
time source; its maximum runtime
can be set on this page. You can
manually trigger a time update with
the OK button. The TRIM value is
zero initially but will update as the
timekeeping is adjusted daily.
Screen 6: test tones are played while
this screen is showing. Press OK to
toggle between the alarm clock tone
and the countdown tone, then use
the UP and DOWN buttons to choose
which tone to use for each. If you
don’t hear a tone, there may be a
problem with your piezo speaker.
The Pico W only needs connections
on a handful of its pins; it is mounted
behind the OLED module. The design
of the time source puts all of its active
pins at one end, which helps everything fit into the case.
ered up. This can be handy for reprogramming the Pico W or changing the
WiFi time source settings.
With a small amount of flash memory
spare in the chip, we have added alternative fonts to provide some novelty to
the main timekeeping display. There
are also six different alarm tones, so
you can choose your preferred alert
sounds for the clock alarm and countdown timer.
These sounds are provided by combining a PWM signal with a UART
(serial data) signal through the CLC peripheral. The rise and fall of the serial
data modulates the signal, giving different tone patterns. Once the pattern
is activated, it plays with no further
processor input.
The details of the software operation and user interfaces will be discussed later.
soldering the chip to the board if you
have the right gear. Our PIC Programming Adaptor article from September
2024 includes examples of SMD-to-DIP
adaptors that can be used to do this.
Otherwise, you will have to make
a temporary connection to the CON2
ICSP header after the chip is installed.
You can see a header in some of our
photos; this is what we fitted to CON2
to help with repeated programming
during software development.
Programming the Pico W module
can be easily done before or after soldering it. Simply connect it to a computer using a standard USB cable. See
the panel on setting up the WiFi time
source for more details.
Software
The watch crystal is used by a timer
on IC1 to generate an interrupt once
every second, making accurate timekeeping a priority. Every second, the
clock is advanced; if the timer or stopwatch is active, they are also updated.
It keeps track of time internally as
UTC (universal coordinated time) and
calculates offsets based on the time
zone and daylight saving status. While
the inbuilt time zones are for Australia
and New Zealand, since the designer
lives in Australia, it also has a custom
timezone that can be set to any time
zone that is a multiple of 15 minutes
from UTC/GMT (we aren’t aware of
any that are not).
The clock can display the current
time in any of the time zones by selecting them. A ‘home time zone’ is selected, which is used to check the alarm.
Every 24 hours, the WiFi time source
is activated and the time is checked
and updated (if necessary).
The Clock/Timer also checks how
much drift has occurred and provides an internal correction for up
to 24 seconds of drift per day. Watch
crystals are typically well within that
tolerance.
The WiFi time source can also be
manually activated. A switch in the
settings menu allows the Pico W that
acts as the WiFi time source to be powPractical Electronics | July | 2025
Programming the chips
If your PIC16 microcontroller (IC1) is
not programmed, you might
find it easier to do it before
Construction
The Clock/Timer is built on a double-
sided PCB coded 19101231 that measures 83 × 53mm. The design necessitates surface-mount construction, so
you will need the usual surface-mount
gear such as a fine-tipped soldering
iron (a medium tip can be
The SMD parts are
fitted conventionally,
although we
recommend
splaying the leads
of S1-S4 so their
stems project
more through
the panel. Note
how we’ve
fitted leaded
parts like the crystal,
LDR and LED. At this stage,
the board can be powered from CON1
and (with IC1 programmed) you can confirm
that the OLED and pushbuttons work.
17
Constructional Project
Screen 7: the alarm clock is always
based on the HOME timezone, which
can be set here. Pressing OK also
allows you to set the parameters for
a custom time zone, including the
default offset and when daylight
saving starts and ends. This defaults
to Greenwich Mean Time (GMT).
Screen 8: the last SETTINGS screen
lets you return to regular operation
and manually power the time source
on and off with the UP and DOWN
buttons. This is handy if you ever
need to change the settings on the
time source or update its firmware. It
switches off when you exit SETTINGS.
Fig.2: the PCB is populated mainly with surface-mounting components, plus a
handful of through-hole parts fitted in surface-mounting fashion. This figure is
shown at 140% of actual size for clarity.
18
Screen 9: this shows an alternative
font. The available time zones can be
viewed by pressing the UP and DOWN
buttons while the clock is showing.
Pressing OK toggles between a 12-hour
(AM and PM) or 24-hour clock. AM
is shown by the letter A, PM by P and
24-hour mode with no letter.
OK if you have some experience), flux
paste, solder-wicking braid, tweezers,
a magnifier and a good light source.
You should have some sort of fume
extraction gear; a fan close to your workspace pointing out an open window
may be sufficient. You could also
work outside or right next to an open
window, which might also help with
illumination.
Note that some through-hole components are fitted in a surface-mounting
fashion. You can get an idea of how
these are installed by examining Fig.2,
the PCB component overlay diagram,
and the photos of the partially and
fully populated PCB.
Start by soldering IC1 and IC2. IC1
must have its pin 1 marker aligned
with that on the silkscreen, while IC2
will only fit one way as it has two pins
on one edge and three on the other.
Apply flux to the PCB pads and rest
the chips in place.
Tack one lead on each and check
that the pins are aligned with the pads
before soldering the others. If solder
bridges form across any pin pairs, apply
more flux and use the braid to draw
out the excess.
Fit CON1 next. It has plastic locating lugs on its underside, making it
easy to position. Solder the smaller pins and confirm that the part is
flat against the PCB, then secure the
larger pins with a generous amount
of solder to ensure that the connector is firmly attached.
There are three different capacitor values (two of each), so do not
mix them up, as they will not be
marked with their values. Like the
Practical Electronics | July | 2025
OLED Clock and Timer
Screen 10: the alarm symbol in the
upper-right corner flashes while the
alarm is sounding. Pressing OK stops
the alarm. The top of the screen shows
the battery status (voltage) display if
USB power is not available. During
a WiFi time source update, this will
show “GPS”.
Screen 11: pressing MODE switches
to the Countdown Timer; you can
then press OK until the SET screens
appear. The UP and DOWN buttons on
these screens change the clock’s hours,
minutes and seconds. The TIMER
PAUSED status is shown when the
timer is ready to start counting down.
Screen 12: pressing OK after setting
the countdown time returns to the
main Timer screen. Pressing UP will
start (or resume) the Timer or pause it
if it is running. DOWN will reset the
Timer if it is paused or has expired.
This screen shows the third font that’s
available (refer to Screen 4).
other parts, use some flux and tack
one lead in place.
Confirm that the position is correct
and that the first joint has solidified
before soldering the other lead. Refresh
the first lead if necessary (eg, with a
touch of flux paste).
Follow by fitting the resistors similarly, then move on to D1, the schottky
diode. Ensure that its cathode stripe is
towards the K marking before soldering it. If this diode is reversed, power
from the USB socket could feed directly into the battery, which would
be catastrophic!
Next, mount the three through-hole
components. Keep the lead offcuts from
these, as they can be used to mount the
OLED module later. Look closely at the
photos since they are all arranged in a
specific way.
Crystal X1 is fitted so that it can be
glued against IC1 later. It is not polarised, so it does not matter which lead
goes to which pad. Splay the leads
slightly to suit the pad spacing and
bend them in an arc. They might also
have to be trimmed. Once you have
the leads adjusted, solder one to its
pad, then tweak the leads if necessary
before soldering the other lead.
For LDR1, trim one lead to around
5mm and bend it in a 180° arc. You can
leave the other lead at its full length to
ease handling. Press the LDR into the
hole and tack the short lead in place.
Adjust the position and orientation, if
necessary, with the aim of having the
front of the LDR flush with the outside of the PCB.
Then cut down the other lead and
bend it into position over the other
pad. Solder the second lead and refresh the first if necessary.
LED1 is a bit more tricky. The K cathode marking refers to the green LED
of the bicolour device. So it’s best to
test the LED as some are marked (with
the flat or longer lead) with reference
to the red LED instead. Set a DMM on
diode test mode and probe the leads.
The red probe will indicate the anode
of whichever colour LED lights up, and
the black lead (cathode).
Bend the leads in the shape shown in
the photos so that they reach the pads
below. We’ve left quite a bit of lead
on our prototype to make it easier to
position and aim the LED so it shines
towards the cutout in the solder mask
on the back of the PCB.
The finished board,
ready to be mounted in the case. The
Pico W for the WiFi time source is mounted over the
back of the OLED screen while silicone sealant secures the battery leads.
We attached our piezo with header pins, but you can use flying leads. We
inserted standard headers from the top of the Pico W’s PCB so it would sit at the
right height. Note the single-pin header on the right to add some mechanical strength.
There is about 2mm between the Pico W and the OLED module underneath it.
Practical Electronics | July | 2025
19
Constructional Project
Screen 13: when the Timer finishes,
you will see the hourglass symbol
flashing in the corner of the display
and hear the Timer tone. Press DOWN
to stop the alert and reset the Timer.
The Alarm and Timer icons and tones
will occur in any operating mode
except possibly SETTINGS.
Screen 14: the Stopwatch is much
simpler than the other modes. It
is started, resumed or paused by
pressing the UP button and can be
reset while paused with the DOWN
button. The timings are only updated
every second by the timer interrupt.
Screen 15: pressing MODE takes you
to the Alarm clock setup. Press OK to
cycle between the options, with UP
increasing or enabling the setting and
DOWN decreasing or disabling it. You
can set the time to the nearest minute,
choose days of the week, whether the
alarm repeats and whether it is on.
Cleanup
doing this, ensure the OLED is square
and symmetrical within the cutout.
At this stage, the assembly should
look like the earlier partially completed PCB photo. The circuit is complete
enough to do a basic test. If you still
need to program IC1, do so before proceeding.
It is safe to apply power to the circuit
via the programming header, CON2.
Alternatively, you can apply power
to the board by plugging a USB cable
into CON1. The OLED should light
up, and the LED will probably show
both red and green because no battery
is attached.
Check the voltage on the BAT+ terminal relative to BAT− (which is also
circuit ground). It should be no more
than 4.3V. If there are any problems,
verify that diode D1 is correctly orientated.
The display will show a countdown
from 60 seconds. If the countdown is
not proceeding, there may be a problem with crystal X1.
a sharp hobby knife to trim the hole to
fit the USB socket comfortably.
Check that no parts prevent the PCB
from sitting flush against the case.
We’ve squeezed everything in tightly, but nothing should stop the case
from closing.
If you have soldered a header to the
CON2 ICSP pads, that could clash with
the pillar inside the case. We found
that trimming the plastic on the header
was enough to prevent that, but you
might consider removing the header
if you only fitted it for programming
IC1 initially.
Now is a good time to clean off any
flux residue and closely inspect the
board before proceeding to the next
step. Use your flux’s recommended
solvent or some isopropyl alcohol to
dissolve the flux and then allow the
board to dry thoroughly.
Scrutinise the board with a magnifier to double-check that everything
is soldered correctly and that there
are no bridges. IC2 and CON1 have
closely spaced pins, so look at them
carefully.
Next, fit tactile switches S1-S4. The
reverse mounting types are pretty nifty,
but they will benefit from having their
leads splayed back slightly to give the
switch stems a bit more length projecting through the front of the PCB. Tack
one lead on each switch in place and
tweak the position so that they are centred in their holes.
It’s worth spending some time getting this right, as it looks much better
with the stems centred. It also eliminates the possibility of the stems
binding. When you are happy, use
a generous amount of solder to mechanically secure all four leads on
each switch.
The next job is fitting OLED module
MOD1. Attach a lead offcut to each of
the four small PCB pads for MOD1,
then thread the OLED over them, ensuring that the protective film is removed and the module is flat against
the main PCB.
Solder the offcuts to the main PCB.
The two large holes along the lower
edge can be similarly attached to the
large pads on the PCB below. Before
20
Setting it up
If you haven’t already done so, prepare the WiFi time source according
to the instructions in the panel opposite. It’s possible to program a Pico W
in place or even modify its settings,
but this is done more easily before it
is attached to the PCB.
Male header strips are used to solder
Case cutting
The only necessary hole in the case
is to allow the USB socket, CON1, to
protrude out the side. Fig.3 shows the
measurements, but this one is relatively easy to do by eye, especially if
you use a transparent case like ours.
Rest the PCB just inside the case with
the USB socket against the wall of the
case. You should be able to mark the
outline of the socket using a pencil
or similar.
Perform the downward cuts most of
the way and then carefully flex the tab
formed by the cuts. You can then use
Fig.3: it is easy to cut out the small
rectangular region for the USB socket
by eye, allowing you to make it a snug
fit. Here are the suggested dimensions
of the cut if you wish to measure it out
first (viewed from outside the box). All
dimensions are in millimetres.
Practical Electronics | July | 2025
OLED Clock and Timer
the Pico W to the PCB. Locating it
behind the OLED module is the only
way to get enough clearance to also fit
the battery inside the enclosure. The
bottom of the Pico W should be about
5mm above the PCB, leaving about a
2mm gap between the OLED module
and the Pico W.
We achieved the correct height on our
prototype by soldering the pin headers
with the plastic shrouds above the Pico
W’s PCB. You can see the remnants of
the shrouds in the photos (we trimmed
off the tops of the pins).
Solder the two rows of four-pin
headers to the USB end of the Pico
W, keeping the pins square. Check
that your positioning allows enough
space to plug a USB cable into the
Pico W; the cable’s bezel should just
clear the CON1 USB socket on the
main PCB.
Solder the tips of one of the pin
headers to the main PCB and check
that everything is aligned. Next, solder
the single-pin header from pin 20 of
the Pico W to the main PCB. There is
a pad for this adjacent to D1.
When everything looks correct, you
can proceed to add a fillet of solder
from each of the Pico W pins back
to the main PCB, securing it. Trim
any excess height from the pins to
give the battery as much clearance
as possible.
Solder the battery holder to its terminals marked BAT+ and BAT−, taking
great care that the polarity is correct.
The way we installed the battery holder
in the case allowed us to shorten the
red (BAT+) wire.
Also solder the piezo element to the
SPK1 pads. We used header pins, but
you could use flying leads (such as offcuts from the battery leads) to allow
the piezo to be glued to the case. In
that case, we also recommend drilling
a hole in the case to enable the sound
to escape.
Now glue the battery holder into
the case as shown in the photos. Also
apply neutral-cure silicone sealant to
the BAT+ and BAT− terminals to insulate the pads and secure the wires
mechanically.
If you have the piezo on flying leads,
glue it to the case now. You can also
add a dab of glue to the crystal to secure
it to the top of IC1. After that, wait for
all the adhesive to cure fully.
Now insert the battery into the
holder. The screen should light up,
and you should see the LED on the
Practical Electronics | July | 2025
Setting up the WiFi time source
The June 2024 project article for the Wi-Fi Time Source for GPS Clocks details how
the time source works, but this overview should have enough information for you to
set it up.
You will need a Raspberry Pi Pico W microcontroller board programmed with the time
source firmware, which can be downloaded from siliconchip.au/Shop/6/188
Hold the white BOOTSEL button of the Pico W while connecting it to a computer. This
will put it into bootloader mode, and you should see a drive named “RPI-RP2” appear.
Copy the “NEW_CLAYTONS_1.uf2” file to that drive to upload the firmware.
If all is well, the LED on the Pico W should light up, the drive should disappear, and
you will have a virtual USB serial port available. Use a serial terminal program like Tera
Term on Windows to connect to the port (you could use minicom on Linux).
Set the terminal to use CR or CR+LF as the line ending and press Enter. It should then
show the status and command menu. The following is not a comprehensive overview of the
time source’s capabilities, but it will be sufficient to program it for use with the Clock/Timer.
Use command 9 (press the 9 key followed by Enter) and then enter the two-letter
country code (eg AU, NZ, US, UK etc). If you are likely to use the Clock internationally,
the global “XX” setting is safest.
Next, use command 8 (8, Enter) to save that setting to flash and follow with command
J (capital J, Enter) to reboot the time source. This ensures the WiFi radio is initialised
with the correct country code at power-up.
Use command 1 to run a scan of WiFi networks. The nearby networks should be
listed with a number next to each one. Then run command 4 with one of the listed numbers as a parameter. For example, if your home WiFi network is listed first, as number
0, type 40, then Enter.
You will then be prompted for the password; type it, then press Enter again. Use command 7 to test the network and, if all is well, use command 8 to save the settings to flash
memory. Use J to reboot again and check that the time source connects to the network.
The LED should change from solid to flashing when it successfully connects to a network. Flashes occur in groups of three if everything is working and the time has been
acquired from the NTP service. You can add multiple networks by running commands
1, 4, 7 and 8 when in the vicinity of each network.
If you see groups of three flashes, the time source is working as expected. If you
run into problems, you can also examine the output and debugging data to determine
the source of the problem. Many other settings are available, but there is little need to
change any of them. The Compact Timer has been designed to work with the WiFi time
source’s default configuration.
With the important pins at one end of the Pico W, near the USB connector, it’s
easy to connect to the Clock/Timer PCB without using up much space. Pins
1, 3, 37, 38, 39 and 40 are used in the circuit, while pins 2, 4 and 20 are also
connected to add mechanical stability.
21
Constructional Project
Pico W come on after a second. Carefully fit the PCB into the case, being
careful not to pinch any wires.
Attach the rubber feet to the bottom
edge of the box to complete the assembly. Now is a good time to plug
in a USB cable to charge the battery
fully.
Setup and usage
The Compact OLED Clock &
Timer mounts in the smallest Jiffy
box, UB5 size. We used a blue box but they are
hard to get. The controls are simple and, once configured, it
will always keep time to within a few seconds. The Clock/Timer is shown in its
lowest power mode – use the MODE button to switch to the Clock display, then
hold the OK button until this screen appears. It will wake when the OK button
is pressed again, if an alarm occurs or the countdown timer expires.
The Clock/Timer will attempt to
set the time via NTP when powered
on, so allow that to happen. We’ve
included several screenshots of the
Clock and Timer in various states.
Refer to those screen captions for the
basics of setting up and using it, in
the order shown.
The low power mode (with the screen
off) can be activated by holding the OK
button in the Clock Mode. When the
SLEEPING message appears, release
the button. Pressing OK again will reactivate the display.
The alarm and timer will also reactivate the display when they sound
their respective alert tones. If both
alerts are active, their tones and icons
will alternate.
The software is set to perform several actions at five minutes past the
hour (relative to UTC). This is when
the clock trimming will occur if you
wish to observe it. The automatic time
updates occur at five minutes past UTC
midnight. That will be, for example,
10:05am in Sydney or 11:05am during
daylight saving time.
The crystal trimming routine needs
two synchronisations before it will
make adjustments, so you might have
to wait a day or two before the trimming settles. Once that has occurred,
the clock should always be within two
seconds of the correct time.
Operation of the LDR and OLED
brightness is fully automatic. Small adjustments are made so that the changing brightness is not noticeable; it can
take up to a minute to settle after a
change in ambient lighting. If you find
the OLED is too bright, try decreasing
the value of the 1MW resistor in series
with the LDR.
Summary
The LED and LDR are standard through-hole parts that have been surfacemounted to avoid solder joints on the front of the PCB (see Fig.2). We have also
splayed out the leads of the switches to bring them closer to the PCB.
22
The Compact OLED Clock and Timer
is a portable and easy-to-use device
that boasts features that even some
clock apps do not. Once set up, it will
maintain time within a few seconds
as long as it can connect to a WiFi
network daily.
PE
Practical Electronics | July | 2025
|