1
\$\begingroup\$

I've been messing up with timer ICs, looked up on how they work and now I want to design a simple digital clock using a 1Hz pulse generator. Is a 555 timer IC sufficient enough to make accurate 1Hz pulses or is there any other way to design a pulse gen? Is there a specific resistance/capacitance value for the IC or am I wrong and there's a better oscillator for such purpose?

\$\endgroup\$
  • 2
    \$\begingroup\$ Be as precise about the accuracy you need, and no more so. \$\endgroup\$ – jonk Jan 28 '17 at 6:05
  • \$\begingroup\$ Beware that RC based timers vary a lot with environment (temperature) and age. That will make them of little use if you want to make a somewhat accurate wall clock. \$\endgroup\$ – jippie Jan 28 '17 at 6:58
  • \$\begingroup\$ How are you making the other parts of the clock? Divider ICs and binary coded decimal converting to 7 segment display driver using discrete logic or microcontroller? If using a microcontroller, then you can use the timer inside the microcontroller to generate 1 Hz. \$\endgroup\$ – Vince Patron Jan 28 '17 at 7:46
  • 4
    \$\begingroup\$ "Are there better ways other than a 555 timer IC?" There are always better ways than using a 555 timer. \$\endgroup\$ – Olin Lathrop Jan 28 '17 at 13:24
  • \$\begingroup\$ too bad they did not want to pay the inventor of the 555 to make improvements on the 555, but then I never bought any or put them on my drawings. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 28 '17 at 17:16
4
\$\begingroup\$

It certainly would be possible to make a 1Hz signal with a 555. There are (at least) two problems though. a) Assuming that you could get the right cap values and a stable potentiometer, it would be very hard to measure an accurate 1Hz signal with a scope or a counter, since the signal is so slow, and b) The 555 would not generate a square signal. And of course, a RC timer will not be very stable.

If you still want to investigate using a 555, you can square up the wave with a JK flipflop, which will half your frequency in the process. I would also create a much higher frequency, such as 1.024KHz, then cut it with a counter/divider down to 1Hz. That way, you can use your scope to read and adjust your pot so that the 555 is as accurate as you can make it before cutting down to 1Hz.

For a more accurate timing source, you can create a crystal oscillator circuit instead, or use a RTC, which usually have a 1Hz output signal.

\$\endgroup\$
  • \$\begingroup\$ Reading my answer, I realized that I used "square" to mean 50% duty cycle. \$\endgroup\$ – Eraticus Aug 26 '17 at 0:57
10
\$\begingroup\$

The actual 555 timer frequency depends on the RC time constant, which is strongly affected by variations in the actual resistance and capacitance. The resistor has initial accuracy spec (like 1% or 0.1%) and also varies with temperature. The capacitor also has initial accuracy spec (often +20%/-80% or worse) and varies with applied voltage.

A better way is to use a quartz crystal, such as the commonly available 32.768kHz "tuning fork" watch crystals. Use a series of 15 flip-flops to divide 32.768kHz by \$2^{15}\$ and you get 1Hz, with very high precision.

\$\endgroup\$
4
\$\begingroup\$

low cost CD4060 accepts the below 32.768kHz resonator and caps but only has \$2^{14}=2\$ Hz output so a D FF is needed for /2.

Alternative http://www.digikey.com/product-detail/en/maxim-integrated/DS1099U-WT-/DS1099U-WT--ND/1196714 which includes the resonator and divider to 2Hz

For best accuracy choose <50ppm or tune with trimmer cap and GPS. or buy 1ppm Osc chip for a few dollars more and extra dividers http://www.digikey.ca/product-detail/en/abracon-llc/ASTX-H12-10.000MHZ-T/535-12048-1-ND/3907428

Precision is measured in seconds per month with 2.59 millions seconds per month or parts per million (PPM).

EDIT: As suggested by @Bradman175 , the reason a 555 Timer is commonly used is that it is easy to generate a wide range of f but in terms of time accuracy is limited by the stability of the internal reference and RC component tolerances in terms of xxxx PPM, refer to datasheet.

Cheapest solution may be to buy a $6 digital watch with a second hand and use that pulse.

\$\endgroup\$
  • \$\begingroup\$ I liked this reply but I see someone downvoted it. You should probably state the downsides of using a 555 timer and why this way is better. \$\endgroup\$ – Bradman175 Jan 28 '17 at 7:17
2
\$\begingroup\$

It's nice to stand on the shoulders of "giant" answers like these given before – in essence, nothing you build with a 555 will be very exact, and on these large time scales that will be noticeable.

As also said, use something that gives you a stable frequency output – 2**15 Hz quartzes certainly are a proper way to go here.

More often than I'd like to admit, I find myself in a situation like yours, "this would be super easy if I could just put a signal generator inside my circuit". And then I do – I tend to use cheap Cortex-M0-based mircocontrollers (e.g. STM32F0 series), just because I buy them in small bunches, so I have one when I need one, and just whip up my IDE (ok, that's emacs/arm-none-eabi-gcc/openocd, but it still counts) and write a minimal timer interrupt routine that does what I want. In your case, I'd use my simple 8MHz resonator as external source for the CPU clock, and configure the CPU to run at that speed, and use one of the 32bit timers to give me a 2 Hz interrupt directly, toggling one output pin each time that interrupt gets triggered --> 1Hz square wave.

Took a bit of trying around in the beginning, but the fact that I use the same setup for everything that I want done "right now" kind of makes it easier.

It's by no means a well-engineered solution – I'm sure I should pay more attention to putting as much as possible of my MCU to sleep as long as I don't need it, if I used a different microcontroller that actually had a RTC integrated I wouldn't need to run at high clock speeds, further reducing energy consumption. But then again, this uses less than 1 mA, and that's pretty often the "level of significance" that I'd put on energy consumption for something that doesn't have to run for months on batteries.

So yes, I heartily agree with all the other solutions – using the minimal logic necessary to achieve the goal – it's just that I've become content with just doing a standard thing that reliably works.

\$\endgroup\$
1
\$\begingroup\$

I'd like to give an overview of the benefits of the other approaches:

  • 32.768 kHz resonator + CD4060 + Flipflop (Tony's answer): "logically most compact" precision solution. I like the cleanliness of that approach!
  • 32.768 kHz resonator + 15 cascaded flipflops (Mark's answer): That is the solution you should build at least once in your life! Include flickering lights at after the ninth stage and on to see how the clock gets divided by 2. Awesome terrible christmas tree ornament!
  • Use the 555 to generate a high-frequency wave and divide it down (Eraticus' answer): while I like the idea that it's basically easier to build an exact 555 oscillator at higher frequencies than at 1 Hz, it's really just a poor man's solution, since it still is pretty inexact compared to solutions based on quartzes. I'd not do that. Either I need a good clock, or I use a 555.
  • Use a microcontroller and a timer (my answer above): Don't like that because it adds millions of gates that you don't need here. Possibly one of the most flexible solutions, but not necessary here. Leads to you becoming an embedded developer. There be dragons. If you know your ways around cheap microcontrollers, a 8051 MCU for some 40ct might totally do, and thus challenge the other solutions in cost. That is, unless you incorporate programming costs.
  • Use the pulse-per-second (PPS) output of a GPS module (Tony's answer): I like that very much! If you need a precision time source, awesome way to go, and GPS modules have gotten /cheap/! GPS clocks are very exact (so that different versions of what you can buy as GPS module are used as clock reference in high-speed and wide-reach communication networks), and short of an Rubidium clock, you won't get better. Look at what your distributors of choice have in offering on GPS ICs, and pick those models which have a PPS output. Then score some cheap modules that have that IC and an integrated antenna, e.g. by searching on ebay (I very rarely recommend ebay)

The diversity in these answers shows one thing:

It's really necessary to write down your design goals.

You need that 1Hz with a tolerance of < 0.1 ppm? Well, GPS or atomic clocks are your only options. You need that with a minimum amount of components/space? Probably the microcontroller solution, with the same component also taking other jobs. You need something to illustrate how toggling flipflops works? Go with Mark's cascaded FF solution. Need something cheap, don't want to program an MCU, especially not in the field, that simply works? Clearly, Tony has made the point for you.

\$\endgroup\$
  • \$\begingroup\$ One more solution: derive the timing reference from the 50 Hz or 60Hz AC power source. \$\endgroup\$ – Peter Bennett Jan 28 '17 at 17:52
  • \$\begingroup\$ @PeterBennett I actually thought about that, but decided against it. In normal grid operation, you'd expect \$\pm 0.2\,\text{Hz}\$ deviation (as that's the means to control production of power). That converts to a 400ppm error, much much higher than what a simple quartz offers. However, if you happen to have a 50 Hz hum you observe anyways... you'd still have to implement so 50-divider to get down to 1 Hz. I think that makes this solution, in the age of cheaply available quartzes, a relatively obsolete one. \$\endgroup\$ – Marcus Müller Jan 28 '17 at 18:02
  • \$\begingroup\$ One down side to the GPS option, you don't always know how good it is. When it's picking up a clear GPS signal the PPS error will be in the <10 ns region but without GPS it'll degrade to whatever the internal clock is, a good TCXO for a good GPS, normal crystal accuracies for a cheap one. Also when you first lock on to GPS there will be a jump as the clock synchronizes to the second. So great if you have GPS, no worse than a crystal if you don't. But without a processor you don't know which it is and it can glitch if conditions change. \$\endgroup\$ – Andrew Jan 30 '17 at 14:09
  • \$\begingroup\$ +1 for the "microcontroller and a timer" suggestion. I can personally vouch for this method (different micro though). \$\endgroup\$ – Wossname Apr 6 '17 at 14:24
1
\$\begingroup\$

Just a note that the CD4521 produces 1Hz directly from a 32768Hz crystal. This is probably the best minimum component/accuracy tradeoff, unless synchronisation of the pulse edge (eg to UTC) is critical.

\$\endgroup\$
0
\$\begingroup\$

there's a better oscillator for such purpose?

doable with a 555 but you likely will have to experiment with rc values and they may not be that accurate / consistent / stable.

for better performance (accurate / consistent / stable / etc.), you may look into a digital counter, either in hardware or through hardware + software (mcu for example). it is fairly easy to achieve 1% accuracy with a mcu alone - relying on internal oscillator.

there are timers chips other than 555 - linear makes quite a few of them for example.

RTC chips are another example but many of them need programming, at least initially.

you can help yourself by telling others just how accurate you want this thing to be.

\$\endgroup\$
0
\$\begingroup\$

Very accurate 1Hz signal can be taken from a GPS module. Not good for all applications, but for some may definitely work.

\$\endgroup\$
-2
\$\begingroup\$

i so much go with the crystal. (A) it doesn't need any programming. (B) no module needed (economic benefit) and no antenna (for GPS), which will make everything bulky in case you want to carry it around. (C) the precision of the crystal is approximately 99.8 to 99.9 if not 100%. (D) its better readily available than GPS. (E) it will really serve an educational purpose for you to understand how to divide a frequency (its not a bad bonus)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.