LED clocks

I made several clocks. here they are. GEN 1: solderless breadboard, GEN 2: solderful breadboard, GEN 3: printed circuit board (PCB)

the origin

I’ve often wondered why wall clocks look the way they do. Two sticks, one longer than the other so as to distinguish between hours and minutes, with the longer one tasked with keeping track of minutes so as to have more precise readings of the more fine grained measurement. Except when I look at a clock I never care if it’s 3:42 instead of 3:43. Those are both 3:45 at best. More accurately, those are both, ‘it’s almost 4 already?’

On top of that, I think if we’re all being honest with ourselves, the classic wall clock is fairly hard to read at a glance. The closest number to where the hour hand points corresponds with not the correct hour fully half of all time (as in, at 2:45 the hour hand points as much to 3 as it does 2, however I’m supposed to be reading the number 2). Meanwhile the minute hand points to hour hand numbers, requiring (admittedly mild) arithmetic to obtain the correct minute numbers. Which I’ve already said I don’t care about with such detail anyways.

Ideally I want, at a glance, to discern first, what hour is it, and second, a general sense of how far along we are in that hour. I want an hour hand readout and a minute hand progress bar.

Ultimately though, I believe the answer to why wall clocks look the way they do is because it is possible to rotate two very thin, very light, sticks of metal basically forever with only a few AA batteries. A part of me still thinks that the kind of clock I envision can be done with liquid crystal or eInk displays. But for now I decided to make energy hogs out of LEDs.

the build

gen 1: Solderless Breadboard
  • Arduino nano
  • 8 x 8 LED grid
  • MAX7219 multiplexer
  • DS1307 RTC (Real Time Clock)
  • much solder and many wires

Solderless breadboard setups are not long for this world, but they were never meant to endure the harsh realities of slight jostlings and few inch falls.

These LED grids are full of lies. In particular only one LED is actually lit at any given moment. But by taking advantage of speeds humans were never meant to encounter in nature, and something called the persistence of vision (basically there’s some time over which visual perception sticks around in your head before your brain let’s it go) allows modern electronics to quickly switch between every lit LED thereby creating the illusion that everything is lit simultaneously. This effect is also sometimes referred to as flicker fusion and there is some critical flicker rate where things starting looking smooth and continuous (this is also how your microwave LED display works).

The LED grid itself is nothing more than soldering all of the anodes in each row together and all of the cathodes in each column together. When voltage is applied to one particular row and one particular column, only one LED will have both its anode and cathode connected and so that LED at the intersection of the row and column selected will be uniquely lit. The job of the MAX7219 multiplexer chip is to take a selection of LED’s chosen to be lit and then to quickly switch between them. Below is the nice circuit diagram suggestion from the MAX7219 datasheet (this multiplexer can handle 8 x 8 grids).

The multiplexer chip receives instructions forwhich LEDs to switch between from a program reading the time stamp of a Real Time Clock chip (specifically the DS1307 RTC). Although it is true that Arduinos can measure time, they’re not nearly accurate enough for any reasonable expectations for a clock. The Arduino talks with the RTC chip via I2C, and the program running on the Arduino translates time stamps into separate LED mappings for the hour hand number featured in the center, as well as the minute hand progress bar around the grid’s perimeter. These two mappings are then combined and sent to the multiplexer for to display the time.

gen 2: SolderFul Breadboard
  • Arduino nano
  • 9 x 9 LED grid
  • MAX7219 multiplexer
  • 4 – 74HC_HCT595 shift registers
  • DS1307 RTC (Real Time Clock)
  • much solder and many wires

A little bigger, a little wiser, and a whole lot sturdier.

In Gen 1 I made separate mappings for the hour number display and the minute hand progress bar and then combined them before sending them to the multiplexer chip to keep those chosen lights all lit. However, multiplexer chips handle those frame LED’s fairly inelegantly and I was aware of another chip, the shift register, which can very simply advance on off positions of anything in a line. New inputs (either light-on or light-off) are sent to the first position, moving everything over one and throwing out the last position’s state. So if you had [off, off, on, off], and then sent the shift register an ‘on’, it would result in [on, off, off, on].

Shift register chips seemed perfect for dealing with the minute hand frame LEDs and the fact that they each can handle 8 LEDs means that a 9 x 9 grid needs exactly 4 of them (9 x 9 grids having 32 framing LEDs). The simplicity of their functioning and the fits-just-right symmetry meant I had to upgrade to a 9 x 9 grid. You can see the central longer multiplexer chip surrounded on either side by the 4 shift register chips in the pic above beneath the LED grid.

gen 3: Printed Circuit board (PCB)
  • Arduino nano
  • 9 x 9 LED grid
  • MAX7219 multiplexer
  • 4 – 74HC_HCT595 shift registers
  • DS1307 RTC (Real Time Clock)
  • 3 – push buttons
  • much less solder and many fewer wires

Finally the time can be changed with buttons as opposed to relying on re-uploading adjusted code. Plus the sleek and robust feel of PCB!

Past experiences soldering a ton of wires and solder-bridges left me hungry for the pleasures of the PCB world. A lot less soldering, and many fewer wires. Plus the added benefit of an infinitely more stable and robust architecture as well as the sleek aesthetics of embedded wiring. And if I was going to go through this much trouble, I figured now would be a good time to finally incorporate the ability to change the time with buttons, instead of painstakingly having to adjust and re-upload code to the Arduino.

I found this excellent KiCad tutorial to help me get up and running and decided to have two circuit boards, one for the actual display, and the other for all of the chips, resistors, and Arduino. Here are schematics of the boards outputted from KiCad.

The final piece is the asterisk button, which I included for a lil razzle dazzle. When pressed the display switches from the clock to different patterns until the asterisk button is pressed again, returning the display to the current time.

I used Dirty PCBs to print the circuit boards. In the past I have also used Osh Park, which do a great job of small cheap circuit boards, however the circuit boards I wanted to make here were outside of their cheaper size range. DirtyPCBs also worked really well, and was better suited for this more medium range project size.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s