Timer circuit does not work as intended (fixed)
Asked today
Modified today
Viewed 21 times
0
I am trying to make a 1 Hz clock with a CD4060, a crystal oscillator and an Arduino UNO. The problem is I am pretty sure the circuit does not work right. It oscillates but it is slower than 1 Hz.
I don’t have right now any way to make timing measurement (I try to avoid making one I just compare the serial output of Arduino by looking to windows clock). I would be happy with something that counts seconds with a small error.
The circuit oscillates if I take out the 470k resistor which means it does not use the crystal… The 4060 contains an internal oscillator, how to disable it? Any information would be appreciated.
EDIT:
The circuit in my case worked with the following values (in contrast with the values mentioned on the old or the newer datasheet):
both capacitors 100pF The capacitor on the (11) pin connected with some wire to add some capacitance.
Resistor 11-10 -> 1M
Second resistor 300k
corrected circuit:

Arduino divide by two, counting seconds and measuring period:

//———————————————————————————————-//
#include "printf_function.h"
#pragma GCC optimize ("Os")
bool state = false;
uint8_t seconds = 0;
uint32_t time_stamp = 0;
uint32_t PreviousMillis = 0;
uint32_t m_i = 0;
void blink(){
state = !state;
if( state ){
m_i = millis();
time_stamp = m_i - PreviousMillis;
PreviousMillis = m_i;
serial_printf( Serial, "%i %i\n", seconds, time_stamp );
if( seconds++ > 58 ) seconds = 0;
}
}
void setup(){
pinMode( 2, INPUT );
pinMode( 13, OUTPUT );
digitalWrite( 13, LOW );
Serial.begin( 9600 );
attachInterrupt( digitalPinToInterrupt( 2 ), blink, RISING );
}
void loop(){ }
//----------------------------------------------------------------------------------------------//
Thanks
ShareCite
EditFollowFlag
asked 2 hours ago
58988 silver badges2222 bronze badges
- Please edit your question and add a schematic. The PCB layout doesn’t cut it as a circuit diagram. – TonyM 2 hours ago
- Well, you need a 32.768kHz crystal to make an oscillator and count it down to 1Hz. Ref: CD4060 14 stage Binary Counter and Oscillator – TI ti.com/lit/ds/symlink/cd4060b.pdf – tlfong01 2 hours ago
- Why do you think it’s unnecessary…how can others find a circuit fault in a circuit they can’t see? – TonyM 2 hours ago
- @John Am: This new datasheet explains how to use an external clock input at terminal RS: CD4060 14 stage Binary Counter and Oscillator – NXP 2021 assets.nexperia.com/documents/data-sheet/HEF4060B.pdf NXP2021 – tlfong01 1 hour ago
- @tlfong01 Thank you – John Am 1 hour ago
Categories: Uncategorized