Close
0%
0%

4017 Decade Logic Clock

A digital clock that displays the time using LED's numbered from zero to ten.

Similar projects worth following
Update: If you'd like to get your hands on a kit with the inkjet printed PCB The Kickstarter campaign is over, but the leftover kits are for sale on Tindie. https://www.tindie.com/products/boltind/the-cd4017-decade-logic-clock-soldering-kit/


I've wanted to make a binary clock since I was a kid, and I've finally done it. My goal was to make a binary clock that uses only digital logic IC's to keep the time. A micro controller feels like cheating. It took quite an effort to get this clock working perfectly. I've gone through 4 or 5 versions over the last 9 months and at this point, it's a finished product. This clock will probably be the first in a series of similar clocks. The next clock could be a binary coded decimal clock, a vacuum florescent display clock, a tuning fork clock or all three. I've added the schematic diagram of the clock to the project files. If you'd like to make this on a breadboard, I won't say it will be easy but it

Here's how it works:

Clocks were pretty simple when it was just numbers on a dial and a motor turning the hands. it would be a lot simpler to just make an analog clock, but that would be boring! Keeping time with digital logic is pretty complicated, because the clock doesn't start a zero, it starts at 1. Also, the digits stop at 1, 2, or 5. It takes a lot of thought to make the digits count to 59, then advance the next digit while resetting to zero.

Here's how I did it:

A 32.768khz crystal feeds it's output into a 4060 14 stage binary ripple counter. This divides the crystal's output by two 14 times. It outputs a 2 hz square wave. This 2hz wave is twice as fast as we need, so it's fed to a 4027 flip flop to get a 1HZ signal that goes to the seconds ones counter. 

The seconds ones counter counts to ten, then resets to zero and advances the seconds tens. The seconds tens counts to 5 then resets to zero and advances the minutes ones. The minutes count up the same as the seconds, and advance the hours when the count reaches 60. The hours count up from 1, and reset to 1 when the hours reach 13. Resetting to 1 not 0 and counting to 12 is a little tricky. To do this I used an and gate that resets when the hours are 13. To reset to 1 instead of zero I offset the LED's on the hours segment by one. So instead of the one LED being connected to the one output on the 4017, it's connected to zero. Lastly is the CD4082BE dual 4 input AND gate. This AND gate senses when the count has reached 13 or 24 and resets the hours back to zero. But remember, the hours LED's are offset by 1 so when the count is zero, 1 is displayed.

How did you make that cool PCB?

I first heard of flatbed inkjet printers from a Make: magazine article, and after researching them a little more, I found this Hackaday article: "Get your PCB's made at the mall." This was just too cool, and I had to give it a try! So, I purchased a small elephant of a flatbed inkjet printer straight from China. I haven't actually had a chance to try making a PCB with it yet, but it sure does do an incredible job of printing high resolution photos straight onto PCB's. I'm pretty sure the ink is pretty much the same think used at a PCB fab house for silkscreen and solder mask. Instead of being limited to 5 or 6 colors, I can go all the way to the extreme of high resolution graphic pictures straight onto PCB's! Who ever said PCB's aren't an art form?

Adobe Portable Document Format - 168.44 kB - 01/11/2022 at 16:20

Preview
Download

spreadsheet - 25.27 kB - 01/11/2022 at 16:17

Download

  • The clock is now working perfectly. Updated schematic again.

    Ian Dunn04/28/2021 at 22:43 0 comments

    I just assembled another prototype of the clock, this time it worked nearly perfectly. I think I had some older vintage 4017 counters that worked on my breadboard, and the newer ones I used on the PCB version didn't work. I was able to replicate the problem on my breadboard, and I made it work after I changed a few pull-down resistors to a much higher impedance. I also realized the PCB was missing the 11 o'clock hour, and i solved this by removing the zener diode and capacitor on the hours segment. I changed all the zener diodes from 4.1V to 3.9 volts, I think the newer vintage 4017's were to blame for the difference. The tens digits weren't resetting to zero and switching to 3.9V zeners fixed it. I also changed the USB power plug to a USB B plug because it's through hole, and USB B cables are really easy to find. I changed the LED current limiting resistors to resistor networks just to save a few solder points, because it's seriously a lot of soldering! My next step is to get my hands on a really nice oscilloscope to fine tune the capacitors that make the crystal oscillate, and I'll be making yet another PCB before I call it finished. I'm also working on getting my hands on a flatbed inkjet printer so that I can print some cool art on the circuit board instead of being limited to just one silkscreen color. I'm imagining a matrix themed background of green 1's and 0's.

  • Uploaded Another Schematic​

    Ian Dunn03/31/2021 at 17:28 0 comments

    I just finished assembling my latest PCB and found that I t still wasn't quite working perfectly. I found that I was missing two key resistors in my schematic that I had on my breadboard, and the hours still wouldn't advance. So I've added the two resistors. and I found that I had an error with U1 (Hours ones) not advancing U2 (hours 10's.) It works perfectly on my breadboard but I was using a pair of 2n3904 NPN transistors to form an AND gate instead of the AND gate on the schematic. I think everything should work at this point.

  • Uploaded updated schematic

    Ian Dunn03/14/2021 at 22:36 0 comments

    This clock is nearly working. I soldered together the latest PCB, and it works pretty well except the seconds wouldn't advance the minutes, and the minutes wouldn't advance the hours. Long story short, I solved this by replacing a few 1n4148 diodes with some 4.3V zener diodes, and added a few small caps. if you build it on your breadboard, I won't say it will be easy but it should work!

  • Schematic diagram uploaded

    Ian Dunn02/20/2021 at 19:47 0 comments

    Based on your feedback, (thank you!) I've uploaded the schematic diagram of this clock. If you'd like to try building it on your breadboard, it should work. Thank you!

View all 4 project logs

Enjoy this project?

Share

Discussions

David Plass wrote 01/11/2022 at 14:11 point

Ian on the website the BOM lists the 4.3v zener part number next to the 3.9v description. Also the BOM lists 3k for the resistors not 2k. Thanks for the project!

  Are you sure? yes | no

Ian Dunn wrote 7 days ago point

Hi David, Thanks for catching that! I can stare at these things for hours until I think they are perfect, but I'll never catch them without another set of eyes like yours. I'll get this fixed!

  Are you sure? yes | no

Ian Dunn wrote 7 days ago point

All fixed. I'll have another clock and a mechanical keyboard coming down the chute very soon, so bee on the lookout. Thanks again!

  Are you sure? yes | no

David Plass wrote 7 days ago point

Thanks, looking forward to the new Kickstarters.

  Are you sure? yes | no

Yanzgz wrote 08/06/2021 at 14:53 point

It is recommended to take a look at my design and pay attention to the power grid frequencies of different countries:

https://oshwhub.com/yANgZEN/shuo-zi-dian-lu-cd4017-liu-shui-deng-shi-zhong

  Are you sure? yes | no

Ian Dunn wrote 08/07/2021 at 04:30 point

That's super cool! Looks like you had the same idea. I'm a power grid operator, and I know exactly how much the grid frequency varies. If you ask me, it's not very reliable for keeping time. I used a 32.768khz crystal for the time base. 

  Are you sure? yes | no

Yanzgz wrote 08/08/2021 at 01:05 point

Thanks for the comment. I also have a feature in my circuit that switches the brightness at 6:00 

  Are you sure? yes | no

Ken Yap wrote 08/08/2021 at 01:24 point

The power grid does however keep time in the long run so "autocorrects" whereas a bare crystal will have drift. If using a MCU one of those TCXOs like the DS3231 are lots better than a plain crystal.

  Are you sure? yes | no

Ian Dunn wrote 08/08/2021 at 23:24 point

maybe it just gives me a nasty taste of work to see time error on my clock, because I'm the one who has to do something about it. in the western interconnection, we stopped doing manual time error corrections about a year ago. Time error does get corrected somewhat by inadvertent interchange payback, but if there were 10 seconds of positive or negative time error nobody's going to jump up and do anything about it as quickly as we used to. In the Eastern interconnection, I beleve they still do manual time error corrections. When the time error gets above a half a second or so, then the target frequency is changed to 58.98Hz or 60.02Hz until the time error is corrected.

  Are you sure? yes | no

steverddrf wrote 03/15/2021 at 17:25 point

In 12 hour mode hours 10's goes to 0 at 12 twice a day, this could be used to set and reset a 2 or 3mm LED as a PM indicator, possibly with the unused half of the 4027.

 Adding a switch for setting mode to enable the set buttons and disable the clock while setting is in progress would be usefull.

  Are you sure? yes | no

Ian Dunn wrote 03/16/2021 at 01:40 point

I considered the idea of the PM indicator too, and I guess i drifted away from it. I may just try to do this later on. First thing is to get it all working on a PCB, then fine tune and prefect it. I think I will end up changing the seconds to just reset to zero. That's how I had it on my other two clocks. The flip flop is high every 1/2 second, so pulling the seconds square wave high while it's already high doesn't do anything.

  Are you sure? yes | no

Ian Dunn wrote 03/31/2021 at 17:30 point

Steve, how's your clock coming? Did you get your parts yet? I just got another PCB put together and it still didn't quite work correctly. I posted a log entry, and uploaded another schematic.

  Are you sure? yes | no

steverddrf wrote 04/01/2021 at 00:16 point

Using 2 descret tansistors is still in the spirit of the project :)

All the components are here, first attempt ended when I plugged the psu into the wrong end of the bread board and reverse polarityed it, other isseus such as chips having legs mangled and broken in the post and being tied up on another project :(

32.768 clock not running for some reason, probably different capacitance required when I get the chance to look at it.

  Are you sure? yes | no

steverddrf wrote 03/14/2021 at 23:41 point

I have drawn the Schematic in EasyEDA and am converting it to an SMT version :)

I think a method for fine adjustment the crystal frequency is going to be required for acurate time.

Adding a 7th 4017 would give a day indication :)

  Are you sure? yes | no

Ian Dunn wrote 03/15/2021 at 01:47 point

Cool!

I can't wait to see it! :) I don't know if I mentioned that I'm simultaneously working on 2 other clocks similar to this one. Once I get them a little more fine tuned I'll probably make an SMT version of them (and separate Hackaday projects) too.

  Are you sure? yes | no

steverddrf wrote 03/17/2021 at 22:16 point

Once this project is finished I have another clock suggestion for you, one that has workday temporal compensation :)

  Are you sure? yes | no

steverddrf wrote 03/14/2021 at 13:12 point

You could change the display on/off switch for a 3 way one to give a dim setting by using one or two diodes to gound, K3-2346D will do it (th), or K3-2346S (smt)

:)

I have ordered the parts and will be building one on a breadboard.

  Are you sure? yes | no

Ian Dunn wrote 03/14/2021 at 14:28 point

Awesome! I'll be excited to hear how it goes! I'm with you now on the 2 pin micro USB, I found what you are talking about. It's perfect! I ordered some. I did change the schematic last night. I've got it working on a PCB at the moment, except the seconds didn't advance the minutes and the minutes didn't advance the hours. It worked on my breadboard, or so i thought. I fixed this by changing the diodes that go from reset to output 6 (on the 4017's) to a 4.7V zener, and I added a small cap from output 6 to ground. This causes the next digit to advance before the lower digit resets to zero. It was missing the pulse. So, you'll need some zeners (about 4.3V) in addition to everything else.

  Are you sure? yes | no

steverddrf wrote 03/13/2021 at 17:03 point

For the power socket I suggest a 2 pin micro usb, as it is sutable for both trough hole soldering and SMT. The EASYEDA footprint is a user created one  MICRO-USB-SMD_U254-051T-4BHJ25-F2S_MINE_POWER_ONLY

£20 per 1000 on Aliexpress, search for

1000Pcs Micro Usb 2Pin B Type Female Connector For Mobile Phone Micro Usb Jack Connector 2 Pin Charging Socket

You could buy a smaller quantity such as 20 for £5,  yes I bought 1000 :)

The footprint does not have a symbol, so you will have to make your own and link it to the footprint, I have done this but have to double check the polarity on mine :)

One thing missing from the schematic is the Load Capacitance ( CL ) of the crystal ?

For setting the seconds it may be easyer if the button were conected to the Reset pin on C6 rather than adding to the clock pin, that way it goes to zero when the button is pressed.

  Are you sure? yes | no

Ian Dunn wrote 03/13/2021 at 19:50 point

Thanks Steve!

These are all good ideas. I think I'm going to try to do a DC barrel jack and a micro USB like you suggested. This will add a little more flexibility. Micro USB looks really nice, but it's not the easiest to solder. I'll probably add an L7805 so the barrel jack can be used with any voltage too. I'm not sure what you mean about the load capacitance? The way I put it together works great, but I suspect you may know a better way. It is a little tricky to make the crystal oscillate at exactly the rite speed. Through weeks of trial and error I've found that 10pf and 30pf makes almost exactly dead on. If you ask me there's not a whole lot of information out there about crystals.

  Are you sure? yes | no

steverddrf wrote 03/13/2021 at 21:10 point

The micro USB that I suggested are very easy to solder as they only have 2 well spaced pins, it was the famouse Big Clive that found them, ideal with a poundland cable :) https://youtu.be/ZE5JASv3XyY?t=1414

There is a formula for calculating the capacitors required, but it requires the CL of the crystal to be known. There are 3 specifications for a crystal, frequancy, accuracy, and the CL capacitance

  Are you sure? yes | no

steverddrf wrote 03/07/2021 at 17:55 point

How about making the PCB 100 x 100 to take advantage of the offers from the various PCB manufacturers, or sizing it to suit photo frames that it could be mounted in ?

As a kit then through hole will be more popular but look awful unless the chips are on the front, a SMT version would look tidy with the chips on the back and would sell more if the chips were pre soldered, JLCPCB are currently offering a free setup for SMT assembly :)

Edit, I did a quick check and the 3 chips are in the extended range so there is small charge for loading the magazines onto the pick and place machine, I think it's around £1.50 each

  Are you sure? yes | no

Ian Dunn wrote 03/11/2021 at 18:51 point

You think like I do! I think I'll do all of this. I just have to get all of it working perfectly, then I'll develop an SMT version. 

  Are you sure? yes | no

Ian Dunn wrote 02/19/2021 at 18:02 point

Thank you all for your feedback! I'm going to offer this as a  soldering kit on Kickstarter. goal number one is to make it affordable. I don't actually have a working PCB prototype yet. The first attempt didn't quite work. It's really tricky to get the seconds, to count to 60 then reset to zero, advance the minutes and so on. Once it's working I'll be sure to post an update! in the meantime I've added my schematic diagram.

  Are you sure? yes | no

Andre wrote 02/18/2021 at 04:45 point

Please open source the project. The satisfaction of your work being reproduced worldwide is amazing. If you don't then all that is left is this article and some photos on the Internet... Open Source also allows others to suggest modifications and improvements. Yes, you will get some negative comments etc... just ignore them!

  Are you sure? yes | no

nerill.dp wrote 02/17/2021 at 20:30 point

I kinda like the module without the faceplate. Nice project. I agree about having a dilemma about how to offer this. I too am a proponent to open-source, but it's clear you have spent considerable time on this and it truly could be a commercial product. I've heard of at thing called "Common Clause" that somehow works like open source but protects for commercial use. It appears mostly to relate to software though.  I can't give you all the details, it's pretty  complicated. Maybe, you might want to try a lawyer: hopefully you can find a free or cheap one just for consult. 

  Are you sure? yes | no

Ian Dunn wrote 02/19/2021 at 18:09 point

Thanks Nerill!

I'm thinking the best way to share it may be to open source the schematic, and offer the PCB as a soldering kit on Kickstarter. This way you could build it on a breadboard if you wanted to, or buy the soldering kit if you want a more permanent version.

  Are you sure? yes | no

nerill.dp wrote 02/19/2021 at 20:33 point

Now, that would be a fun kit. Add my name.

  Are you sure? yes | no

Brendan Leber wrote 02/17/2021 at 19:57 point

I hope you do make it available because I would love to build this for my office.

  Are you sure? yes | no

Ian Dunn wrote 02/19/2021 at 18:10 point

Thanks Brendan,

Once I have a final prototype, I'll have it on Kickstarter, and I think I'll probably open source the schematic.

  Are you sure? yes | no

Mike Szczys wrote 02/16/2021 at 15:32 point

Came out great! The spacing between the functional PCB and the faceplate turned out great!  Did you use the faceplate as a jig for soldering the through-hole LEDs?

  Are you sure? yes | no

Ian Dunn wrote 02/19/2021 at 18:05 point

Yes, I sure did have to use the face plate as a soldering jig. I think I may just ditch the face plate. You have to solder the ic's directly to the board in order to have enough room for the LED's to poke out, and I'm not sure that it really adds a whole lot.

  Are you sure? yes | no

Alexander R Pruss wrote 02/09/2021 at 00:12 point

This looks really elegant! 

BTW, I don't understand why most of the binary clocks I see use BCD instead of plain binary. 

  Are you sure? yes | no

Jon Mayo wrote 02/09/2021 at 18:30 point

This is BCD.

  Are you sure? yes | no

Ian Dunn wrote 02/09/2021 at 20:49 point

Thanks! I'm glad you like it. I think this is because every single counter chip out there outputs it's count as a binary coded decimal instead of a zero to ten count, except the 4017. Stay tuned for more!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates