# Various 555 Timer circuits

The purpose of this article is to follow on from our explanation of the 555 timer IC by demonstrating some simple yet interesting, noisy and plain annoying uses of the 555. They are by no means that complex, and intended to help move theory into practice.

Button de-bouncer

De-bouncer? How does one bounce a button in the first place? Many years ago I bounced a button on the arcade Sonic the Hedgehog – hit it so hard it popped out and bounced over the table… But seriously, when working with digital logic circuits, you may need to use  a momentary button to accept user input. For example, to pulse a trigger or so on. However with some buttons, they are not all that they seem to be. You press them once, but they can register multiple contacts – i.e. register two or more ‘presses’ for what seems like only one press. This could possibly cause trouble, so we can use a 555 timer monostable circuit to solver the problem. In our de-bounce example, when the button is pressed, the output is kept at high for around half a second. Here is the schematic:

What we have is a basic monostable timer circuit. For my example the output delay (t) is to be half a second. The formula for t is: t=1.1xR1xC1. The closest resistor I had at hand was 2k ohms, so to find the required value for C1, the formula is rearranged into: C1=t/(1.1xR1). Substituting the values for t and R1 gives a value of C1 as 227.274 uF. So for C1 we have used a 220 uF capacitor.

Now for a visual demonstration of the de-bouncer at work. In the following video clip, the oscilloscope is displaying the button level on the lower channel, and the output level on the upper channel. The button level when open is high, as the 555 requires a low pulse to activate. The output level is normally low. You can see when the button is pressed that the button level momentarily drops to low, and then the output level goes high for around half a second:

Make some noise

As we know the 555 can oscillate at frequencies from less than 1Hz to around 500 kHz. The human ear can theoretically hear sounds between (approximately) 20 and 20 kHz. So if we create an astable timing circuit with an output frequency that falls within the range of the human ear, and connect that output to a small speaker – a range of tones can be emitted.

The circuit required is a standard 555 astable, with the output signal heading through a small 8 ohm 0.25 watt speaker and a 4.7 uF electrolytic capacitor to ground. The capacitor stops any DC current flowing to ground, without this we will overload the current-handling ability of the 555. (I couldn’t help myself by trying it without the capacitor – pulled 550 mA from the 555 before it stopped working…). To choose the values of R1 and C1 to emit out required frequency, the following formula is used: f (frequency) = 1.4 / {(R1 + [2 x R2]) x C1}. To cover the range required, a 100k ohm trimpot was used for R1. Here is the resulting schematic:

The input voltage can fall within the specification of the 555, however for optimum results a supply of between 5 and 9 volts DC should be used. In the following demonstration, we used a 9V supply. The purpose of the video is to learn the relationship between the tones and their frequencies. You can see the frequency on my old counter and hopefully hear the result:

Our next example is to create a  siren effect, using two 555 circuits – one for a low frequency and one for a high frequency. To determine the value for R1 for the low and high frequency, I used the previous circuit and chose two tones that were quite different, and measured the resistance of the trimpot (R1) at those frequencies. My R1 value for the ‘low’ tone is 82k ohm and 36k ohm for the ‘high’ frequency.

The switching between low and high frequency will be handled by a 4047 multivibrator – the Q and Q outputs will control NPN transistors. The transistors are used as switches to allow current to flow from the supply to the 555 high or low tone circuit. We use this method as the 4047 is not able to source enough current to drive the 555 circuits. Here is the schematic:

Don’t forget to connect pin 14 of the 4047 to supply voltage. This circuit has been tested with a supply voltage between 5 and 12 volts. As the supply voltage increases, so does the amplitude of the square wave emanating from the 555 output pins, which in turn in creases the volume of the siren. At 5 volts, the entire circuit drew only 20 milliamps. Speaking of which, you can listen to a recording of the output here. If you wish to alter the time for each tone, adjust the value of what is the 47k ohm resistor on pins 2 and 3 of the 4047.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

# Review – CD4047 Astable/Monostable Multivibrator

Today we are going to examine an older but still highly useful integrated circuit – the 4047 Astable/Monostable multivibrator:

My reason for doing this is to demonstrate another way to create a square-wave output for digital circuits (astable mode) and also generate single pulses (monostable mode). Sometimes one can get carried away with using a microcontroller by default – and forget that there often can be simpler and much cheaper ways of doing things. And finally, the two can often work together to solve a problem.

What is a multivibrator? In electronics terms this means more than one vibrator. It creates an electrical signal that changes state on a regular basis (astable) or on demand (monostable). You may recall creating monostable and astable timers using the 555 timer described in an earlier article. One of the benefits of the 4047 is being able to do so as well, but with fewer external components. Here is the pinout diagram for a 4047 (from the Fairchild data sheet):

Note that there are three outputs, Q, Q and OSC out. Q is the normal output, Q is the inverse of Q – that is if Q is high, Q is low – at the same frequency. OSC output provides a signal that is very close to twice the frequency of Q. We will consider the other pins as we go along. In the following small video, we have LEDs connected to all three outputs – you can see how Q and Q alternate, and the increased frequency of OSC out:

That was an example of the astable mode.  The circuit used is shown below. The only drawback of using a 4047 is that you cannot alter the duty cycle of your astable output – it will always be 50% high and 50% low. The oscillator output is not guaranteed to have a 50% duty cycle, but comes close. The time period (and therefore the frequency) is determined by two components – R1 and the capacitor:

[Quick update – in the schematic below, also connect 4047 pin 14 to +5V]

The values for R2~R4 are 560 ohms, for the LEDs. R1 and the capacitor form an RC circuit, which controls the oscillation frequency. How can we calculate the frequency? The data sheet tells us that time (period of time the oscillator is ‘high’) is equal to 4.4 multiplied by the value of R1 and the capacitor. As the duty cycle is always 50%, we double this value, then divide the result into one. In other words:

And as the frequency from the OSC out pin is twice that of Q or Q, the formula for the OSC out frequency is:

However the most useful formula would allow you to work with the values of R and C to use for a desired frequency f:

When calculating your values, remember that you need to work with whole units, such as Farads and Ohms- not microfarads, mega-ohms, etc. This chart of SI prefixes may be useful for conversions.

The only thing to take note of is the tolerance of your resistor and capacitor. If you require a certain, exact frequency try to use some low-tolerance capacitors, or replace the resistor with a trimpot of a value just over your required resistor value. Then you can make adjustments and measure the result with a frequency counter. For example, when using a value of 0.1uF for C and 15 k ohm for R, the theoretical frequency is 151.51 Hz; however in practice this resulted with a frequency of 144.78 Hz.

Don’t forget that the duty cycle is not guaranteed to be 50% from the OSC out pin. This is shown in the following demonstration video. We measure the frequency from all three output pins, then measure the duty cycle from the same pins:

(The auto-ranging on that multimeter is somewhat annoying).

Now for some more more explanation about the 4047. You can activate the oscillations in two ways, via a high signal into pin 5 (pin 4 must then be low) or via a low signal into pin 4 (and pin 5 must be low). Setting pin 9 high will reset the oscillator, so Q is low and Q is high.

The monostable mode is also simple to create and activate. I have not made a video clip of monstable operation, as this would only comprise of staring at an LED. However, here is an example circuit with two buttons added, one to trigger the pulse (or start it), and another to reset the timer (cancel any pulse and start again):

[Quick update – in the schematic below, also connect 4047 pin 14 to +5V]

The following formula is used to calculate the duration of the pulse time:

Where time is in seconds, R is Ohms, and C is Farads. Once again, the OSC output pin also has a modified output – it’s time period will be 1.2RC.

To conclude, the 4047 offers a simple and cheap way to generate a 50% duty cycle  square wave or use as a monostable timer. The cost is low and the part is easy to source. As always, avoid the risk of counterfeit ICs and get yours from a reputable distributor. Living in Australia, mine came from element-14. Thanks to Fairchild Semiconductor for product information from their 4047 data sheet.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

# The 555 Precision Timer IC

Learn about the useful and inexpensive 555 timer IC in this detailed tutorial!

Today we revisit one of the most popular integrated circuits ever conceived – the 555 timer IC. “Triple-five”, “five-five-five”, “triple-nickel” … call it what you will, it has been around for thirty-eight years. Considering the pace of change in the electronics industry, the 555 could be the constant in an ever-changing universe. But what is the 555? How does it work? How can we use it? And … why do we still use it? In this introductory article we will try to answer these questions. If you would like to see some examples, visit here.

What is the 555?

The 555 timer is the solution to a problem found by the inventor – Hans Camenzind.  He saw the need through his radio work for a part that could act as an oscillator or a timer [1]; and working as a contractor for Signetics developed the 555. (Signetics was purchased by Philips in 1975, and their semiconductor division was spun off as NXP in 2006). The 555 has to be one of the most used ICs ever invented. It is used for timing, from microseconds to hours; and creating oscillations (which is another form of timing for the pedants out there). It is very flexible with operation voltage, you can throw from 4.5 to 18V at it; you can sink or source 200mA of current through the output; and it is very cheap – down to around nine cents if you order several thousand units. Finally, the 555 can achieve all of this with a minimum of basic components – some resistors and capacitors.

Here are some examples in the common DIP casing:

Furthermore a quick scan of suppliers’ websites show that the 555 is also available in surface-mount packages such as SOIC, MSOP and TSSOP. You can also source a 556 timer IC, which contains two 555 ICs. (What’s 555 + 555? 556…) Furthermore, a 558 was available in the past, but seems rather tricky to source these days.

How does the 555 work?

The 555 contains two major items:

• A comparator – a device which compares two voltages, and switches its output to indicate which is larger, and
• A flip-flop – a circuit that has two stable states, and those states can be changed by applying a voltage to one of the flip-flop’s inputs.

Here is the 555 functional diagram from the TI 555 data sheet.pdf:

… and the matching pin-out diagram:

Don’t let the diagrams above put you off. It is easier to explain how the 555 operates within the context of some applications, so we will now explore the three major uses of the 555 timer IC in detail – these being astable,  monostable, and bistable operations, in theory and in practice.

Astable operation

Astable is an on-off-on… type of oscillation – and generates what is known as a square wave, for example:

There are three values to take note of:

• time (s) – the time for a complete cycle. The number of cycles per second is known as the frequency, which is the reciprocal of time (s);
• tm (s) – the duration of time for which the voltage (or logic state) is high;
• ts (s) – the duration of time for which the voltage (or logic state) is low.

With the use of two resistors and one capacitor, you can determine the period durations. Consider the following schematic:

Calculating values for R1, R2 and C1 was quite simple. You can either determine the length of time you need (t) in seconds, or the frequency (Hz) – the number of pulses per second.

t (time) = 0.7 x (R1 + [2 x R2]) x C1

f (frequency) = 1.4 / {(R1 + [2 x R2]) x C1}

Where R1 and R2 are measured in ohms, and C1 is measured in farads. Remember that 1 microfarad = 1.0 × 10-6 farads, so be careful to convert your capacitor values to farads carefully. It is preferable to keep the value of C1 as low as possible for two reasons – one, as capacitor tolerances can be quite large, the larger the capacitor, the greater your margin of error; and two, capacitor values can be affected by temperature.

How the circuit works is relatively simple. At the time power is applied, the voltage at pin 2 (trigger) is less than 1/3Vcc. So the flip-flop is switched to set the 555 output to high. C1 will charge via R1 and R2. After a period of time (Tm from the diagram above) the voltage at pin 6 (threshold) goes above 2/3Vcc. At this point, the flip-flop is switched to set the 555 output to low. Furthermore, this enables the discharge function – so C1 will discharge via R2. After a period of time (Ts from the diagram above) the voltage at pin 2 (trigger) is less than 1/3Vcc. So the flip-flop is switched to set the 555 output to high… and the cycle repeats.

Now, for an example, I want to create a pulse of 1Hz (that is, one cycle per second). It would be good to use a small value capacitor, a 0.1uF. In farads this is 0.0000001 farads. Phew. So our equation is 1=1.4/{(R1 + [2 x R2]) x C1}. Which twists out leaving us R1=8.2Mohm, R2=2.9MOhm and C1 is 0.1uF. I don’t have a 2.9MOhm resistor, so will try a 2.7MOhm value, which will give a time value of around 0.9s. C2 in astable mode is optional, and used if there is a lot of electrical noise in the circuit. Personally, I use one every time, a 0.01uF ceramic capacitor does nicely. Here is our example in operation:

Notice how the LED is on for longer than it is off, that is due to the ‘on’ time being determined by R1+R2, however the ‘off’ time is determined by R2 only. The ‘on’ time can be expressed as a percentage of the total pulse time, and this is called the duty cycle. If you have a 50% duty cycle, the LED would be on and off for equal periods of time. To alter the duty cycle, place a small diode (e.g. a 1N4148) over pins 7 (anode) and 2 (cathode). Then you can calculate the duty cycle as:

Tm = 0.7 x R1 x C1 (the ‘on’ time)

Ts = 0.7 x R2 x C1 (the ‘off’ time)

Furthermore, the 555 can only control around 200mA of current from the output to earth, so if you need to oscillate something with more current, use a switching transistor or a relay between the output on pin 3 and earth. If you are to use a relay, put a 1N4001 diode between pin 3 (anode) and the relay coil (cathode); and a 1N418 in parallel with the relay coil, but with the anode on the earth side. This stops any reverse current from the relay coil when it switches contacts.

Monostable operation

Mono for one – one pulse that is. Monostable use is also known as a “one-shot” timer.  So the output pin (3) stays low until the 555 receives a trigger pulse (drop to low) on pin 2. The length of the resulting pulse is easy to calculate:

T = 1.1 x R1 x C1;

where T is time in seconds, R1 is resistance in ohms, and C1 is capacitance in farads. Once again, due to the tolerances of capacitors, the longest time you should aim for is around ten minutes. Even though your theoretical result for T might be 9 minutes, you could end up with 8 minutes 11 seconds. You might really need those extra 49 seconds to run away…  Though you could always have one 555 trigger another 555… but if you were to do that, you might as well use a circuit built around an ATmega328 with Arduino bootloader.

Now time for an example. Let’s have a pulse output length of (as close as possible to) five seconds. So, using the equation, 5 = 1.1 x R1 x C1… I have a 10 uF capacitor, so C1 will be 0.00001 farads. Therefore R1 will be 454,545 ohms (in theory)… the closest I have is a 470k, so will try that and see what happens. Note that it you don’t want a reset button (to cancel your pulse mid-way), just connect pin 4 to Vs. Here is the schematic for our example:

How the monostable works is quite simple. Nothing happens when power is applied, as R2 is holding the trigger voltage above 1/3Vcc. When button S1 is pushed, the trigger voltage falls below 1/3Vcc, which causes the flip-flop to set the 555’s output to high. Then C1 is charged via R1 until the threshold voltage 2/3Vcc is reached, at which point the flip-flip sets the output low and C1 discharges. Nothing further happens until S1 is pressed again. The presence of the second button S2 is to function as a reset switch. That is, while the output is high the reset button, if pressed, will set the output low and set C1 to discharge.

Below is a video of my example at work. First I let it run the whole way through, then the second and subsequent times I reset it shortly after the trigger. No audio in clip:

Once again, we now have a useful form of a one-shot timer with our 555.

Bistable operation

Bistable operation is where the 555′s output is either high, or low – but not oscillating. If you pulse the trigger, the output becomes and stays high, until you pulse reset. With a bistable 555 you can make a nice soft-touch electronic switch for a project… let’s do that now, it is so simple you don’t need one of my quality schematics. But here you are anyway:

In this example. pressing S1 sets the voltage at pin 2 (trigger) to below 1/3Vcc, thereby setting the output to high – therefore we call S1 our ‘on’ switch. As pin 6 (threshold) is permanently connected to GND, it cannot be used to set the output to low. The only way to set the output back to low is by pressing S2 – the reset button, which we can call the ‘off’ switch. Couldn’t be easier, could it? And that output pin could switch a transistor or a relay on or off, who knows? Your only limit is your imagination. And here’s one more video clip:

And there you have it – three ways in which we can use our 555 timer ICs. But in the year 2011, why do we still use a 555? Price, simplicity, an old habit, or the fact that there are so many existing designs out there ready to use. There will be many arguments for and against continued use of the 555 – but as long as people keep learning about electronics, the 555 may still have a long and varied future ahead of it.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

References

[1] “The 555 Timer IC – An interview with Hans Camenzind” (Jack Ward – semiconductormuseum.com)

Various diagrams and images from the Texas Instruments NE555 data sheet.