This is only a preview of the June 2026 issue of Practical Electronics. You can view 0 of the 80 pages in the full issue. Articles in this series:
Articles in this series:
Items relevant to "SSB Shortwave Receiver, part two":
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
Constructional Project
RGB LED ‘ANA
This colourful and unique
clock tells the time with LEDs
arranged in a circle that light
up in different colours to
represent the hour, minute
and second ‘hands’. There’s
even a light chaser effect you
can optionally enable that has
the LEDs racing around each
second. It’s a straightforward build
that looks great when finished.
By Nicholas Vinen
T
his RGB LED Clock is simple and
stunning, using very few components outside the LEDs.
I came up with the idea of this clock
being vaguely aware of the somewhat
similar “Mesmeriser” clock by Grantronics that was published in the June
2005 issue of Silicon Chip magazine.
I knew it used single-colour LEDs; I
thought it’d be much nicer to make my
Clock from multi-coloured RGB LEDs.
This is a hybrid digital/analog
clock. All the principles involved
in timekeeping and the display are
digital, but it mimics an analog clock
in how it shows the time. Rather than
two or three physical hands that
rotate about the centre, pointing to
the numbers, 60 LEDs are arranged
around the outside of the face. They
light up where an analog clock’s hands
would point.
A real analog clock uses different
hand sizes to distinguish the hours,
minute and second hands. Instead,
this clock lights up the LEDs in different colours. If they ‘overlap’, the
colour is a mixture! For example, if
the hour hand is red and the minute
hand is green, when they point to the
same number, the LED lights yellow
(which is what you get if you combine
red & green light).
Funnily enough, if you are familiar
with that clock, you will see that I’ve
had some similar ideas to its designers, the main one being that it incorporates an optional ‘chaser’ that runs
around the clock face once per second.
It’s very eye-catching and also serves
to indicate to the beholder the passage
of each second.
Having said that it’s similar to the
Mesmeriser, my chaser does operate a
bit differently. You can see a video of
the clock in operation with this feature enabled at siliconchip.au/Videos/
RGB+Clock
If you don’t like or want the chaser,
it’s easy to turn off with a button press.
RGB LED Analog Clock Complete Kit (SC7416, about £40 + P&P)
Sold by Silicon Chip and sent from Australia, it Includes all the parts in the
list except the power supply. The microcontroller is pre-programmed. Choose
a BZ-121 GPS module or Pico W (unprogrammed) for the time source.
14
One major difference from the Mesmeriser is in terms of complexity. I
wanted this clock to be as simple as
possible (“keep it simple, stupid!”). So
besides the LEDs, there’s just one microcontroller, 20 resistors and a few other
bits and pieces. That earlier design used
way more parts and would have been
a lot of work to build. I would say this
one is elegant in its simplicity.
I also wanted to keep the parts relatively cheap so that it could be made
into an affordable kit. I considered
using SMD RGB LEDs, but the 5mm
through-hole types I ended up using
work extremely well and are quite inexpensive in bulk. The only expensive part is the PCB because it’s quite
large at 200mm in diameter. Still, you
wouldn’t want a wall clock much
smaller than that.
I think the KISS (keep it simple,
stupid) principle worked out quite
well because this design is considerably easier to build than the almost
20-year-old Mesmeriser design. That
one had a digital display as well, but
I thought most people would want
either a digital or analog like readout,
not both. One concession I made to
digital clocks is to add optional AM/
Practical Electronics | June | 2026
RGB LED ‘Analog’ Clock
ALOG’ CLOCK
● 200mm black clock face with 60 RGB
LEDs that light different colours for the
hour, minute and second
● 12 different colour schemes to choose
from
● Optional ‘subsecond’ hand chaser
● Adjustable, automatic PWM-based
dimming using an LDR to sense the
ambient light level
● Two optional single-colour LEDs (any
colours) to indicate AM or PM
● Time source: GPS module or NTP time via
the internet using WiFi
● Accuracy: typically within one second
● Time zone: from GMT−14 hours to GMT+14
hours in 15 minute increments
● Daylight saving: manual one hour toggle
● Power supply: 5-12V DC <at> 50mA from plugpack or USB
● Time source baud rate options: 4800, 9600, 19200,
38400, 57600, 115200
PM indicator LEDs to make the time
unambiguous.
While I think this clock is nicer than
the Mesmeriser, the kit is less than half
the cost (even less if you consider 20
years worth of inflation!). It is also a
bit larger than the Mesmeriser, and
since the LEDs are right at the edge,
the display is larger again.
I didn’t think it was realistic to power
a clock that uses LEDs for time display
from a battery, so it’s simply powered
from a DC supply between 5V and
12V (ideally in the range of 6-9V).
That could mean a plugpack or USB
supply. The simplest way to connect
it is to have a thin figure-8 wire hanging down from the bottom of the clock
to the nearest power point.
If you really wanted to power it from
a battery, with the average current draw
of around 25mA for our prototype,
you could expect four AAs to power
it for around five days. So you’d want
to use high-capacity rechargeable (eg,
NiMH) cells to avoid spending a fortune on alkaline cells.
In terms of timekeeping, I have offloaded that to your choice of either
a GPS module or a WiFi module that
fetches NTP time via the internet and
Practical Electronics | June | 2026
your WiFi network. That makes the
clock extremely accurate, with no
drift, while also helping to keep the
circuit simple.
The Clock is designed to hang on
the wall as a PCB assembly. It might
get a bit dusty, but you don’t normally
touch clocks often, so it doesn’t strictly need a case. If you want to put it in
a case, you can likely find a suitable
one. The easiest solution is probably
to buy a cheap clock in a plastic case
that’s large enough, gut it and install
this PCB in that case. Just make sure
it’ll fit first!
Circuit description
The full circuit is shown in Fig.1.
The key to keeping it simple is the use
of Charlieplexing to allow all 60 RGB
LEDs, containing a total of 180 junctions (plus the two optional AM/PM
LEDs) to be driven from a 20-pin IC.
This technique involves keeping
most of the pins connected to the LEDs
in a high-impedance state (eg, configuring them as digital inputs). One
output is driven high (to +5V) and the
other is pulled low (to 0V). A different
LED junction is connected across each
possible pair of pins, so depending on
which pin is high and which is low,
only one lights.
Due to the way the connections are
arranged, we can actually light any
combination of the red/green/blue
junctions in a single LED at any time.
By multiplexing them (switching
quickly between different states), we
can make it appear that multiple LEDs
are lit at once. In the case of this clock,
we need to light up to five LEDs at once:
for the hour ‘hand’, minute ‘hand’,
second ‘hand’, the optional ‘subsecond hand’ (which goes around the face
once per second) and the optional AM
or PM LED.
That means each LED is lit for a maximum of 20% of the time. To compensate
for that, we drive them pretty hard, so
they still look quite bright. By lowering the amount of time they are lit for
(ie, having all LEDs off sometimes), we
can control the brightness, too.
The formula for the number of LEDs
(ℓ) that can be driven by a Charlieplexed
arrangement for a certain number of
pins, n, is ℓ = 2(n−1) + 2(n−2) + 2(n−3)
+ ... + 2, which can be simplified to ℓ
= n(n−1). This is a quadratic equation,
so we can solve it for n and get the formula n = (1 + √1 + 4ℓ) ÷ 2.
15
Constructional Project
Plugging in our value of ℓ = 182, we
can determine we can do it with exactly 14 I/O pins. However, our circuit
uses 15 because that allows us to use a
much simpler arrangement where figuring out which pins to drive high and
low to light any given LED is trivial.
You can see the arrangement we used
in the circuit diagram.
The RGB LEDs are grouped in sequential sets of four, having their
common anodes all tied together and
connected in turn to I/O A (LED1LED4), B (LED5-LED9) etc, up to the
15th I/O, O (LED57-LED60).
For the first group with their anodes
driven by I/O A, the cathodes are driven
by B, C, D, ... K, L and M. For the
second group with the anodes driven
by I/O B, the cathodes are driven by
C, D, E, ... L, M and N. After the third
group, which ends with the final cathode being driven by the 15th I/O, O, it
wraps around to A again.
The critical thing is that no I/O pin
appears twice in the same group. The
AM and PM LEDs are connected to
spare combinations of pins that are not
used for any of the RGB LEDs.
To light one LED, all we have to do
is figure out which group it is in and
drive the corresponding shared anode
pin high. We then pull one, two or
three of the cathode pins connected
to that LED low to light it with a particular colour.
The nets designated A through O
connect to pins on microcontroller
IC1 via 68W current-limiting resistors.
These were calculated with the microcontroller’s absolute maximum current
limit per pin of ±25mA, as well as the
typical limit for an LED being 20mA (although, with duty cycle always being
under 50%, it isn’t really a concern).
Each LED will have two resistors in
series when it is lit, one in the anode
circuit and one in the cathode circuit.
Assuming the lowest LED forward voltage at 20mA is 1.8V and the supply
is exactly 5V, that means there will
be 3.2V across the resistors, allowing
a maximum of 23.5mA to flow (3.2V
÷ [68W × 2]). However, the microcontroller’s output transistors also have an
inherent resistance that we can calculate as being close to 68W from information in the data sheet.
This means that the series resistance for each LED is effectively around
200W, so the actual current limit is
closer to 16mA, comfortably under
the 25mA limit.
16
Brightness adjustment
We want the LEDs in the clock to
be bright in a well-lit room but not
so bright at night so they don’t sear
your eyeballs. Thus, there is a light-
dependent resistor (LDR) near the
middle of the clock face that senses the
ambient light level. It forms a divider
with the 100kW resistor in series wtih
it, across the 5V supply rail.
At higher light levels, the LDR’s
resistance is low, so the RA5 analog
input of IC1 will be close to 5V (probably around 4.5V). As the light level
drops, its resistance will increase to
100kW and above, so that voltage will
drop to 2.5V and lower. The microcontroller can thus use its analog-to-digital
converter (ADC) to read the voltage on
that pin and adjust the LED brightness.
That is done using pulse-width modulation (PWM). We’ll explain how it’s
implemented in the software section.
Cheekily, we also use pin 2 of IC1 to
sense presses of pushbutton switches
S1 and S2. They are used to change
the clock’s configuration, set the time
zone, compensate for daylight saving,
adjust the LDR sensitivity and so on.
When one is pressed, it pulls pin 2
either almost all the way up to 5V or
all the way down to 0V. The LDR’s resistance doesn’t vary enough to allow
the voltage to get that close to either
rail, so the microcontroller knows a
button has been pressed. The 220W
series resistors are low enough not to
interfere with that, but high enough to
avoid damage in case both buttons are
pressed (an invalid condition).
Timekeeping
While IC1 has an internal oscillator, it isn’t super accurate, so it’s only
used for timekeeping from second-to-
second. For longer intervals, we rely
on the time source: either a GNSS (eg,
GPS) module, which gets its time from
atomic clocks in satellites, or a module
that fetches the time via internet NTP
servers using a WiFi network.
Either way, we’re relying on that
module to have a crystal for reliable
timekeeping, and we simply get its
updates (once per second or more frequently) and display whatever time it
gives us.
The GNSS or NTP module is connected via six-pin header CON3. Some
modules have four or five wires, in
which case some of these pins are not
connected. Actually, only three are
required: Vcc (5V) and GND (0V) to
supply the module with power, and
TX, which is the pin it uses to send
serial data to our microcontroller that
includes the time.
We provide a pad for soldering the
module’s RX wire that pulls it high
via a 10kW resistor so that the module
doesn’t get spurious serial data due to
EMI. We never actually need to send
it data. The 1PPS pad is provided as
a place to anchor a 1PPS wire if the
module has one; we don’t need that
either. The EN pad will pull up the
module’s EN wire, if it has one, to
enable it.
Remaining circuitry
IC1 has a 100nF supply bypass capacitor for stability, plus a 10kW pullup resistor on its MCLR (reset) pin
to prevent spurious resets. Optional
in-circuit serial programming (ICSP)
header CON2 provides a way to reprogram IC1.
While some LEDs will light dimly
while doing this (as pins 18 & 19 of
IC1 are used for both programming
and driving LEDs), we didn’t find this
interfered with programming the chip.
All that remains is the simple linear
power supply. REG1 is a low-dropout
5V regulator that allows you to feed
in a higher voltage (6-12V DC) and it
will provide a nice, stable output to
run the clock. As the current draw is
usually less than 50mA, it will only
dissipate 350mW at most ([12V – 5V]
× 0.05A). It’s in a medium-sized SOT223 package soldered to the board, so
it will handle that easily.
The AMS1117 regulator requires a
1µF ceramic capacitor on its output,
plus an input bypass capacitor of at
least 100nF, so we have provided those.
They are both 1µF to simplify construction.
Mosfet Q1 provides reverse polarity
protection, as the power input is via
a simple two-pin header or soldered
wires. If the supply polarity is connected correctly, Q1’s gate is pulled up, and
it switches on, connecting the supply
negative wire to circuit ground. If the
supply wires are swapped, Q1’s gate
is pulled down and its body diode is
reverse-biased, so no current will flow.
ZD1 protects Q1’s gate in case a negative voltage exceeding 16V is applied
to the board, however unlikely that is.
Options
While we are specifying common-
anode RGB LEDs, it will actually work
Practical Electronics | June | 2026
RGB LED ‘Analog’ Clock
Fig.1: the circuit is dominated by the 60 RGB LEDs that
connect to microcontroller IC1 via fifteen 68W series
resistors. The micro can light any element of those LEDs (or
the two extra ones) by bringing one of the connected pins
high and the other low, while the remainder are kept as
high-impedance digital inputs.
Practical Electronics | June | 2026
17
Constructional Project
with common-cathode RGB LEDs too.
All that needs to change if CC LEDs
are used is for the drive polarity to be
reversed, ie, instead of pulling a pin
high, it is pulled low, and vice versa.
The only catch is that if you fit the
AM & PM LEDs (LED61 & LED62) and
are using common-cathode RGB LEDs,
they need to be reversed (rotated by
180°) so that their polarities match
the other LEDs.
PCB layout
You would think with all these LED
connections, the PCB layout would be a
nightmare, but actually, it was straightforward. We have kept it as neat as possible, and quite symmetrical, since the
PCB also forms the clock’s face – see
Fig.2. We could have hidden
most of the circuitry on the
back, but we thought
it’d be more interesting to have some
on the front!
Fig.2: the 200mm
diameter PCB forms
the clock face, with the
60 RGB LEDs arranged in
6° increments around the edge.
18
The microcontroller, IC1, is right
at the centre of the face, which seems
appropriate since it’s also logically at
the centre of the circuit. Most of the
resistors are to its left and right. The
bypass capacitor is above it, while the
LDR is centred below it. The pushbuttons are on the left and right sides,
lined up with IC1.
The power supply components
mount on the back of the PCB, towards the bottom.
We initially thought of using the
auto-router to make the 244-odd connections to the LEDs, but came up
with a better (and much neater!) idea.
The 15 I/O lines (labelled A through
O on the circuit diagram) are assigned
to 15 bottom-layer circular tracks that
run at fixed intervals inside the circle
of RGB LEDs. Top-layer radial linear
tracks run from each RGB LED pad partway towards the centre of the PCB, all
terminating just above the innermost
bottom-layer ring track.
With this arrangement, all we needed
to do was place one via on each of those
radial tracks at the appropriate location to join it to the correct circular
track (A-O). One of each of the radial
tracks connected to the A-O lines is
then routed to the series resistor that
connects to the appropriate microcontroller pin. (Thanks to Tim Blythman
for his help in suggesting this neat arrangement!)
While there are pads for the
three connectors to be inserted from the front
side of the board,
we thou g h t i t
would be a
Practical Electronics | June | 2026
RGB LED ‘Analog’ Clock
bit ugly having them stick out. These
pads don’t have exposed copper on the
front of the board, to keep it looking
clean, but it is still possible to solder
vertical or (ideally) right-angle headers on the back side.
Most constructors would not need
to fit the ICSP header. Since GPS modules usually come with plug-in wire
assemblies, there’s no real need to fit a
header for CON3. Instead, we suggest
you simply solder the wires to those
pads on the back, as we did. We stuck
the GPS module on the back of the
PCB with double-sided tape to hide
it, as otherwise the wiring will look a
little messy.
That just leaves the power input,
CON1. You have a few options there.
You could solder a right-angle polarised header to the back of the board
and use a plug to connect it. You could
also just solder bare wires (either directly from a plugpack, or to an inline
barrel socket) to those pads.
There’s also the option of using a
small, separate board we developed that
can be soldered to the main board using
a pin header, which has an onboard USB
socket (described starting on page 25).
You can then use a 5V USB supply to
power the clock. While that will probably mean REG1 will be in dropout and
not regulating, and the LEDs might not
be quite as bright, we haven’t found it
to make that much difference.
That small add-on board will be
useful in many applications, so we’re
presenting it as a separate project.
Software
The software is simple in principle,
although it is actually quite involved
when examined in detail. The microcontroller runs with a 16MHz main
clock (‘Fosc’) that results in a 4MHz
instruction clock. Three hardware
timers are used: TMR0, TMR1 and
TMR2. The other peripherals we need
are the analog-to-digital converter and
the UART for serial reception.
TMR1 is used for timekeeping and
to control the main loop rate. It is a
16-bit timer running from Fosc ÷ 4, and
it uses a 1:1 prescaler, meaning it overflows at a rate of 61.035Hz (16MHz ÷
4 ÷ 65536).
Happily, this is almost exactly
what we want. Assuming the subsecond hand/chaser is enabled (and it
looks cool, so why wouldn’t you?),
the subsecond hand makes 61 steps
each second. That’s because it has
Practical Electronics | June | 2026
to go around the clock face once (60
LEDs) plus advance one step with the
second hand (plus one LED). This is
pure coincidence, but it works out
really well!
While we advance the clock to the
next second after 999.4ms (61 ÷ 61.035),
we expect the GPS/NTP module to give
us a time update after exactly 1000ms,
so that event is used to reset the timer.
That way, as long as we are getting
time updates every second, there are
no glitches in the time display.
TMR0 and TMR2 are used for LED
multiplexing and PWM, respectively.
They are both 8-bit timers that run from
Fosc ÷ 4, using a 4:1 prescaler, so they
run at 3.906kHz (16MHz ÷ 4 ÷ 4 ÷ 256).
Each time TMR0 overflows, it triggers
an interrupt routine that switches to
lighting the next LED (using port masks
precalculated by the main loop).
That means each LED is lit for 51μs
at a time, giving a duty cycle of approximately 20% at full brightness.
TMR0 and TMR2 run in lockstep.
At full brightness, TMR2 never triggers. The PR2 register controls how
soon the TMR2 interrupt occurs after
TMR0 overflows. As the value in PR2
is reduced, the TMR2 interrupt occurs
earlier and when its interrupt service
routine (ISR) is called, it simply switches all LEDs off. The earlier that happens after switching on, the dimmer
the display becomes.
This means we can use the PR2 register as an 8-bit PWM control for all
LEDs, since it occurs at the same interval after each multiplexing step.
Besides calculating which LEDs to
light based on the current mode and
time, the main loop also receives serial
data from the GPS/NTP module, decodes it and uses it to update the current time. After getting the UTC/GMT
time, the configured timezone offset
and DST offset (if enabled) is applied
before updating the clock face.
It reads the voltage from the LDR divider on each run through of the loop,
filters it, and uses it to calculate the
new brightness level.
It also checks if button S1 or S2 has
been pressed, performs debouncing,
looks for long or short presses and
changes the mode as appropriate.
Construction
The RGB LED Clock is built on
a large circular PCB measuring
200×200mm (ie, 200mm in diameter) with a black solder mask, coded
19101251. We recommend you start
by fitting the top-side SMDs, with
IC1 being the first.
You should have a temperature-
controlled soldering iron, fine-tipped
tweezers, solder wire, a syringe of flux
paste and a roll of solder-wicking braid
on hand. Work in a well-ventilated
area, either using a fan, next to an open
window or outdoors as flux smoke is
not good for you if you inhale it.
If you bought a kit or programmed
microcontroller from the Silicon Chip
Online Shop, your chip will already
be programmed and you can just
solder it to the board. If you have a
blank chip and the ability to program
it off-board, do so now. We described
how to do that in our article on the
PIC Programming Adaptor from the
September 2024 issue.
If you don’t have such a programming rig and your chip is blank, solder
it now and you can use CON2 to program it later.
Before soldering it, make sure you
identify pin 1 and line it up with the
markings on the board and in the topside component overlay diagram, Fig.2.
Fixing a reversed SMD chip is not
fun! Tack one pin to the board using
a little solder, then inspect the leads
to verify they are all over their pads.
If not, remelt that solder and gently
nudge the chip into position.
Verify again that the IC is orientated correctly, then solder the diagonally opposite pin. Apply flux paste
down the pins on both sides, then
solder all the remaining pins. You
can do it individually, by adding a
little solder to the iron tip and touching it to the junction of the pin and
pad, or you can drag-solder them
several at a time.
If any bridges form (which is likely
with drag soldering), add a little flux
paste and then use solder-wicking braid
to remove the excess solder.
Inspect all the solder joints and pins
under magnification to ensure all pins
have been soldered to their pads with
good fillets and no bridge remain, then
move onto the passives, using Fig.2 as
a guide. It’s best to fit the 220W, 10kW
and 100kW resistors first, since all the
remaining resistors will be the same
value (68W). The sole capacitor on this
side is the 100nF type.
You can use a similar technique as
for the IC: tack the part to one pad,
check its orientation, adjust if necessary, then solder the other pad. Add a
19
Constructional Project
tiny bit of flux paste to the first one and
heat it with the iron to reflow the joint.
With all these parts in place, clean
the flux residue off the board using alcohol or a flux solvent. It’s much easier
to clean the board before any throughhole parts are in place. This will be the
clock face, so you want it to be nice
and presentable! You’ll probably have
to clean it two or three times, using
a fresh section of lint-free cloth each
time, to get it looking nice.
Now solder the two tactile switches
using the same technique. This will
probably leave a little flux residue,
but we don’t want to soak the switches in solvent as it can damage them,
Fig.3: there aren’t too many
components on the back – six
SMDs for the power supply
near the bottom, up to
three connectors
(depending on your
preference), the
time source
(a GNSS
module
shown
here)
and...
so apply a little solvent to a section
of the lint-free cloth and wipe off the
flux residue using that.
Flip the board over (rest it on a
cloth so its face doesn’t get dirty or
scratched), then solder the parts on the
reverse side, as shown in Fig.3. Don’t
get Q1 (possibly coded XORB) and
ZD1 (likely coded T12 or Z3) mixed
up, as they are in the same type of
package. When finished, clean up the
flux residue, although thoroughness
is less crucial since it will be against
the wall later.
You can now solder the LDR on the
front side; you may need to bend its
leads in to make them fit the pad pat-
tern. Make sure it’s straight and close
to the board so that it looks nice.
Soldering the LEDs
Now for the big job. This will probably take you at least a couple of hours.
Don’t rush it as it’s harder to fix problems like bridged pads than it is to do
them right the first time.
Make sure you fit each of the 60 RGB
LEDs the right way around. Pay attention to the orientations of the flat faces
on the PCB silkscreen and in Fig.2.
For each LED, insert it and then rest
the board on your work surface such
that the weight is on that LED, so it’s
pushed into the board. You could place
something like an eraser between the
lens of the LED you’re soldering and
your bench to ensure that. Then
solder one of the outer leads,
with the soldering iron
on the outside, using
a minimal amount
of solder.
some
wires
to hang
it on the
wall. The
wiring shown
suits the BZ121 module we
used but virtually
any 5V-powered TTL
module should work.
20
Practical Electronics | June | 2026
RGB LED ‘Analog’ Clock
Don’t use too little; you need to be
able to see that a fillet has formed. Still,
you should use just enough solder to
get that fillet. Next, check if the LED is
flat and straight. If not, you still have
a chance to push it into the PCB with
your finger while you remelt that initial solder joint.
Once you’re satisfied, solder the opposite lead, again with the iron coming
in from the outside. The critical part
here is that the pads are very close
together, with large holes and thick
leads, so it’s quite easy to bridge the
pads and somewhat difficult to fix it
if a bridge forms.
For the two remaining leads, bring
in the soldering iron from the middle
or outside of the board so it touches the pad and lead, then feed in a
minimal amount of solder from the
outside until it melts, as shown in
Fig.4. Again, use just enough to form
a fillet. Repeat for the final lead/pad,
then use sharp side-cutters to trim
all four leads reasonably close to the
PCB and evenly.
When trimming, use eye protection
and/or hold onto the leads so they don’t
fly into your eye! They can attain quite
a high velocity when cut through.
Now check to make sure the pads
have not been bridged. If you have followed our instructions carefully, they
should not be. If they are, add some
flux paste and use solder-wicking braid
to remove the excess solder until the
bridge is clear. You can then add a tiny
bit of solder back to the pads to ensure
there’s enough.
Repeat until you have soldered 5-10
of the LEDs.
Testing the LEDs
It’s best to test the LEDs as you go,
because a short circuit at any point on
the board can cause the whole display
to go haywire (after all, there are only
15 separate tracks connecting to all 60
LEDs). When first powered up, the firmware runs a display test where LED1LED62 are lit up white in sequence at
about 4Hz. This should allow you to
quickly spot problems.
I found the easiest way to power
the board was to get a regulated 5V
supply (eg, a bench supply) and use
clip leads to attach two male-male
jumper wires to its outputs. With the
clock face towards you, right-side up,
rest the black (negative) wire in the
right-most terminal of CON1 (the one
labelled GND in Fig.2). The weight of
Practical Electronics | June | 2026
Fig.4: no doubt there are many ways to solder the RGB LEDs without
accidentally bridging the very closely-spaced pads, but this is what we found
worked best. The soldering iron tip and solder should come in from 180°
opposite positions along the long axis of the pads. That minimises the chances of
accidental bridges, which are difficult to clear. The final PCB will feature more
widely spaced pads to make this a little less tricky than our prototype (although
we managed to do it).
the cable will bring it contact with the
plated through-hole.
Similarly, insert the positive jumper
wire into the side of CON1 labelled +
and ensure the two wires are not shorted, then switch the supply on. Ideally,
it should be current-limited to around
50mA (the board will draw less than
20mA in this configuration). Power it
up and check that LED1 lights, then
LED2 etc.
If you don’t have a current-limited
supply, you could use a fixed-voltage
DC supply with a series resistor to prevent damage in case there is a fault. For
example, a 12V supply with a 150W 1W
series resistor would easily deliver the
~20mA needed to power the circuit for
testing but would be limited to 80mA
in case of a fault (with the resistor dissipating just under 1W).
When powered, if any of the LEDs
don’t light up white, or they light at
the wrong time, switch it off and check
the most recent LEDs you’ve soldered
for bridges or bad joints. Once they
all light up OK, go back and solder
a few more LEDs. Keep testing until
all 60 are fitted and they are lighting
up nicely.
You can then solder LED61 and
LED62 if you are going to use them.
Remember to reverse them if you used
common-cathode RGB LEDs. They will
light up individually during the test,
after all 60 of the RGB LEDs.
While the LED solder joints are on
the back of the board, if you have a lot
of flux residue left behind, you may
want to clean it up to avoid getting
sticky hands when handling the clock.
A proper flux remover is better than
alcohol here, as alcohol dries fast, but
you can use it if that’s all you have. Because of the sharp leads, you will have
to dab it off, rather than wipe it off.
It took a little while, but we cleaned
this flux residue up. Try not to let any
get onto the face (ie, the opposite side
of the PCB), or you’ll have to clean it
again so it looks nice.
Final assembly
There isn’t much left to complete
the clock. If you’re using CON2, fit it
now; most constructors will not need
it. We suggest you stick the GNSS or
NTP module to the back of the clock
using double-sided foam-cored tape.
Cut it to size and stick it on. The GPS
module will usually have a flat, non-
conductive ceramic antenna that you
can stick somewhere without too many
tracks.
The NTP module has conductive
parts on the back, so make sure none
of them can short to the PCB. Most of
the back of the Clock PCB is covered
with a solder mask, so short-circuits
are unlikely, but you should still check.
If you’re using an NTP module like
the WiFi Time Source for GPS Clocks
that was published in the June 2024
issue, you will need to configure it
so it can connect to your WiFi network. That is usually best done before
wiring it up; refer to that article for
instructions.
Now wire the GPS or NTP module
to CON3. You can use a header and
plug(s), if you want, but we think
soldering wires directly to the pads
is fine.
As mentioned earlier, you won’t necessarily have all six wires to connect
to CON3. It doesn’t matter; the vital
ones are VCC, GND and the TX signal
from the module (which goes to the
pad marked TX, not RX; ie, the labels
are from the module’s point of view).
If your module has an EN wire, check
that it’s active high. If so, you can solder
21
Constructional Project
There’s nowhere suitable on the PCB to mount a USB connector, so if you want
to use USB power, you can attach the add-on board like this.
it to the EN pad. Otherwise, solder it to
GND. Most modules will have an RX
pin, which should be soldered to the
RX pad, pulling it high to disable it.
Power supply
For power, you can solder a lightduty figure-8 lead to the pads for CON1
on the rear of the board and either
hard-wire it to a 6-12V DC plugpack
or similar, or have an inline barrel
socket or other connector at the end
of that wire to connect a DC supply.
Try to get the polarity correct (refer to
Figs.2 & 3), although the board should
not be damaged if you do accidentally reverse it.
Another option is to build our USB
Power Breakout Board, described in the
accompanying short article starting on
page 25. This is a small PCB that can
accept a USB Type-C or USB Type-B
Micro/Mini socket and a pin header.
It supplies ~5V DC to that pin header
when a USB supply is connected. This
may not run the clock at full brightness, but it won’t be far off, and USB
supplies are common and convenient.
We didn’t put pads for a USB socket
on the clock PCB itself because there
was no room to do it along the edge
(the whole edge is filled with LEDs).If
the socket wasn’t near the edge, there
wouldn’t be room for a cable to plug in,
so the PCB would need an ugly cut-out.
Spacing this small PCB off the back
of the clock PCB on a header provides
enough room for the cable to plug in.
The only components you need on
that PCB are the USB socket, a 0W
22
SMD M3216/1206 resistor and the pin
header. Once that’s assembled, you can
then solder it to the back of the Clock
PCB as shown in the photo above.
Note how the USB Power Breakout
Board PCB has four through-hole pads;
this allows a two-way pin header to be
fitted with multiple different polarities.
The header position shown in Photo
1 is required to match the polarity of
CON1. If you’re unsure, refer to the
separate article and its PCB overlays
to see how the header position affects
the polarity.
Finally, you will have noticed several large rectangular pads on the back
of the Clock PCB. These are provided
to solder a loop of wire for hanging the
clock, with other pads near the bottom
to solder wire loops so it hangs vertically on the wall.
The photo overleaf shows how we attached the wires to our Clock for hanging; you can use a similar arrangement.
You can bend the wires into different
positions to suit your hanger (whether
it’s a nail, screw, hook or whatever).
If possible, do that before soldering
the wires to avoid stress on the soldered joints.
Final testing
Presumably if you’ve gotten to this
point, the LED testing went well, so the
microcontroller and LEDs are working.
There isn’t much else to go wrong, apart
from the GPS/NTP module wiring and
the power supply itself.
We suggest you use the same procedure you used for testing the LEDs and
check that the current draw is under
100mA. With the BZ-121 module we
used, our Clock drew around 45mA. If
that’s the case, it’s unlikely you have
anything really wrong.
You can test the LDR-based dimming
now. Place a small opaque object like a
credit card over the LDR and observe
the LEDs. They should dim when you
block the light to the LDR and brighten
again when you remove the obstruction. You will have to cover the LDR
thoroughly, as even a bit of light leading around its edges is enough to make
the LEDs quite bright.
If that doesn’t work, you probably
have a soldering problem with the LDR
or its series resistor, a button is stuck
down or the LDR is the wrong type.
If you’re using a GPS module, we suggest you put the clock near a window
and set the baud rate to the correct one
for your module, as described below.
Leave it powered for around 30 minutes, then come back and check if it’s
showing the correct time for London
(ie, GMT). If so, that means it has acquired the signal and is decoding the
data properly. You can then complete
testing by setting it up.
If using an NTP module, you should
have set it up earlier, so once you have
set the correct baud rate (as explained
below), it should connect and show you
UK time within a few seconds. In that
case, proceed to the following section.
Setting it up
The first setting is the baud rate.
This can only be changed after power-
up when the initial LED test has completed and the spinning chaser (at
roughly one ‘rotation’ per second) is
operating, to indicate it’s waiting for
GPS/NTP data. If you see a clock face
instead, it’s likely the initial baud rate
was already correct and it’s getting data,
so you can skip this bit.
The chaser will initially be red if it
isn’t getting any valid data, changing
to green if there is data but no valid
time yet. Once it’s green, it’s usually
just a matter of time before it switches
to telling the time (assuming you have
a strong enough GPS or WiFi signal).
During this time, one of the digits 1-6
will be lit blue, indicating the baud rate:
1. 4800 baud
2. 9600 baud
3. 19,200 baud
4. 38,400 baud
5. 57,600 baud
6. 115,200 baud (default)
Practical Electronics | June | 2026
RGB LED ‘Analog’ Clock
Pressing A will go to the next lower
baud rate, while pressing B will go
to the next higher one. If you don’t
know the correct baud rate, try each
one for a few seconds until the chaser
changes to green. If it doesn’t for any
baud rate, switch off and check your
wiring. Remember that TX from the
module should go to the TX pad on
the PCB.
All settings, including the baud rate,
are stored in EEPROM, so you shouldn’t
have to do this again.
The remaining settings that can be
accessed in time display mode are:
1. the time zone offset and optional
DST (+ 1 hour when activated)
2. the colour scheme
3. the second and sub-second hand
modes
4. the LED dimming calibration (minimum & maximum brightness)
Once you’re in clock mode and the
time has been acquired, you can set
the time zone offset. Hold down the
A button for a second and release it.
The time display should remain, but
it will now flash at 1Hz with a 50%
duty cycle.
If daylight saving is active in your
area, hold down B for one second to
enable DST mode. A short press of the
A button will make the time 15 minutes
earlier, while the B button will make
it 15 minutes later. Use this to set the
correct local time, then hold down the
A button to return to the normal display. The time zone you set will be
stored in EEPROM.
After this, if your area has DST and
the time changes, you just need to go
into this mode and hold down B for
one second, then hold down A for one
second to switch between DST and
non-DST. Alternatively, you could just
change the time zone offset until the
time is correct.
Colour scheme
In time display mode, short presses
of the A button will cycle through the
six possible colour schemes for the
hour, minute and second hands. Each
can be red, green or blue, but they must
all be different. Use whatever scheme
is easiest for you to remember. The default is blue for the hour ‘hand’, green
for minutes and red for seconds.
A short press of the B button will
cycle through the six possible second-
hand modes. The default is to have the
second ‘hand’ visible, plus the ‘subsecond hand’ in the same colour.
Practical Electronics | June | 2026
The sub-second hand is a chaser that
runs around the clock face each second.
It starts where the second hand is, goes
all the way around, and ‘pushes’ it over
to the next second on the tick.
A short press of B will cycle
through the four possible secondhand modes:
1. the second hand and sub-second
hand are visible and matching colours
(the default)
2. the same as #1 but with a dimmer
sub-second hand
3. the second hand and sub-second
hand are visible, with the sub-second
hand being white
4. the same as #3 but with a dimmer
sub-second hand
5. the second hand is visible but the
sub-second hand is not
6. there is no second hand, only the
hour and minute hands
Dimming adjustments
A long press on the B button in time
display mode will switch to the brightness/dimming adjustment mode. In
this mode, you can control both the
maximum brightness and how the
brightness reduces at lower ambient
light levels. By default, the maximum
brightness is 100%, reducing to a low
level, but not the lowest possible, in
total darkness.
Upon entering this mode, you are
adjusting the maximum possible
brightness. Pressing A will reduce
the maximum brightness and you
will see the display dim. Pressing
B will increase it (if it is not at its
maximum).
While making this adjustment,
the LDR reading is ignored; you are
seeing the brightness level that will
be used at the highest possible ambient light level.
Keep in mind that, depending on
where your clock is positioned, it
may not normally ‘see’ a very high
ambient light level. For this reason,
you can actually set the maximum
brightness above 100%. This will not
make the display brighter, but it will
mean that the ambient light level has
to drop further before the brightness
starts reducing.
The clock face shows a continuous chaser in this mode to help you
see the brightness level you’ve set,
which spans a portion of the clock
face related to the possible brightness
range. The portion from six o’clock to
twelve o’clock shows the maximum
brightness setting, so the chaser gets
Parts List – RGB LED Analog Clock
1 black double-sided PCB coded 19101251, 200×200mm
1 5-12V DC 100mA power supply (6-9V DC recommended)
1 2-pin vertical or right-angle header (CON1; for power – see text)
1 5-pin right-angle header (CON2; optional – for ICSP)
1 6-pin right-angle header (CON3; optional – for GPS module)
1 5V GPS module or compatible NTP time source (MOD1)
[BZ-121 GPS module recommended, Silicon Chip SC7414]
2 2-pin SMD black tactile pushbutton switches (S1, S2)
1 20×20mm piece of foam-cored double-sided tape (to affix GPS module)
1 200mm length of tinned copper wire (to make hanger/standoffs)
1 USB power supply module (optional; see text and accompanying article)
Semiconductors
1 PIC16F18146-I/SO micro with 1910125A.HEX, wide SOIC-20 (IC1)
1 AMS1117-5.0 15V input low-dropout linear regulator, SOT-223 (REG1)
1 AO3400 or equivalent logic-level N-channel Mosfet, SOT-23 (Q1)
1 BZX84B5V6 or BZX84C5V6 5.6V zener diode, SOT-23 (ZD1)
60 frosted-lens 5mm RGB LEDs (LED1-LED60) *
2 5mm high-brightness LEDs with diffused lens of various colours
(LED61 & LED62; optional AM & PM indicators)
* the kit will come with common anode LEDs but common cathode types can
also be used
Capacitors (all SMD M3216/1206 size 50V X7R)
2 1μF
1 100nF
Resistors (all SMD M3216/1206 size unless noted)
1 100kW light-dependent resistor (LDR1) [GL5528]
2 100kW
2 10kW
2 220W
15 68W
23
Constructional Project
shorter as you reduce it and longer as
you increase it.
A long press of A will return to the
time display, while a long press of B in
this mode will switch to adjusting the
other end of the range, ie, how much
it will dim at low light levels.
Similar to the maximum brightness
setting, you have a fairly wide range
of adjustment here, as you may wish
the clock to fully dim before it is in
total darkness.
Or you may wish for it to never go
to minimum brightness, even when
the LDR sees no light. The default is
somewhere between those two
extremes.
While making this adjustment, the
LDR is active and the display will dim
based on the current ambient light level
and the current setting so you can see
its effect. To simulate the clock being
in darkness, you will need to cover
the LDR with something opaque, like
a credit card.
Small objects can easily have light
leak around the edges, so make sure
the object is touching the whole face
of the LDR and extends beyond it in all
directions if you want to simulate total
darkness. Being in a dimly lit room for
this adjustment will help.
In this mode, a long press of button
A will return to time display mode,
while a long press of button B will go
back to adjusting the maximum brightness, as described above.
Using it
We attached
thick wire to
these solder pads
on the rear of the Clock,
so that it can be
hung on a wall.
The
clock face
is designed
so it doesn’t
take attention
away from the LEDs.
24
Once you have set your time zone
offset, confirmed that your time source
is working, adjusted the brightness
levels and chosen your preferred colour
scheme and mode, the clock is set up
and ready for use. If it loses power,
when it regains it later, it will go back
into exactly the same mode. It just
might take a while for your time source
to resume, especially if it’s a GNSS/
GPS module.
All that remains is to hang it on the
wall and connect the permanent power
supply arrangement. We recommend
soldering an inverted-U-shaped piece
of tinned copper wire between one pair
of pads on either side at the top of the
clock. Bend it so that it will comfortably hook around the head of a screw
in your wall, or a wall hook.
A couple of smaller loops soldered
across the two pairs of pads near the
bottom of the clock will stop the bottom
of the clock from touching the wall.
However, you may wish to have it
angled down, as it could make it easier
to read. So you could omit those loops,
or make them stick out less than the
upper one.
If there is no power source under
where you want to hang the clock,
you could run a thin figure-8 cable
from CON1 up behind the clock, then
along the wall and then down to a more
convenient location. The wire will be
less visible if it’s the same colour as
the wall (you could paint it).
While few homes have picture rails
anymore, if you’re lucky enough to
have them, they are an excellent way
to hide such wire runs!
PE
Practical Electronics | June | 2026
|