BCD (Binary Coded Decimal) Clock

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
Hi Everyone

I was studying binary the other day and came across a binary clock. It uses BCD (Binary Coded Decimal) to display the time. I thought that this was a really novel idea and would be an ideal little project. I searched Google and sure enough I was able to find a schematic for one.

I will be working at a summer camp for a few months in the summer, delivering classes in electronics and thought this would be an ideal project for the more advanced students. So I set about studying the circuit and "attempting" to tweak the circuit a little to meet my needs... this apparently was a little more dificult than I first anticipated. I would direct my questions directly at the author of the wonderful website that I got the circuit from Bill Bowdens Hobby Circuits however when I tried to contact him, the email just bounced straight back.

Please FOLLOW THIS LINK for information on the circuit that I'm discussing.

So anyway... enough of my rambling and actually onto my questions:

  1. I understand that the 60Hz frequency is derived from the mains, however I would like to power the clock from a 9V PP3 battery, therefore I'm looking to use a crystal instead, but struggling to work out how? I've read about using a crystal combined with a 4060 instead of a 4040 chip?
  2. I was thinking of using something like a 7805 voltage regulator to get the correct power for the chips, would a 0.1A model be suitable or maybe the larger 1A version?
  3. Would the resistors for the LEDs need adjusting at all and would it be ok to use a commoned SIL resistor package for the hours, minutes and seconds instead of 19 individual resistors?
  4. How could I make it 24 hours? I presume I need to add another LED to the hours 74HC390 as there is only 5 on that one currently and 6 would be needed. Although I'm struggling to understand how the 1N914 diodes work for the 13th count that is mentioned in the accompanying text.
  5. I'm assuming that the lines connecting pins 3+4, 7+15, 12+13 on the 74HC390 are links between the pins on the chip? I've never seen a schematic before that has wires going over chip symbols.
  6. Does anyone have any experience/tips in manufacturing double sided PCBs? I have made single sided ones before using the photographic method (UV Light Box and Tri-tank, develop, wash and etch unit.)
  7. One final question... for now at least! I am struggling to get the CD4040 - 12 Stage Binary Counter and also the CD4071 Quad OR gate, will a 74HC4040 and also 74HC32 be suitable replacements?

Looking forward to hearing from anyone, any help is much appreciated! :)

Kind Regards

Edward
 

crutschow

Joined Mar 14, 2008
34,285
1. You can use a CD4060 with a 32,768Hz watch crystal to get a 2-second pulse. Divide that by 2 with a FF to get a 1-second count for the input to the 1-second counter.

2. The 1A model would be better for powering all the LEDs.

3. You can certainly use a resistor package for that.

4. I'll try to get back with you on that.

5. That would appear to be true.

6. I would suggest using a prototype vendor like ExpressPCB or PCBexpress. If you want to roll you own I have no experience there. Two sided is obviously a lot more difficult since you must precisely line up both sides of the board and then drill (and jumper wire) all the feedthrough holes.

7. 74HCXXXX devices preform the same function as the CDXXXX devices, but are designed to operate on 5V (7V max.), which should be OK for that circuit.
 
Last edited:

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
Thanks for your fast response. Please bear with me because I'm a little rusty with my electronics at the moment and a lot of this stuff is completely new to me.

  1. So what you're saying is, if I get a 32.768KHz watch crystal I can use a 74HC4060 which is a 14 stage binary ripple counter and will divide the input by 16384... giving me an output frequency of 2Hz? Then I need to put this into another flip flop to divide the output once more to obtain the 60Hz output I want? I am guessing the use of the first two NANDs and the OR gate is no longer required? Although I'm not sure how the two set buttons for the minutes and hours would work or be connected? I'm really sorry if these sound like simple questions but I'm really trying hard to piece all of it together and understand it as best as I can... because if I'm successful in creating one I will need to explain the theory behind it to students when I'm teaching it to them! I looked for a 15/16 stage binary ripple counter and was disappointed to see that such a thing didn't exist :( Neither could I find a crystal that worked on half the frequency!
  2. That's fine, are there any other alternatives? I'm just concious of the requirement for a heat-sink with the 1A version probably?
  3. That's great to hear about the resistor pack, because it should make the artwork a little simpler. 220R is fine I assume because the guy mentions his circuit producing about 8V over the smoothing capacitor. Using an LED resistor calculator, with 5V source, 2.2V typical voltage and 220R resistor the current drawn is 12.727mA and the LEDs rating is 15mA.
  4. Thanks, your help is much appreciated. I haven't done any of this sort of stuff for years and I'm sitting hear with pages and pages of datasheets trying to work out what it's all doing! Reading the description he gives, my idea would be to add an LED to pin 11 of the hours counter and instead of connecting the signal diodes to pins 3 (1), 5 (2) and 13 (10) which makes 13, connect them to 3 (1), 6 (4) and 11 (20) which makes 25? Just a thought, not sure if it's correct or not.

    Whilst on this 74HC390 counter, the datasheet says it divides by 2 and 5. And on looking at the schematic the input pulse is 1, which is then output on 3 and fed into 4 (the divide by 5 input) and then output on 5, 6 and 7, before feeding into the input of the second counter and repeating. So I understand that we are putting decimal in and getting a binary representation out in effect, but I'm a little confused by the divide by 2 and 5 part? :confused:
  5. Cool, no worries then... as explained in previous point... it would make sense if this was the case.
  6. I am trying to limit the PCB size to 100mm by 160mm which is the full size of a small piece of board and already struggling to route them using 0.2" tracks and double sided routing. I'm using a program call Circuit Wizard to convert from the schematic to the PCB artwork. I will give double sided a go, using a single sided UV light exposure unit might be a little fun though... thinking maybe using some sort of registration marks? I really can't afford a prototype vendor I'm afraid and the idea is, if it's not too complex to make I can teach more advanced students how to make one.
  7. That's good to know, I think I will go with all 74HCXXXX chips then because it would seem to make sense to use all the same type.
  8. One more quick question, I read somewhere about tying all un-used logic gate inputs on logic chips to ground, is this really necessary? It's not a problem if so because I can just zap them all together on the artwork if needs-be. Also this is just the inputs? The outputs can just stay not connected to anything?

Sorry for being such a noob with all of this, just want to make sure I'm asking the correct questions and not confusing anyone... especially myself! :rolleyes:
 

crutschow

Joined Mar 14, 2008
34,285
1. The flip-flip divides the 2Hz signal from the 4060 by 2 to give a 1Hz signal that goes the clock input of the seconds counter. You don't need 60Hz for anything so the 4040 on the left is not be needed. I'm haven't tried to figure how the Set buttons work but if they need a faster clock for faster setting, then you could tap off one of the higher frequencies from the 4060.

2. The heat sink depends upon the current flow and the regulator input voltage. The current is mostly determined by how much current you run through the LEDs. To minimize current draw you could use high brightness types and run them at a lower current (perhaps 1 to 5 mA by increasing the series resistor value. Experiment to determine the minimum current that gives acceptable brightness). This would also extend battery life.

By the way, you circuit won't run very long from a 9V battery due to all the LED current. You might consider using four D-type alkalines in series which would give about 6V and about 10 times the battery life. With that supply you could likely run the circuit directly without a regulator.

4. I'll defer comment on that for the moment.

6. 0.2" tracks seems rather wide. Do you mean 0.02" (20 mils)?

8. That's a definite yes. All unused CMOS inputs must be terminated (high or low as required) or you will get erratic results from the floating inputs since their logic level becomes indeterminate. Outputs can be left open.
 

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
1. Ok, no worries. I will be prototyping the circuit using breadboard anyway before I proceed with PCB manufacture anyway. Please could yet look into the section that feeds into the seconds counter for me and the set swtiches? I understand the principle of what we are trying to do, but I'm not overly confident about doing it!

2. I have looked into this and found LEDs that will run on as low as 2mA and still give a constant output luminosity. Using 6V as you suggest will allow me to use these LEDs and a 1.5K resistor to operate them at 1.95V and approximately 3mA. This eliminates the requirement for any voltage regulation, simplifying the circuit greatly.

4. Thanks, much appreciated.

6. 0.2" tracks seems rather wide. Do you mean 0.02" (20 mils)... yes sorry! :D

8. No worries... this will have to be something I remember to do when converting the schematic to an artwork!

Thinking about the issues with the complexity of the board... I've decided to make two boards, one for the control circuitry and then one for the outputs and space them apart from each other. I'm also looking at using 4xAA batteries and mounting them on the back of the control board. I feel using D sizes will make it too bulky and heavy.
 

crutschow

Joined Mar 14, 2008
34,285
1. It appears that the set switches just apply a higher frequency clock pulse to the counters to allow rapid setting of the time for minutes and hours. The circuit uses the 60Hz divided by 8, giving 7.5Hz for the set frequency. So you could use pin 1 output (Q12) of the counter with the 32,768Hz oscillator to give a set-clock frequency of 8Hz.

An AA alkaline cell typically has somewhat over 2000 mAh of capacity. Assuming on average, half of the LEDs are on, the average LED current would be 10 x 3mA = 30mA. The clock will then run only about 2000/30 = 67 hours on one set of batteries. Thus you can see why the origninal design operated the clock from 60Hz power. Leds are power hungry. ;)

Interestingly, I've had a novelty clock near my computer for many years that displays the time with LEDs in a binary fashion, just as your project does. But it was built with the leds in a vertical format (hours on left, larger values on top), not the horizontal format shown in your schematic. It's powered from a wall-wart.
 

takao21203

Joined Apr 28, 2012
3,702
I made such a clock (although from 40xx ICs) a while ago.

I was asked to produce more constructive replies and it was explained to me some members here are beginners or they only do electronics as hobby.

So here you go.

It took me about two weeks, back then there was no internet. At one point for instance I made copies from the IC pinouts, and glued them together.

Made a frame from aluminium bars, and attached the IC holders to that with thick copper wire- no PCB!

I used a 3 1/2 digit LCD, and a proper reset sequencer that would set the time to 0000 when you insert the batteries. As well I used comperators for the 12 HR rollover, and a flip flop to toggle a triangle on the LCD (for AM/PM).

It worked many months from 4x AA batteries.

IC count was about 20 ICs, including a small crystal oscillator with a PI network for calibration.

It was working quite precize only a few seconds deviation/each month.
 

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
Thanks, that seems to make sense :)

Scrap the idea of batteries altogether... I wanted to go down the battery route to make it portable and avoid transformers etc. When you mentioned "wall warts" it got me thinking! Why hadn't I thought about this before?

Then I thought about price though and what voltage I actually needed? I only need 5V... so what uses or makes 5V I though? I know EUREKA moment! USB! A small switch mode wall plug costs all of £1 and can be used with a simple A-B type USB lead! If the user has a computer with always powered USB ports they can also use it with this or if not they can use the wall plug.

So I think this is the way forward, but do I still use the more expensive low current LEDs at 14p a piece and run them with a 1K resistor to give them 3.05mA each or do I go to normal cheap LEDs available in packs of 100 and 220R resistors? Should I spend more money and try to save the environment or not? :rolleyes:

I have to admit I am a little ashamed of how messy it looks. I have attempted to draw the circuit up myself and modify it to run using 5V. The battery will be replaced with a USB connection on the actual artwork. The reason for the messy schematic is because all references to 5V or ground were shown separately in the original schematic but unfortunately I have to link all mine together for the PCB conversion. The second reason it looks messy is because I couldn't find the 74HC390 in my simulation program so had to use a generic 16pin DIL and the pin layout of course isn't the same!

All chips that appear to be missing power supplies, actually do have a hidden digital supply, which is automatically connected up when converted to a PCB.

There's one slight problem... it doesn't seem to work. I'm not expecting there to be any outputs on the seconds, hours and minutes chips because I can't simulate them, although I am a little disappointed that the clock isn't working. I'm really not sure at all if that bit of the circuit is connected correctly at all to be honest. I found a circuit which I copied the values from so really don't know if they are correct. I would be really grateful if someone would mind having a quick look at it and potentially spotting any glaringly obvious mistakes with the schematic.

Fingers crossed I hope I have managed to attach it correctly.
 

Attachments

takao21203

Joined Apr 28, 2012
3,702
14p is a lot when you want to use many LEDs.

I can get them for 2 cents/1000pcs bags, and resell small quantities for 3 cents.

Clear 4.8mm straw hat LEDs, red, blue, or UV.

They are happy with 1mA or 2mA already.

You can buy 1000pcs bags yourself but maybe you don't want to have them around or to wait 2 to 3 weeks.

Actually your circuit has a serious mistake. The oscillator can not work at all from what I see.

Where did you see this circuit?

It is old technology to build a crystal osc for 32 KHz that way. These 74xx circuits typically have some 100ppm deviation because it is not a proper way to use a crystal. One workaround is to build a PI network with a trimming capacitor. Good results can be obtained from that. The circuit is inside the CMOS cookbook.

Normally I use a controller or real time clock IC for that myself, but I also have a crystal osc here from 2n3904 (32 KHz watch crystal) and apparently a 4060 to divide down. No schematic, from the web, but changed, and quite hard to find. With some effort I could draw it from the circuit. I still have it around here.

Once your oscillator works, probe into the circuit with LEDs etc. to make it work step by step. You can also simulate it in Wincupl since it is from logic gates. LTSpice also maybe works I have never tried it for that kind of circuits.
 

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
The input to to 4060 was taken from a typical crystal circuit on the 74HC4060 datasheet. The values were taken from a circuit that a colleauge had but it had a similar arrangement. I really don't want to use a PIC or similar because the whole clock could be made with one. I'm using it as a learning exercise :)

Assistance in making the 1Hz signal would be greatly appreciated. Once I've got that the circuit is cracked I think.
 

takao21203

Joined Apr 28, 2012
3,702
The input to to 4060 was taken from a typical crystal circuit on the 74HC4060 datasheet. The values were taken from a circuit that a colleauge had but it had a similar arrangement. I really don't want to use a PIC or similar because the whole clock could be made with one. I'm using it as a learning exercise :)

Assistance in making the 1Hz signal would be greatly appreciated. Once I've got that the circuit is cracked I think.
Yes I guess so from what you outlined in the first post.

But I believe what you have drawn in the PDF can not work.

Also as far as I remember the 4060 can not work with watch crystals directly? As I say I have such a board here somewhere, some 2n3904 and a 4060.

In your drawing you inline an inverter in series from the crystal and that looks uncommon/weird to me.
 

takao21203

Joined Apr 28, 2012
3,702
Ah. That question is answered for me- the 4060 can handle a watch crystal then. Build it exactly as shown. They use a PI network there as well or something similar to that, for compensation.

You'd have to wait a week, start the clock at zero crossing seconds, and maybe you get a few secs deviation. Then turn the trimmer a little, wait another week, see the result.

I do not know why you think the additional inverter is neccessary or beneficiary. And you do not use XI/XO in your schematic like on the web page.
 

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
XO is pin 9 on my program. The clock input is pin 11. Is there no way of doing it without a variable cap? I said before in my previous post that it is there because it was there on the circuit from Bill Bowden. I obviosuly don't need it then?
 

takao21203

Joined Apr 28, 2012
3,702
XO is pin 9 on my program. The clock input is pin 11. Is there no way of doing it without a variable cap? I said before in my previous post that it is there because it was there on the circuit from Bill Bowden. I obviosuly don't need it then?
Hmm. I remember the 4060 uses XI/XO where X means XTAL (crystal).

You would not want to use the clock input for crystal operation. As far as I remember yes it also has a clock input.

Can you show that circuit in question from Bill Bowden?

Of course you can totally omit the extra parts and simply connect the crystal. Then test what capacitors you need. Having a ceramic capacitor kit is useful here.

If you can live with deviation, no trimmer cap required.

You can also use ceramic caps, however, you have to test individually which ones give you the best result. They are highly dependent on temperature, and they do age, and all that.

For your purpose, maybe does not matter.

For a PCB Kit, a trimmer cap. should be there. Futurlec has them, even if it does not make sense to order just a few caps, and then wait 3 weeks. you'd have to pool orders, or get them through eBay or from a forum member.

Maybe you could try Farnell as well, no minimum order. It is OK only to order 40 dollar or even less from them.
 

takao21203

Joined Apr 28, 2012
3,702
Don Lancasters original circuit only uses inverter gates, no 4060. And the compensation network. Unfortunately I do not have a copy here of the book.
 

takao21203

Joined Apr 28, 2012
3,702
Well I know in some cases instantly.

Bill's circuit is deriving a signal from the 60Hz mains.
It is not meant to be used with a crystal.

Really the circuit on the other website looks fine to me.

Neccessary parts...

I could say they are all neccessary as shown, but in reality, you can often get away with removing parts. It is an art actually.

Connecting just the crystal nothing else would be a starting point.
then the two grounding capacitors. Try 2x 27pF for instance or the 100pF from the schematic.

The series resistor has the purpose to reduce drive strength, as these are very small watch crystals. They do not burn instantly without resistor. they may just work fine but may use more current than neccessary. They may wear out after a while even. This is not so much realistic from a mA or two, but mind the actual crystals inside are small, and they have a structuring on them as well, so the electrical contacts are even smaller.
 

Thread Starter

edwardholmes91

Joined Feb 25, 2013
210
The reason I'm not using Bill's circuit is because the mains in the UK is 50Hz not 60, so it wouldn't time correctly and also, if I manage to get it to work with a crystal then I will be teaching it to children and wont be able to use mains.

I have found this datasheet: http://www.fairchildsemi.com/ds/CD/CD4060BC.pdf

And it details how to connect a crystal to the 4060. Using these value it takes a lot longer than 1 second for a pulse... but that could just be inaccuracy in my simulator. As soon as I copy the circuit into the other circuit... it just doesn't seem to want to know... I don't know why. Maybe it is worth buying the components and then putting it together on breadboard to see if it works or not?
 
Last edited:

takao21203

Joined Apr 28, 2012
3,702
Might be the software can not simulate the crystal properly.

Have you tried just the plain crystal with 2x 27pF?

Chances are if you don't test, and don't use a trimmer cap., your time will deviate some seconds each month.

Sorry I did not see the link in the first post somehow.

I made some binary clocks but after a while, I really prefer LED displays.

LCD also looks quite cool. They are not difficult to use even with logic gates. I saw that one again in the CMOS cookbook.

Basically you need XOR gates for the segments, and invert it using the backplane signal. It is really just that, not too much dramatic.

3 1/2 digit LCDs are easy to buy. And your battery will work months.

Or do you still want the binary clock? As I say, I made 6 or 7, two still here, but after a while I did not really fancy it anymore.

One is based on single cell AAA, and 12 LEDs only, using a PIC and RTC chip, fairly large parts count.

Not suggesting PIC of course, only saying I built several binary clocks.
 
Top