# CD4060B timer circuit design, 12 Hour On/Off/Repeat

#### bctrueax

Joined Feb 2, 2019
9
Hello All!

First off, I have seen many posts on this site with suggested timing circuits involving the CD4060. I'm still sifting thru those and have found similar circuits that may work for what I need. I would like to use the CD4060 with a crystal oscillator (32786Hz) configuration. It would need to be low power consumption, as I would like to drive it with either 2 AA or AAA batteries. The circuit will start supplying power from a toggle switch, and light an led from the start for 12 hours, then off 12, then repeat. My original thought was 6 hours on, then 18 off, repeat, but I'll keep it simple and stick with 12 on/off for now. I would like to keep the parts list low if possible.
I think the 4060 has one output pin capable of doing the 12 hour on/off, just want to confirm that. Most circuits I've seen, I think start Low. I would like the led to turn on first then go low. As far as I can tell, my parts lists would only consist of 1 4060, couple caps and resistors, led and switch.

Thanks in advance for any assistance!

#### ericgibbs

Joined Jan 29, 2010
10,501
hi bc,
Welcome to AAC.
A R/C oscillator will not have same oscillator/timing stability as a 32kHz crystal.
E

#### djsfantasi

Joined Apr 11, 2010
6,719
As far as I can tell, my parts lists would only consist of 1 4060, couple caps and resistors, led and switch.
Don’t forget the crystal oscillator! And can you provide a link to the particular 32768Hz crystal oscillator you’re considering. I’m only aware of a 32768 kHz oscillators. That’s only a difference of 1000 times.

You have to do some math. The 4060 can divide by 32 to 16384 in increments of powers of two. That is, 33, 64, 128...

The issue then arises in that none of these outputs are directly useful for periods of 12 or 60 cycles, that would be needed for clock timing. That is, measuring 12 hours without additional circuitry.

#### ericgibbs

Joined Jan 29, 2010
10,501
hi bc,
This image is a clip from a 1sec period osc circuit.
E

#### crutschow

Joined Mar 14, 2008
25,269
A 32768Hz crystal will give a 2Hz output from the Q14 output of the 4060.
You will need additional counters to divide that by 24Hr*60m*60s*2 = 172,800 (18 bits)to get a 24 hour output (12 hour high, 12 hour low),
If you use an RC oscillator, the 4060 would need an oscillator frequency period of 5.2734 seconds.
Here's a circuit to do that.

#### bctrueax

Joined Feb 2, 2019
9
I've attached the circuit that I'm using as a basis for my starting point. The crystal I'm using is a 32.678K. I have an led connected to pin 13 of the 4060, which I believe has the longest duty cycle. I've tested it on pin 3 and my led blinks, so the circuit is oscillating. I'll start digging into the math so I understand how this works. Haven't hooked this up to a scope yet.

#### Attachments

• 260.7 KB Views: 15

#### crutschow

Joined Mar 14, 2008
25,269
connected to pin 13 of the 4060, which I believe has the longest duty cycle.
Pin 3, which is the output Q14, has the longest duty-cycle (which will have a 2Hz output with your crystal).

#### bctrueax

Joined Feb 2, 2019
9
Ok, a little confused by the pin numbers vs referenced Q numbers, but I've attached an image showing what pin I believe to be the max delay.

#### Attachments

• 72.9 KB Views: 10

#### ericgibbs

Joined Jan 29, 2010
10,501
hi bc,
This is the HEF4060 datasheet, Q13 is the highest, ie: pin #3.
E

#### Attachments

• 110.7 KB Views: 3

#### bctrueax

Joined Feb 2, 2019
9
Ok, the chip I'm using is the CD4060BE. Is there an advantage to using the HEF4060?

#### ericgibbs

Joined Jan 29, 2010
10,501
Ok, the chip I'm using is the CD4060BE. Is there an advantage to using the HEF4060?
I used the HEF4060 because of its improved specification over the earlier CD series.
Either series would suit your project.
E

#### djsfantasi

Joined Apr 11, 2010
6,719
Here is another pinout of the. CD4060, with additional annotations which helps to determine the pin with the highest cycle.

It’s pin 3, which should be obvious from this diagram.

#### bctrueax

Joined Feb 2, 2019
9
Thanks for all the feedback yesterday! I was able to get a 2Hz signal out of pin3/Q14. I realize for my requirements, this does not suit, without additional components to divide it down further. Probably 2 more 4060's, which defeats the purpose of trying to keep my parts count down. I could go that route as one option. Or, I could define an RC timer with just 1 4060 and get my 12 hour on/off, with less accuracy. Or...find another chip more suitable for the job. I might attempt the RC Timer today if I can figure out how to determine my cap/resistor values.

For a 12 hour on/off cycle / RC circuit
Pin 2 needs to go high after 43200 seconds
This means pin 7 needs to high after 84.375 seconds (hope my math was right)
t = R * C
84.375s = R * 10uF
R = 8.438M

#### ericgibbs

Joined Jan 29, 2010
10,501
hi bc,
This CD4521 counter is 'longer' than the 4060
ie: 24 stages.

E

#### Attachments

• 804.6 KB Views: 6

#### AnalogKid

Joined Aug 1, 2013
8,540
Just to be clear, calling pin 3 output 13 is misleading; calling it Q14 is correct. The frequency at pin 3 is the frequency of the oscillator circuit (or external clock input) divided by 2^14 (16,384).

As above, to get from 32 kHz to a 24 hour period (12 on / 12 off) is more dividing than a single 4060 can do. There is a part with many more divider stages, the CD4521. It has 24 divider stages, plus an onboard oscillator section like the 4060. If you set its oscillator to 194 Hz, the Q24 output will cycle every 24 hours. If you drive it with 32,768 Hz, you still will need an external divider to reach your desired output period.

Note - there are 86,400 seconds in 24 hours, and this is not a binary sequence number. That means that if you start with a binary sequence clock frequency, like 32,768 Hz, you will have to decode a specific output number to achieve a 24 hour period. You can see this in that the oscillator freq above, 194.18074 Hz, is neither 128 Hz nor 256 Hz, the two closest binary sequence values.

ak

#### djsfantasi

Joined Apr 11, 2010
6,719
Your initial requirements was for a solution using a CD4060 and a crystal oscillator.

A small micro processor can work with just a few lines of code. Literally.

C:
const int pinOut=1;
const long myDelay=43200000;

void setup() {
pinMode(pinOut,OUTPUT);
}

void loop() {
digitalWrite(outPin, HIGH);
delay(myDelay);
digitalWrite(outPin,LOW);
delay(myDelay);
)
Thus could be done in an ATTiny45/85

#### bctrueax

Joined Feb 2, 2019
9
Yes, you're right djsfantasi. I'm new to electronics and have an interest in learning how to do this project with discrete components first even if in the end, I choose a little mc like the ATTiny.

I've attached an image of the circuit I'm working on now, using 2 4060's. Had to order some caps and resistors so it's on hold. Not quite comprehending the way the author drew the RC timing circuit section. I think I can figure it out based on others I've seen. Got it from here:
http://www.edutek.ltd.uk/Circuit_Pages/24hrTimer.html

#### Attachments

• 41 KB Views: 16

#### marcf

Joined Dec 29, 2014
260
If you really want to use the 32khz xtal, you may want to do this:

Use a 2nd cd4060 to divide the 2hz output of the 1st 4060 by 2160.

12hrs/2sec = 2160. 2160 = 870 base 16 (hex).

870 base 16 = 1000 0111 0000 base 2. If you diode "OR" Q4,Q5,Q6 and Q11 per the attached, when the count equals 2160, Q4,Q5,Q6 and Q11 will no longer be low and will allow the the reset input to go high and reset the 2nd 4060. It will also cause the 4013 Q1 output to go high and low every 12 hours.

You must delay the reset pulse as a 'racing' condition will exist. The 1 Meg resistor at the input of reset may delay the reset enough due tot he input capacitance of the 4060. You may want to add a small capacitor at the point where the 1 meg connects to the reset pin if you do not obtain a reliable reset. You could take your output off either pin 1 (Q low to high) or pin 5 (/Q high to low) of the 4013 D Latch.

I am really thankful that 'they' invented the microprocessor chip, because this project is so much easer done with some code and \$2 chip.

#### Attachments

• 89.5 KB Views: 14

#### djsfantasi

Joined Apr 11, 2010
6,719
12 hrs/2 seconds is 2160?

12 hours = X seconds
= 60 seconds/ minute x 60 minutes/hour x 12 hours
= 86,400 seconds

86,400 seconds / 2 seconds
= 43,200

How do you get 2,160?

#### bctrueax

Joined Feb 2, 2019
9
@marcf
I have some questions about the circuit diagram you shared.
I see diodes on Q4, Q5, Q6 and Q12. If I add the dividers up, I get 16 + 32 + 64 + 4096 = 4208 -> 4208/2 = 2104
The diagram you provided has some math on it and produces a result of 2160. I'm still trying to follow that, but I have different questions.
In the circuit, it shows diodes on Q4, Q5, Q6 and Q12 with the positive voltage flowing into the 4060. Plus this is all tied to the 5v rail thru a 100k resistor, as well as the clock input on the 4013. Can someone explain how that works? Why is it tied to power? I would expect the diodes to be in the opposite direction.

#### Attachments

• 116.9 KB Views: 8