Author Topic: Binary clock schematic  (Read 9252 times)

0 Members and 1 Guest are viewing this topic.

Offline kickenTopic starter

  • Contributor
  • Posts: 22
  • Country: us
Binary clock schematic
« on: November 23, 2016, 11:01:49 pm »

I've been working on a circuit to create a binary clock.  This is my first step into something beyond simple 555-timer based flashing lights.  I think I finally have a design done and would like to ask for a critique of it.  I've attached an overview of the complete schematic and I'll try and briefly describe why I did what I did.

Clock Signal
I started with the 555-timer and tried to set it up to generate a simple 1 Hertz clock signal.  I'm aware this will not be super accurate and I'm ok with that for now. I used this calculator to determine the resistor and capacitor values to generate the signal.  I wired this up on my breadboard and it seemed to work fairly well.


Time Counters
I settled on using some SN74HC161 4-bit Synchronous Counter chips along with some CD4063 4-Bit Comparators to keep track of the hours minutes and seconds.

For the seconds I have two cascading counters.  I feed the output of those two counters into two comparators to determine when the counters reach 59.  Once 59 is reached I turn on the transistor causing the counters to reset to zero. At the same time the minutes counter is enabled allowing it to +1 on the next clock pulse.


The minutes counter is basically a duplicate of the seconds counter.  Once it reaches 59 I enable the hours counter so it will +1 on the next clock pulse.

I decided to only go to 12 on the hours so I could use a single counter and comparator.  The hours works the same just without any next stage to enable, only a reset to zero.

I'm resetting the counters by using the load function to load them with zero.  This is so that the zero load happens in sync with the clock and also because the reset pin is being used by the power on reset.

Power on reset
This is a circuit I found that will keep the reset pins held low briefly during the initial power on so that all the counters start at zero and the circuit can initialize.  I found this circuit after spending some time searching as I knew I needed something but was not sure how to create it.  I did some simulations in LTSpice to check that it was working as I thought it should.


Other notes
I didn't include a .1uf cap for each IC, instead I did one for the 4 seconds ICs, one for the 4 minutes ICs, one for the 2 hours ICs and one for the 555-timer.  I'd like to try and build a PCB for this at some point and thought I could save some space there.  I mostly have through-hole components which eat up the board space and I'd rather use what I have for the resistors/caps rather than order new stuff.

I do not currently have any of the counter or comparator IC's so I have not been able to test that part of the design.  What I have is just based on the datasheets and what I think needs done.

The counter outputs will be connected to some LEDs to display the binary output.  I did not include those in this schematic since they would not be part of the board if I get it created. The datasheet says the outputs can supply 20mA which I believe is enough to drive the LEDs directly.

I'll likely order the parts I am missing soon so I can start trying to bread board everything.  I'd appricate any advice you all can give in the mean time though, like if there's any fatal flaws in the design that would make it not work or if my parts selection is poor.

Thanks
 

Offline obiwanjacobi

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Binary clock schematic
« Reply #1 on: November 24, 2016, 07:45:53 am »
The stability of your clock depends on that RC network. Make sure you pick low tollerance parts (check temprature coefficient).
Smaller (non-electrolitic) caps tent to be 'better' than electrolitic caps. That would mean a higher frequency which you can bring down again with (digital) dividers/counters.

[2c]
Wrong code should not compile!
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Binary clock schematic
« Reply #2 on: November 24, 2016, 08:47:49 pm »
Maybe you can use CD4060 to drive a 32768Hz oscillator and divide it down?
 

Offline kickenTopic starter

  • Contributor
  • Posts: 22
  • Country: us
Re: Binary clock schematic
« Reply #3 on: November 25, 2016, 01:12:37 am »
Thanks for the suggestions.  I thought I would look into the clock source as something to improve as maybe a Rev 2.0 change. 

I have a handful of 555-timers on hand and I'm reasonable comfortable with them so that is why I went that direction for now.  I added the small trimmer resistors to try and work around any tolerance issues and get as close as possible to the 1Hz signal.


 

Offline barry14

  • Regular Contributor
  • *
  • Posts: 102
  • Country: us
Re: Binary clock schematic
« Reply #4 on: November 25, 2016, 01:44:48 am »
Your description says that the clock counter is reset to zero after reaching 12.  That will not work for a clock which has to reset to 1 not 0.
 

Offline kickenTopic starter

  • Contributor
  • Posts: 22
  • Country: us
Re: Binary clock schematic
« Reply #5 on: November 25, 2016, 07:18:51 am »
Thanks.  I was thinking of a 0-based hours system but you are correct that how I have it setup now is not correct  :palm:, it should be triggered on 11 not 12.

However after looking at it again I think I have another problem in that the hours would be counting throughout the entire 59th minute as it's currently configure, so back to the drawing board.

I did finally order the counter and comparator ICs so I'll be able to start actually trying things out to find problems rather than just doing it all in my head.

 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Binary clock schematic
« Reply #6 on: November 25, 2016, 02:38:46 pm »
Thanks.  I was thinking of a 0-based hours system but you are correct that how I have it setup now is not correct  :palm:, it should be triggered on 11 not 12.

However after looking at it again I think I have another problem in that the hours would be counting throughout the entire 59th minute as it's currently configure, so back to the drawing board.

I did finally order the counter and comparator ICs so I'll be able to start actually trying things out to find problems rather than just doing it all in my head.
You can reset into 0 and go for 0-23 as hour (that is, 24-hour system)
 

Offline Zom-B

  • Regular Contributor
  • *
  • Posts: 55
  • Country: nl
Re: Binary clock schematic
« Reply #7 on: January 25, 2017, 07:31:53 pm »
  • You don't have to daisy-chain the a>b and a<b lines if you're not going to use those values anyway. Just tie the input to the closest (as in, on the PCB) power trace.
  • Hang TTL (7402,74161) inputs that you don't care about to V+ to prevent unnecessary input current. For CMOS (4063) it doesn't matter.
  • Series resistors for your LEDs?
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7179
  • Country: de
Re: Binary clock schematic
« Reply #8 on: January 25, 2017, 08:15:19 pm »
I like your seconds/minutes design, especially that it's synchronous. It should work.
Concerning the reset: don't mess around with that kind of stuff, it's more complicated than you think (power on-off-on with vharge on the cap etc.)
Just use an MC34064/34164 or something equivalent, they're fool proof.

You'll need to think about your hours counter.
If you go for a 12-hour clock, it'll go from 1 to 12 with an am/pm indicator that's "out of phase" (12 to 1).
For a 24-hour clock, it will run from 0 to 23.

Ideally, it would be switchable.  :)

 

Offline magetoo

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: se
Re: Binary clock schematic
« Reply #9 on: January 25, 2017, 09:34:46 pm »
A thought for a 12/24 hour clock - first build a 0-11 hour count with AM/PM indicator, then hang a 4-bit adder off the hours counter.

12 hour display:
Always add 1 to the count.

24 hour display:
Add 12 if PM=true.  (Carry out is the fifth digit.)

It would have the benefit that the hours counter always runs in the same mode, and the "conversion logic" only affects the display.
 

Offline kickenTopic starter

  • Contributor
  • Posts: 22
  • Country: us
Re: Binary clock schematic
« Reply #10 on: January 25, 2017, 10:20:51 pm »
Thanks for the suggestions.  I hadn't really given much thought to trying to do 12/24 hours or even an am/pm indicator.  Didn't feel necessary for me personally but it sounds like a good task for v2 of the schematic along with trying to create a better clock source.

The schematic from my original post is a bit out dated, I found some issues when I finally did wire it up.  An updated schematic is in my associated PCB thread for those that are curious.

The main problem I had with the original design was that the way I handled zeroing out the minutes and seconds didn't work.  Even though the loading function is synchronous, it does so on the next clock regardless of the state of the enable pins and as a result the counters would zero out too soon. I mis-understood what the enable pins do when I first read the datasheet.  As such I re-worked the schematic to use the reset pin for both the power on reset and the zero reset.

  • Series resistors for your LEDs?

I left the resistor and LEDs off of the schematic and instead just put the signals out to header pins.  I knew when it came time to do a PCB the through-hole resistors would eat up too much space and I didn't want the LEDs attached directly to the board so I could maybe design some kind of case for it and have the LEDs separate with just some wires going to them.  I still haven't gotten to that stage yet.

For v2 I will switch to SM resistor and capacitors based on the recommendations from the PCB thread.  At that point I may go ahead and put the resistors on the board but I think I'll still leave the LEDs separate.

 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21608
  • Country: us
Re: Binary clock schematic
« Reply #11 on: January 27, 2017, 05:00:26 am »
Forget the 555 as a timebase for a clock. After careful tweaking and using high tolerance resistors and capacitors with very low thermal drift you will still be lucky if it drifts less than several minutes a day. It's very easy to attain accuracy to within several minutes per year using a quartz oscillator. Another approach which I've used in a number of nixie tube clocks I've built is to sample the AC mains frequency. That has a small amount of short term drift throughout the day but the long term accuracy is excellent.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Binary clock schematic
« Reply #12 on: January 28, 2017, 03:07:39 pm »
You can try create a 4Hz time base using a 32768Hz watch crystal, CD4066 to divide it down.

A few GAL22V10 to implement tge remaining logic. This depends on programmable logic though.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21608
  • Country: us
Re: Binary clock schematic
« Reply #13 on: January 28, 2017, 07:35:40 pm »
GALs are very old tech and they are getting hard to find, they're all discontinued at this point and nobody is using them for new designs. If one wanted to experiment with programmable logic then a CPLD would be the way to go for a clock. That kind of defeats the purpose of building something with jellybean logic though.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7179
  • Country: de
Re: Binary clock schematic
« Reply #14 on: January 28, 2017, 08:22:02 pm »
The MC14060/CD4060 already contains the oscillator and will give you a 2 Hz output from a 32 kHz crystal. Dividing that to 1 Hz with a flipflop is no problem.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->