Another clock…

I came across these 2.3″ LED 7-segment digits the other week and just had to buy a set. I’ve been struggling to see the clock in our living room from where I sit and thought it would help if I could make something slightly (ahem) larger.



Yes, that’s the clock at the back of the unit on the right. If I zoom in on the original photo then I can make out that it was 13:01 when the picture was taken. It’s a real struggle to read it in bright light so time for a change…



That’s better 🙂

I’ve “fixed” the 6 since the photo was taken – it looks better with the top horizontal bar lit as well.

How did I make it? Well, it was fairly easy really as the digits are very easy to drive (once you’ve got over the complete lack of documentation and figured it out for yourself).

I used the excellent ShiftPWM library to drive the digits from an Arduino Uno clone and Adafruit’s RTClib to interface to a DS1307 chip.

The digits are like these ones at Futurlec – similar enough, anyway – but the boards I bought have an embedded shift register and voltage regulator. I’ve been driving them at 12V and then using Vcc from the LED board to connect to the Arduino Vin pin which is enough to drive it and the DS1307 clock shield.

I didn’t take lots of pictures of the build. The clock shield is just a bog-standard DS1307 setup with 3V lithium battery backup. It needs pull-up resistors on the I2C lines and a pull-up on the SQW/Interrupt output pin – all in the DS1307 datasheet. I also added a photo-resistor to let me control the intensity of the digits.

ShiftPWM seems to be really designed for driving LEDs rather than 7-segment displays. It’s fairly easy to abuse it to do so though. All of my code is on Github as usual and should be fairly self-explanatory (meaning I didn’t do a good job of writing comments). Since previous clocks I’ve done have been too sensitive to light, I used a 5 value rolling average this time – it also helps that ShiftPWM allows brightness from 0-255 so I can divide the analog reading by 4 which also reduces sensitivity. I’m running ShiftPWM at 100Hz so there’s no hint of flicker, even at the dimmest setting.

There are no buttons to set the time. It reads 4 digits from the serial port and sets the time on receipt of the final digit. I’m thinking about adding an ESP8266 to connect to an NTP server at some point – haven’t really had a chance to play with those yet so this will have to do for now.

I had some A5 acrylic sheets handy and used those for the back and front of the clock. After a bit of measuring I came up with a rough template:


The Uno and shield are positioned in the bottom left corner. At this time I mistakenly thought that I could use the corner holes on the front sheet also and then use spacers to connect everything together. Obviously, he says, that won’t work because the digits occupy the top two holes (marked with a rectangle) and the Uno one of the bottom ones. Still, I’m sure a piece of translucent grey acrylic with holes in it will come in handy for something. Here’s the assembled clock with the cocked-up front cover:

Cocked-up clock

Cocked-up clock

So, once I’d sorted a replacement front cover and bolted the two halves together (using standard plastic spacers – I have black ones fortunately – that was all done. It’s powered by a 12V 1A wall wart (from an old cable modem I think) and it seems to work just fine. Don’t know what long term accuracy will be like – I guess that mostly depends on the 32kHz crystal that I used. I’m fairly happy with the way it looks, will just have to see if it gets SWMBO approval 🙂

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *