Electronics Forums > Long duration timers -- notes for beginners

# Long duration timers -- notes for beginners

Article Author : (*steve*)

One of the many things I've seen pop up time and time again is people's requirement for timers with periods of many minutes (or very low frequency oscillators). Often a 555 in mistakenly suggested.

1.0 Long period timers and low frequency oscillators

It is quite common to require a circuit to time long periods, or to supply a very low frequency signal.

The problem that many beginners don't realise is that the same techniques (RC oscillators of various descriptions) used for audio frequencies may not be applicable to very low frequencies.

This document seeks to inform when it is time to use another technique, and to suggest alternative techniques to consider.

2.0 What are the "normal techniques?

For oscillators as frequencies around the audio frequencies (say 10Hz to 100kHz) it is fairly simple to design an RC oscillator. Very few special precautions are required, and on-line calculators are available for the 555.

For timers (which are essentially oscillators that only produce a single pulse at a time) time periods corresponding to these frequencies -- hundredths of seconds to tens of uS -- are similarly straightforward.

2.0 How long is a long time?

While frequencies lower than 10Hz and times longer than a tenth of a second are obtainable using RC oscillators, as you venture further in this direction there are factors that can be ignored in higher frequency oscillators that start to play a larger and larger part.

In this region, the frequency stability with voltage or temperature may be far worse, and noise immunity may be far lower.

Once the period of an RC oscillator exceeds a couple of seconds, these additional factors may dominate. At the very least, the frequencies and periods may be significantly different from calculated values. At worst oscillators won't oscillate, and timers won't time.

A long time is partially defined by requirements of stability and accuracy, but times exceeding a couple of seconds are "long" for almost all purposes.

3.0 What is the problem?

Briefly, the problems are:

1) leakage
2) input currents
3) sensitivity to noise

As has been pointed out by 55pilot (and this is paraphrased a little):

Quote:
 The problem with 555 calculators is that they assumes ideal components and ideal installation. Real life is a little different. The board has stray resistance, but with a 0.5 Meg resistor those are not a big factor if the person cleans up the flux for the board. The 555 has leakage currents (even the CMOS one does). The capacitor has internal leakage current. Both of those are HIGHLY temperature dependent. The comparators inside the 555 have a threshold voltage that is also temperature dependent. As you approach the trigger voltage, you always run the risk of triggering prematurely due to noise. The faster you run, the less time you spend in this danger zone and the less significant the jitter. When you are running this slow, you will have a lot of premature pulses because of the noise. If the board is assembled improperly or the environment is very noisy, the output could look like a total mess.
The latter point is worthy of some clarification (and is probably NOT for beginners). Normally, where the charging or discharging of a capacitor results in the voltage on that capacitor approaching the supply rail asymptotically, the voltage crosses the threshold (1/3 or 2/3 Vcc) in a fairly linear manner. Thus the time the signal is close (however you measure close) to a threshold remains constant as a proportion of the period. Thus the effect of noise on period is fairly linear. However, when charging currents are low, and internal leakage and/or loading from the inputs of the 555 are significant with respect to these, the voltage across the capacitor may be asymptotic to a lower voltage than Vcc (it is asymptotic to a voltage that corresponds to a current through the charging resistor(s) which equals the sum of any discharging effects such as leakage and input currents). Due to this, the proportion of time the RC circuit spends close to the trigger level can be dramatically longer, and hence the effect of the same amount of noise can be disproportionately larger.

With long durations, you typically have large value capacitors and high value resistors. The low currents cause problems, and they are worse than you might initially calculate them to be!

55pilot (paraphrased a little) describes it well here:

Quote:
 Rather that responding based on gut feelings, I decided to look at some datasheets. Kemet T491 series Tantalum caps are a fairly typical series. 68uF/6V cap has a leakage current of 4.1uA. When the 555 circuit is nearing the trigger point of 2/3 supply voltage, the voltage drop across the resistor is about 1/3 of the supply voltage. Assuming 5V supply voltage and using your original design with a 0.5M resistor, this results in a voltage of 1.7V, causing 3.4uA to flow through the resistor, which is less than the leakage current of the cap. The circuit will not work! Another approach might be to try the circuit with a 50K resistor and a 720uF cap. Lets see how that does. The resistor current is going to be 10x the original, or 34uA. Assuming we stick with Tantalum caps, a 680uF/6V has a leakage of 40.8uA while two 330uF/6V in parallel have a leakage of 38.6uA. If we were to look at Aluminium caps, things get even worse. Typical Aluminium caps are about an order of magnitude higher. Speciality caps like United Chemicon KDE or Cornell Dubuilier SXR series are specified as 0.01*C*V which puts a 680uF/6.3V cap at 50uA. So even if you reduce the value of the resistor to increase the current, the one using 50K resistors will overcome the IC's leakage issues, but will succumb to the larger cap's larger internal leakage.
Note that in the first example, the leakage current may be a worst case value. Typically it may be lower. You might thing that is a good thing -- we it is, but it hides a trap. The leakage characteristics of a capacitor change with age, temperature, etc., so it is entirely possible that you can have a circuit that worked when you made it in winter, but fails in summer, or fails after it's left turned on for a while, or fails after a couple of years.

4.0 What can be done?

The options are:

1) use capacitors with lower leakage
2) divide a higher frequency
3) use a uC
4) use a constant current source

Option 1 sounds good because it allows us to use a familiar circuit. However there is no free lunch. 55pilot (again):

Quote:
 You could look into "Super Caps" sometimes also called "Gold Caps" They are extremely high capacitance caps (0.1F to 100F). Some varieties are designed for battery backup of SRAM. They have extremely low leakage and extremely high ESR (hundreds of ohms). You may be able to get a 555 circuit to work with those, but the ESR may end up messing up your timing because the ESR may end up being close to the timing resistors. Another thing to worry about is that most are not available in 5.5V ratings.
The issues that 55p points out are that the internal resistance of the supercaps limits the speed of charge and discharge so you may end up not being able to charge (or discharge) them fast enough if you have a duty cycle that is not close to 50%.

In addition, discharging such a large capacitor quickly may require a current in excess of what the 555 allows.

Option 2 (dividing a higher frequency) may be suitable in some cases. There are many chips available which can divide the frequency of an oscillator (the oscillator output must be compatible with them though). Dividing by almost any number, from 2 to 4096 (or more) can be done using the appropriate IC. (edit: there are a plethora of such dividers available).

So, if a 0.1Hz signal is required, one could produce a 410Hz signal and divide that by 4096.

The disadvantage of dividing an output is that generally speaking you lose control over the mark-space ratio of the signal. If this is critical, another approach (or very careful thought) is required.

Option 3 is to use a microcontroller and program it to give you the required signal at an output pin.

The advantage is that these can be obtained in very small packages (from 8 pins and up) and they can be programmed to do far more than just provide a series of pulses.

The disadvantage is that you require programming experience to use them, and also some hardware to program them (this varies in price and complexity)

Option 4 is to use a constant current source. This partially deals with the problem of the charge current decreasing as the capacitor charges. However the constant current needs to be large enough to ensure that it always exceeds the leakage and input currents of the 555.

This is only a partial solution, and will not work in all cases. It's also probably more complex that some other options.

Articles in Section
 » Long duration timers -- notes for beginnersAttaching imagesGot a question about driving LEDs?