Maker Pro
Maker Pro

Oscillator

Jordy Dominicus

Apr 12, 2016
5
Joined
Apr 12, 2016
Messages
5
Hello,

I finished building my digital clock and it's working fine. At the moment I increase the minutes by pressing a button, but I'd like a signal that gets high once per minute. I could use a 555 timer, but they aren't really accurate. Is there an another easy way to create a more accurate oscillating signal? Thanks :)
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Line operated or battery operated? 50 Hz power-line frequency? Easy enough to divide the power-line frequency with digital counter to create one pulse per minute. Or program a PIC to do that, which is the approach I would recommend. The absolute simplest PIC will be more than adequate for the task.

You can safely get 100 Hz pulses from the power line by using a small center-tapped 6.3 VAC filament transformer to drive the base of an NPN transistor through two 1N4148 small-signal diodes and a 1 kΩ current-limiting resistor. Connect the center-tap to circuit common and the diodes between the ends of the secondary winding and the base of the transistor, anodes to the transformer and cathodes (connected together) to the current-limiting resistor. Connect the emitter to circuit common. Connect the collector to a 1 kΩ pull-up resistor, the other end of which is connected to +Vcc logic supply.

Positive-going pulses will appear on the collector, centered time-wise on the zero crossings of the power line and occurring only when the transistor is turned off. Count those 100 Hz pulses with a software counter to generate an output pulse every minute... or what ever interval you want your digital clock to increment.

You may want to add a 10 kΩ resistor between the transistor base and emitter connections to make sure the transistor turns off at the zero crossings.

If battery operated, the internal RC oscillator in a PIC is probably accurate enough, but it runs at 1 MHz so more counts and a different program will be needed. You can "calibrate" the RC oscillator by changing a program variable that is downloaded to the PIC when you program it, or you can use an external resonator for more accurate clocking of the PIC.
 
Last edited:

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
@Hop,
I wouldn't go the AC line way.
1. It is not accurate at all about ±5%
2. It is relatively expansive(transformer)

The way to go is with a CD4060 + 32.768kHz clock crystal (dirt cheap,and may be yanked out of a broken digital clock-almost all of them have one)
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
Yeah a gate oscillator!

doesn't the 4046 bring it down to 2 hertz where a fliplop then divides it by 2?
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
Yeah a gate oscillator!

doesn't the 4046 bring it down to 2 hertz where a fliplop then divides it by 2?
Yes it does ,
it is a 14 stage divider and another FF is needed to get it to 15 .
But,this FF can be merged easily in the clock design.
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
@dorke
I imagine that the line frequency in the Netherlands is much better than +/-5%.
In the UK it never seems to vary much at all and the grid add in lost cycles to maintain clocks. They told me to set clocks at midnight on sunday when the cycles have been corrected.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
@dorke
I imagine that the line frequency in the Netherlands is much better than +/-5%.
In the UK it never seems to vary much at all and the grid add in lost cycles to maintain clocks. They told me to set clocks at midnight on sunday when the cycles have been corrected.

Yes you are correct ,
It is smaller by a factor of 10.
My bad, I should have written ±0.4% (49.8 Hz to 50.2 Hz)
But still ,It may cause a noticeable clock error ,which can be easily eliminated with a crystal osc.
Here is an interesting line frequency accuracy monitoring site.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
@Hop,
I wouldn't go the AC line way.
1. It is not accurate at all about ±5%
2. It is relatively expansive(transformer)

The way to go is with a CD4060 + 32.768kHz clock crystal (dirt cheap,and may be yanked out of a broken digital clock-almost all of them have one)
Ah, yes! I totally agree. The ubiquitous 32.768 kHz clock crystal used in millions (maybe even billions by now) of cheap wrist watches and battery powered wall clocks is the logical and best choice for creating a one-minute clock pulse with an appropriate divider. I should have suggested it. Thanks, @dorke.

The transformer/diode/transistor circuit was a leftover from a problem I solved in the 1960s: how to trigger a pair of SCRs at the zero-crossing of the line voltage to minimize the RFI generated when switching on a large inductive load. In that particular instance a large solenoid actuated a heavy steel shutter. The device was already built and creating havoc with sensitive nearby data acquisition electronics. I was called in to "fix" it.

Today you can purchase off-the-shelf solid-state AC switches that delay turn-on until the next zero-crossing of the AC line. Almost all of them now have this zero-line-voltage-switching "feature" at no extra cost. I still use the circuit for bread-boarding because it is so simple and reliable. I usually connect the transistor collector output to a Schmitt trigger inverter to obtain a faster logic-compatible edge transition. In the original circuit, the transformer was connected through two current-limiting resistors to the bases of each of two NPN transistors whose collectors were tied together to a single pull-up resistor.

At that time I didn't worry about the reverse voltage being applied to the base-emitter junction of the transistor that wasn't conducting... an engineering decision that I got away with using 2N3904 transistors because they tolerate up to 6 VDC reverse bias. The voltage from center-tap to each end of the filament transformer winding is about 4.5 V peak. The width of the collector pulse is very narrow because of the gain of the transistor, so it served nicely as a zero-centered, transformer-coupled, trigger pulse for back-to-back connected SCRs. It would also work nicely for TRIACs but the system was already built and TRIACs were not a viable alternative. Ergo, shoehorn in a "fix" to trigger the existing SCRs.

I will leave it to someone else to detail the divider chain necessary to create a pulse once each minute while I wipe the egg off my face.:)
 

Colin Mitchell

Aug 31, 2014
1,416
Joined
Aug 31, 2014
Messages
1,416
wouldn't go the AC line way.
1. It is not accurate at all about ±5%

That's not true at all. They deliver the exact number of cycles over a period of a day.
 
Top