DIY Digital Clock: Take 2!

What time is it?

Time to make a new clock!

About a year ago, I designed and assembled my own custom made clock. You couldn’t say it was in an enclosure since its guts were spilled out on both sides of a piece of foam core. I felt like, a year later, it was time to redo it and put it into a proper enclosure.

So, what time is it? Time to build us a new clock!

The Guts


I tend to get carried away and too focused to take proper progress pictures. This is literally the first picture I have from the electronics part.

Soldering all of those LEDs and components took a full day. I used hot glue to try to keep multiple wires in place to solder as fast as I could but it didn’t do the best job to hold them in. At time, the glue would fall away from the PCB. Still, it’s better than fiddling with one wire at a time.

The only difference from the prototype build is a lower resistor value for the LED resistors.

Putting Together a Box


Foam core is a favorite in my “lab”. It’s all I use these days because all it takes is a knife to cut and it’s inexpensive and accessible (Dollarama rocks). I built a simple black box with a white cover place. I was hoping with a lower resistor value on the LEDs, they’d be able to shine through the white foam core.


With the soldered parts and the enclosure ready, it was time to put it all together.


I glued a piece of foam core behind the control board to isolate the connections on the back with the display connections. I ended up mounting the two display panels on it’s own piece of foam core anyway so I guess that wasn’t really necessary. The display foam core backing fits tight with no need for pin or glues to hold it in place.


The white foam core was still too think for the LEDs so I ended up going back to a plain white sheet of paper. It’s not noticeably brighter than the original prototype with the paper.  The piece of paper is held up by two strips of foam core on either side.

I didn’t like the look of it at this point but it was the end of the weekend so I left it for now.


I still like how sleek the black foam core looks, even with a few imperfections here and there from a not-so-sharp knife.


After a few days to think about it, I realized simply turning around my diffusing screen pulled the look together.


Time to pull the plug on the prototype and enjoy something new.

Thanks for reading!

DIY Clock Project – It’s finally alive!

After months of putting this project off, I finally focused for a weekend and put together a first prototype of my DIY real-time clock. To bring you back up to speed, the clock circuit is on a custom designed PCB which will control another set of custom PCBs that form four large 7-segment digits. It uses an Atmega328p microcontroller, a DS3231 RTC IC to keep the time, and some 74HC595 shift registers to control my custom 7-segment display PCBs.


The boards were soldered without any issue. I’m quite pleased with the look of both of the boards, so much that I wanted the control board to be in plain view in this build.


Once I got the boards ready, it was time to program. My first test would be to try upload something the microcontroller and to test out the display. It worked as well as I could have hoped.

One thing that I could have done better with the control board was to use an FTDI header instead of the USBtinyISP since you can’t print anything to the serial port to debug. Thankfully, I didn’t need that anyway.


After setting the time on the DS3231 IC using example from the Sodaq_DS3231 library, I wrote some code to the form all possible digits for each 7-segment digit. Then, with some more code, I was able to print out the hour and minute on the display.


I thought about putting it into a good enclosure but I’m considering rebuilding this project a second time with a cleaner look.


I’m not so crazy about using the female-to-female jumper wires in the final build but it does kind of look neat.


The display is very nice to look at in all lighting conditions. The not-so-bright LEDs and the simple blank white paper diffuser results in a display that is easy on the eyes.

Overall, I’m glad with how the project turned out. Unlike many of my other projects, this is one that I actually use on a daily basis.

Thanks for reading!

Clock Project Journal Entry #2: Get on with it

In the first journal entry for my clock project, I introduced the purpose and general idea of the project. It’s simple, but it’s been dragging on for weeks. The schematics and PCB designs have been tweaked many times since the first draft. I’ve been hesitant to call them complete because of my unfamiliarity with the DS3231 real-time clock, and because it’s my first time making my own component parts in Eagle. After some focused work today, I’ve sent the boards off to be made.

There are a couple of aesthetic aspects to these PCBs that are new for me: Larger size and different color. Both the control board and display board are larger than the 5x5cm (or less) size that I was always aiming for before. The larger boards give me a lot more room to play with when I’m routing the connections. It also lets me breathe a little easier knowing that the text sizes should be large enough to read… I’ve have cases where I made text too small just because I didn’t have space for anything larger. The boards will have black soldermask because I think it will make the LEDs stand out more and will hide the control board a little better. I’ve always gone with blue before.


As I mentioned earlier, this will be my first PCB with custom made parts designed in Eagle. The two parts that I made were for the power switch and the DS3231SN IC. The power switch is a tiny slide switch that I ordered a bunch of a while back. They’ve always been hard to use because of their somewhat odd form factor. The pins are tiny, it has two thick outer support pins, and has a 2mm pitch so it isn’t breadboard-able. I ordered digital calipers just to measure the switch’s pin thickness. Hopefully I got it right. If it turns out to be fine, I’ll probably make another PCB order for some breakouts for these switches.

The DS3231SN’s datasheet links to another document for its land pattern, which shows the spacing and sizes of the pads. The land pattern is clear so I’m confident that I made the part right in Eagle. Time will tell!

Since Eagle limits board sizes and the price for anything larger than 10x10cm would probably be too expensive anyway, I could only fit two digits on a board for the clock’s display. Each segment is made up of two parallel branches with a resistor and two LEDs in series. The resistor I plan to use are 1K 0805 surface-mount resistors. I tested them out in this configuration on a breadboard, thanks to my own 0805 breakouts. I chose the relatively high value of 1K because the brightness seemed to be just right, although it could still feel too bright when the entire display is put together. Time will tell on that as well.

I’m still trying to decide how I will put the two panels together. I want to have the colon in the middle of them, whether it’s made of LEDs or not doesn’t matter to me. I also don’t have much of a plan for an AM/PM indicator so the project may start off as a 24-hour formatted clock and be changed to a 12-hour clock in the future.

As you can tell, I’m still trying to get things sorted out even after the project milestone of getting the boards made being surpassed. I ordered the components for this project a couple of weeks ago from China so I hope they arrive soon. There are also a few components I’ll purchase locally when the other things start to come in.

Thanks for reading!

Clock Project Journal Entry #1: What is it, and what’s the point?

One of the things my desk is missing is a clock. Yes, I have a computer, watch, and phone that can all tell time, but when I’m in a full-screen game, I don’t want to have to go looking for the time. I’d rather have a clock large enough that I can simply glance at. First world problems, I know, but in any case, I thought that this would make for an interesting electronics project, despite how simple it may sound.

I will be making two custom circuit boards for this project. One will be the control board and the other will be the actual LED clock display. The project will be controlled by at Atmega328p microcontroller and the time will be kept by the DS3231 real-time clock chip. The LEDs will be driven with the help of some 74HC595 shift registers since it should make programming easier as opposed to multiplexing… I always gravitate toward using shift registers, I guess.

One of the things I wanted to make sure of was the LED configuration. As it sits now, each segment will have 4 red LEDs. At first, I tried driving them at their “full” 20mA each (so 80mA per segment) but I felt that it was too bright. Bumping up the current-limiting resistor brought it to a more comfortable brightness. With the higher resistor, the current drawn for the segment was about 4mA, which is low enough for a pin on the shift register to handle directly. With that, I don’t need any transistors, which makes me happy…

I was planning to use a single resistor for the four LEDs on each segment, but it’s bad form and I don’t want to go that route for the whole project. I already feel “guilty” about using shift registers instead of just multiplexing. I will be putting a resistor for each LED. The main reason why I wanted to go with the one resistor per four LEDs is because it saves space without having to go with surface-mount components. I’ll see how the layout goes with the 1/4 watt resistors and hope that I don’t have to go and get some surface-mount resistors. I’d like to use whatever I already have.
ds3231rtc_sch_1Here’s the schematic for the control board. The board layout is done, or at least the first draft of it is. The only thing left to add is a switch to either cut the power to the project or at least turn of the display. I haven’t decided yet. I’m planning on using some mini-slide switches I bought a long time ago but I need to create an Eagle part for it which may take a little time. I’m waiting on some digital calipers from Amazon so that I can measure the pin thickness.

The layout for the display is coming along slowly. There’s only enough space for two digits per board, which is not a bad thing since I could use them for other projects. The problem that does arise from not making them specific for the project is that I have to make a separate circuit board for the colon and AM/PM indicator (I don’t really want a 24-hour formatted clock).

That’s all I have to share for now. I’ll be back with more when more details get finalized. Stay tuned!

PS. I started working on this project about a week or so before Ahmed Mohamed’s clock incident happened. I found that to be a funny coincidence.