One of the most popular Integrated Circuit (IC) is the so called 555 Timer IC which was introduced in 1972 by a company called Signetics (aquired 4 years later by Philips).
The 555 timer IC is an integrated circuit (chip) used in a variety of timer, pulse generation, and oscillator applications. The 555 can be used to provide time delays, as an oscillator, and as a flip-flop element. Derivatives provide two or four timing circuits in one package. - Wikipedia
So anytime when we want to build a circuit which requires a signal with a precise frequency the 555 Timer IC is the simplest/cheapest way in achieving that.
Note: when the frequency precision is not a must we may use a simple resistor-capacitor circuit that creates some form of time-delay between input and the output. Keep it simple.
555 Timer pin configuration
The 555 Timer IC has 8 pins. However, for simplicity reasons I presented only the 6 most important one above. The other two pins not shown here are the pin-4 (RESET) and the pin-5 (VOLTAGE CTRL) which we are going to talk a bit later.
555 Timer IC - how it works
Internally the 555 Timer IC encloses two comparators, one flip-flop circuit and two NPN transistors. Before going into 555 Timer workflow we should explain how a comparator or a SR latch (aka flip-flop) works.
The comparator is an IC that has at least 5 pins: VCC, GND, VIN+, VIN- and the OUTput pin. By feeding the VIN+ and VIN- with voltage the circuit compares the two values and outputs a calculated value as below:
- when the VIN+ > VIN- then the OUT=VCC
- when the VIN+ < VIN- then the OUT=GND
The flip-flop is also an ICÂ that includes at least one SR-latche device. Each SR-latch consists of two NOR gates where each gate output is connected as an input for the other NOR gate. So basically a SR-latch has four pins: two inputs S(et), R(eset) and two outputs Q and not-Q (the inverse of Q). By combining the SR-latch's inputs we get the following output values:
OK, back to the 555 Timer IC. Let's follow the electrons flow:
When the device just starts its pin-2 (Trigger) will have 0V and so would have the comparator-1 negative-pin. The comparator-1 positive-pin would have 1/3 Vcc > 0V and thus the flip-flop S-pin = Vcc = Q and therefore our 555 Timer output pin-3 which goes HI. Likewise the pin-6 (Threshold) will have 0V and so the comparator-2 positive-pin. However, its negative-pin would be 2/3 Vcc and thus its output 0V so the flip-flop's R-pin = 0 = not-Q. Since the not-Q pin of the comparator-2 is zero the transistor (shown on 555 IC pin 7) base is set to 0V and thus the 555 IC pin-7 would be 0V.
Please note that by design it cannot work as-is, it requires some external passive components to allow us to make it work. We would need 2 resistors and one capacitor so let these be RA, RB and C.
As the current flow through the RA-RB-C the capacitor C starts to charge. At some moment its voltage would be greater than 1/3 Vcc and so the pin-2 (Trigger) which results in comparator-1 to output 0V so 0V=S. However, the output Q will hold its previous state because both S and R are LOW. So while the output pin-3 is still HI the capacitor increases its voltage to the point that it has a voltage over 2/3 Vcc and thus the comparator-2 turns ON. Since comparator-2 is HI and the comparator-1 is LOW the SR-latch Q output would be LOW. Given that the comparator-2 is HI so is the not-Q and thus it would turn ON the transistor which would allow the current to flow from RA to Discharge but also from the capacitor to Discharge (the capacitor it's discharging). It comes a point when the capacitor voltage is between 1/3 and 2/3 of Vcc so the comparator-2 is turning OFF, however the SR-latch would hold the previous value. Eventually the capacitor voltage drops under 1/3 Vcc which would turn ON the comparator-1 as well. When this happens the Q is set again to HI and so the output pin-3 while the not-Q is set to LOW which would turn off the transistor and thus the capacitor C would start to charge again.
And the process would repeat with a precise frequency that depends on how quickly the capacitor C would be charged and discharged. How quick it charges (t1) depends on the current that flows through the resistors RA, RB and also on the capacitance of C. How quick it discharges (t2) depends on the resistor RB and capacitance of C. So we can control the frequency of the 555 Timer IC by adjusting the values of RA, RB and C.
If we look in the 555 Timer IC datasheet we see that the charge time can be calculated as:
and the discharge time can also be calculated as:
Thus the total period (charge-discharge) is:
Since the frequency f=1/T the wave frequency is:
Now we can control completely how long the output stays LO or HI, we have a precise 555 timer circuit!
Note: the value of 0.693 represents how many volts the capacitor can charge/discharge in one period (1T).
Below we can see the 555 Timer internal circuit at work:
Below we have a circuit simulation where VCC=10V, RA=10k, RB=10k, C=0.3ÂµF. The capacitor charge time is:
and the whole period T=4.158ms+2.079ms=6.237ms => f=1/T=160Hz.
If we would like to make the circuit to stay HI for t1=0.5s and LOW for t2=0.5s, we could arrange the RA,RB and C like below:
T=t1+t2=0.5+0.5=0.693*(RA+2*RB)*C <=> 1=0.693*(RA+2*RB)*C.
Let's choose C=47ÂµF =>1=0.693*(RA+2*RB)*47*10-6 <=> RA+2*RB =30702. If we choose RA=10k => RB=(30702-10000)/2 = 10k.
So with one 555 Timer IC, two 10K resistors and one 47ÂµF capacitor we could create a square wave generator that would oscillate at a frequency of f=1/T=1Hz (where it would stay HI ca. t1=2/3 of the time).
About the other pins
We left the pins 4 and 5 except for later so I guess this is the right time to talk about them.
The pin-4 (RESET) is connected to the base of a NPN-transistor which in turn is connected to the SR-latch. What it does is that it would allow us to forcibly reset the SR-latch whenever we like in order to force the 555 Timer to start the workflow from scratch. So when we set this pin to LOW it would reset the SR-latch which would reset the entire 555 Timer IC flow. Normally we wouldn't want to reset this. The 555 Timer IC datasheet recommends that, when is not used then, it should be connected directly to the VCC to prevent it from going randomly between LOW - HI. However, if you intend to use this pin to reset the SR-latch then you should also consider connecting the threshold pin-6 to ground (that may depend on your specific circuit logic, though).
The pin-5 (Control Voltage) allows us to control the pulse width of the output waveform. We can of course do that by arranging the values of RA, RB resistors or the value of capacitor C but we can also achieve the same goal by using a variable power supply connected to pin 5.
As we can see in the oscilloscope screenshot below the output voltage transition from 0 to OUTPUT is not as we would expect In a ideal world the transition would be almost like an 90o angle but here we see a spike of about 1V over the average. The cause of this is the way the power is supplied to the circuit which in the little time-interval is not exactly the desired VCC but perhaps a little bit greater.
If your circuit doesn't get affected by this almost +1V in an instant you can ignore the solution below. However, if your circuit is sensitive to the voltage (eg. using a micro-controller) then you better continue reading.
So, we could filter that out that signal noise by using a capacitor of 10nF between the pin-5 and the ground. This is also recommended by the 555 Timer IC's datasheet.
Let's check this solution! By connecting a 10nF capacitor at pin-5 the signal's noise shown above is greatly reduced. Although not 100% perfect (because neither the capacitor is perfect) it's far better than before.
Alternating leds with 555 Timer IC
The 555 Timer IC can help us building a railroad crossing lights circuit.
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Latest posts by Eugen Mihailescu (see all)
- Gentoo AMD Ryzen stabilizator - April 29, 2018
- Symfony Compile Error Failed opening required Proxies - January 22, 2018
- Symfony authentication redirect after each request - January 22, 2018