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

Thread Starter

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!
 

djsfantasi

Joined Apr 11, 2010
5,685
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.
 

crutschow

Joined Mar 14, 2008
23,494
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.
 

Thread Starter

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

Thread Starter

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

djsfantasi

Joined Apr 11, 2010
5,685
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.

8F0AE139-8557-43E5-B396-8C0E089B08AC.jpeg
 

Thread Starter

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
 

AnalogKid

Joined Aug 1, 2013
8,138
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
5,685
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
 

Thread Starter

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

marcf

Joined Dec 29, 2014
257
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

djsfantasi

Joined Apr 11, 2010
5,685
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?
 

Thread Starter

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

Top