Tag Archives: fundamentals of 555

Output Level Inversion using 555

This 24th article in the series of “Do It Yourself: Electronics”, does level inversion of a given input using IC 555.

<< Previous Article

By now, Pugs had tried two of the three operating modes of 555 – astable and monostable. How do you think, one can stop Pugs from trying the third one? So, here is his experiment to try the bistable mode, i.e. in which both high & low outputs are stable, meaning the circuit remains in the state it is in, unless triggered externally to go otherwise. A typical usage of this could be a NOT gate kind of level inversion by simply tying the input to both the trigger pin 2 and threshold pin 6.

Below is the schematic, and the breadboard connections made by Pugs with input from a pulled up switch:

Bistable (Level Inversion) using 555 (Schematic)

Bistable (Level Inversion) using 555 (Schematic)

Bistable (Level Inversion) using 555 (Breadboard)

Bistable (Level Inversion) using 555 (Breadboard)

This configuration is also referred as inverting Schmitt Trigger, and very useful in boosting fainting digital signals (though inverted) and removing noise. Putting two of such would make it non-inverting. But how does it boost or remove noise? Let’s assume Vcc = 5V. Say logic 1 (5V) signal is fainting to 4V. As it is still above 2/3 of Vcc (3.33V), the above circuitry will hit the threshold and output would be 0V (boosted logic 0). Similarly, if logic 0 (0V) is fainitng to 1V, still less than 1/3 of Vcc (1.67V), it would hit the trigger and output would be 5V (boosted logic 1). And in both cases, the output can be fed into another such circuitry to get the input boosted without inversion.

The following video clip shows the immediate output level inversion. Specifically, observe that LED is off (low output) on switch released (i.e. high input) and LED is on (high output) on switch pressed (i.e. low input).

 

Interestingly, the bistable output can also be obtained using two separate switches, providing a possibility of using the setup in a system, controlled by switches. Here are two possible schematics for the same:

Bistable (Schmitt Trigger Circuit 1) using 555 (Schematic)

Bistable (Schmitt Trigger Circuit 1) using 555 (Schematic)

Bistable (Schmitt Trigger Circuit 2) using 555 (Schematic)

Bistable (Schmitt Trigger Circuit 2) using 555 (Schematic)

In both the above circuits, pressing switch SH will take the Vo output high, and pressing the switch SL will take the Vo output low. The only difference being as how is the Vo output brought low – in the first one using the trigger pin 6 and in the second one using the reset pin 4.

   Send article as PDF   

Pulse Generation using 555

This 23rd article in the series of “Do It Yourself: Electronics”, generates a desired width pulse using IC 555.

<< Previous Article

After the square wave experiments, Pugs got more interested in understanding all the working modes of 555. His further studies revealed to him that 555 has basically three modes of operation:

  1. Astable – Both high & low outputs are unstable and keeps on oscillating to the other, i.e. high to low and low to high. So, also called oscillator. Examples include all the square wave generation, experimented till now, in the previous articles.
  2. Monostable – Exactly one (mono) of the outputs either high or low is a stable state. However, on an external trigger, it temporarily goes to the other unstable state, stays there for a predefined time and comes back to the stable state, on its own. This is what Pugs is planning to explore further by using a switch for the trigger. The pulse width of the unstable state is decided by the resistor and capacitor in the circuit. As it generates single (mono) pulse on trigger, it is also called monoshot configuration.
  3. Bistable – Both high & low outputs are stable, meaning the circuit remains in the state it is in, unless triggered externally to go otherwise. A typical usage of this could be a NOT gate kind of level inversion. Pugs plans to explore this in his next experimentation.

Now interestingly, the mono stability could be either in the low output or the high output. Correspondingly, the pulse would be high or low, and the trigger accordingly would be low or high. And for each of these the circuits are slightly different, especially from the perspective as to where the trigger is applied. Recall that voltage below 1/3 of Vcc on trigger pin 2 triggers output Vo pin 3 to high and voltage above 2/3 of Vcc on threshold pin 6 brings back output Vo pin 3 to low.

Below are the corresponding schematics, and the breadboard connections made by Pugs:

Monostable Low (High Pulse) using 555 (Schematic)

Monostable Low (High Pulse) using 555 (Schematic)

Monostable High (Low Pulse) using 555 (Schematic)

Monostable High (Low Pulse) using 555 (Schematic)

Monostable Low (High Pulse) using 555 (Breadboard)

Monostable Low (High Pulse) using 555 (Breadboard)

Monostable High (Low Pulse) using 555 (Breadboard)

Monostable High (Low Pulse) using 555 (Breadboard)

Observe that in either case, the trigger is being achieved on press of the switch. However, for triggering the high pulse (on Vo), Pugs needs to connect the pulled up switch output to trigger pin 2. And, for triggering the low pulse (on Vo), Pugs needs to connect the pulled down switch output to threshold pin 6. Also, note that in the first case, the final output Vo is brought back low by charging the capacitor connected to the threshold pin 6, to 2/3 of Vcc through R. And in the second case, the final output Vo is brought back high by discharging the capacitor connected to the trigger pin 2, to 1/3 of Vcc through R. And hence, in either case, the pulse width (time from trigger to restoration of stable state) would be decided by the following equation:
t_{pulse} = R * C * ln(3) … (6)
One may derive this, using the methodology similar to the one used in this previous article. So, it is left to the reader to derive the same.

Pugs tried the first (monostable at low output) experiment using two set of values: (1) R = 10KΩ, C = 100μF, (2) R = 10KΩ, C = 470μF. Using (6), the corresponding pulse widths are expected to be approximately 1 and 5 seconds.

And then he tried the second (monostable at high output) experiment using R = 10KΩ, C = 470μF. Using (6), the expected pulse width is approximately 5 seconds.

As in previous articles, Pugs tried observing the Vo output waveforms on the home-made PC oscilloscope, as created in his previous PC Oscilloscope article. But he observed nothing other than noise, except some change when he presses the switch. This reminded him that the home-made PC oscilloscope filters out low frequency (DC) voltages, and with such low frequency Vo, there would be nothing left to observe after filtering, except when there is some change on switch press. So, Pugs decided to rather use a multimeter. But, then got the idea of putting an LED instead, which is what is visible in the above circuitries.

And here are the three video clips of the LED blinkings observed in the three cases:

(1) 1 second high pulse (monostable low)

 

(2) 5 second high pulse (monostable low)

 

(3) 5 second low pulse (monostable high)

 

Observe the closeness of the pulse width timing (with a watch) from the above videos compared with the expected values.

Also note that during the low pulse (monostable high) experiment, Pugs is waiting for another 5+ seconds after the output Vo is high, before pressing the switch again. In fact, when he tried doing it without waiting, this is what he observed:

 

That’s weird – the pulse width also has reduced. But why is that? Possibly, because the capacitor is not charged back to the full, before the switch press and so it got discharged faster. That brings to the point, that derivation of equation 6 assumes that the capacitor is completely discharged in the first case (monostable low) and completely charged in the second case (monostable high), before the trigger. If not, the calculations would vary. Now, in the first case the capacitor gets immediately discharged as it is directly grounded through discharge pin 7. So, such scenario wouldn’t happen with that. However, in second case the charging is through resistors R & R1, so that would take its own time based on the RC value, which in the above case is 5+ seconds ((10 + 1)K * 470u). To avoid this, Pugs possibly would have to by-pass the big R in the charging cycle by putting a diode in parallel with R. If you believe it, go ahead and try it out.

Note: R1 has been taken small compared to R, exactly for reducing the RC effect. However, it cannot be made zero, as that would short the Vcc & GND (from discharge pin 7) when the low pulse is getting output on Vo.

Next Article >>

   Send article as PDF   

Symmetric Square Wave using 555

This 22nd article in the series of “Do It Yourself: Electronics”, finally generates a 50% duty cycle waveform using IC 555.

<< Previous Article

After failing to achieve 50% duty cycle square wave, or so called symmetric square wave, using his trivial circuitry, Pugs further explored. One clear observation was that the output pin 3 is the only pin which goes both high and low, correspondingly during the charging and discharging cycle. So, not using pin 3 means that there has to be two separate paths for charging and discharging the capacitor C, meaning two separate resistors R1 & R2 similar to the initial design as in the first 555 article.

So, Pugs restarted with the same initial design, where R2 was in discharging path and R1 + R2 in the charging path. Clearly, the problem is that R2 is also in the charging path, making it non-symmetrical. The thought of “Can R2 be removed just from the charging path?”, treaded Pugs into the short circuit and open circuit properties of diodes correspondingly in their forward and reverse biases. “Yes! Why not put a diode D1 in parallel with R2, such that D1 is short (aka forward bias) in charging cycle, and it is open (aka reverse bias) in discharging cycle?”, exclaimed Pugs. Thus, R2 would be by-passed in the charging cycle and used in the discharging cycle, exactly as desired. Here’s the modified circuit, which has just clicked:

Approximate Symmetric Square Wave using 555 (Schematic)

Approximate Symmetric Square Wave using 555 (Schematic)

Now the charging path has the resistor R1 & capacitor C, and the discharging path has the resistor R2 & capacitor C. So, we would get,
t_{on} = R1 * C * ln(2) … (4)
t_{off} = R2 * C * ln(2) … (5)

And if we put R1 = R2, we get a 50% duty cycle.

Live Demo

What do you think would Pugs wait for? Here’s his breadboard layout with two 4.7KΩ resistors (both of which closely measured 4.3KΩ on the multimeter), and a 1μF capacitor:

Approximate Symmetric Square Wave using 555 (Breadboard)

Approximate Symmetric Square Wave using 555 (Breadboard)

The audio jack is being used for observing the waveforms on the home-made PC oscilloscope, as created in his previous PC Oscilloscope article.

Below is the waveform observed by Pugs, for the values of R1 = R2 = 4.3KΩ (measured), and C = 1μF:

R1 = 4.3K, R2 = 4.3K, C = 1u, D1

R1 = 4.3K, R2 = 4.3K, C = 1u, D1

From the above waveform, we approximately have t_on = 3.2ms and t_off = 3.0ms. Close enough to our expected value of 2.98ms (as per equation 4 or 5), but not really satisfactory as t_on and t_off are still not exactly same, even though R1 and R2 are closely equal.

In fact, t_on is slightly more, meaning the resistance in the charging path is more than just R1. O Yes! Our diode D1 is not an ideal diode, it would have some resistance in the forward bias as well, and that is what is getting added up in the charging path, causing this deviation. But how to avoid this? How about adding an equivalent diode D2 in the discharging path? That’s a cool idea, which looks like as shown below:

Symmetric Square Wave using 555 (Schematic)

Symmetric Square Wave using 555 (Schematic)

Pugs’ breadboard connections for the same are as follows:

Symmetric Square Wave using 555 (Breadboard)

Symmetric Square Wave using 555 (Breadboard)

Captured waveform as follows:

R1 = 4.3K, R2 = 4.3K, C = 1u, D1, D2

R1 = 4.3K, R2 = 4.3K, C = 1u, D1, D2

And, now we see that t_on and t_off both are approximately equal to 3.2ms.

To be more exact, one may use a pot in place of R2 & D2, and then adjust it to match it with resistance of R1 & D1 – more precisely by matching the off cycle to the on cycle.

Next Article >>

   Send article as PDF   

Trivial Square Wave using 555

This 21st article in the series of “Do It Yourself: Electronics”, tries generating a 50% duty cycle waveform using a non-conventional trivial circuit using IC 555.

<< Previous Article

On further observation, of the IC 555 behaviour, Pugs got a trivial idea of generating 50% duty cycle square wave using just one resistor and one capacitor as shown in figure below:

Trivial Square Wave using 555 (Schematic)

Trivial Square Wave using 555 (Schematic)

Note that, both the charging & discharging paths would have the same resistor R & capacitor C. So, putting in the equations (1) & (2) derived in the previous article, we would get,
t_{on} = t_{off} = R * C * ln(2) … (3),
thus giving a 50% duty cycle.

Live Demo

Excited by his idea, Pugs couldn’t wait but try out the same. So, he set the above circuitry on a breadboard as shown in the figure below:

WARNING: Do NOT put the pot to a value of zero, as that will overload the circuit. A safety workaround could be to put a fixed 1K resistor in series with the pot.

Trivial Square Wave using 555 (Breadboard)

Trivial Square Wave using 555 (Breadboard)

The audio jack is being used for observing the waveforms on the home-made PC oscilloscope, as created in his previous PC Oscilloscope article.

Then, for C as a 1μF capacitor, he adjusted R to different values to get different frequencies with 50% duty cycle. But, what’s this, none of them have a 50% duty cycle.

Below are some of the waveforms being observed by Pugs, for the values of R being adjusted to 1.5KΩ, 5KΩ, 10KΩ:

R = 1.5K

R = 1.5K

R = 5K

R = 5K

R = 7K

R = 7K

From the above waveforms, we approximately have the following t_on & t_off:
R = 1.5KΩ => t_on = 2.8ms, t_off = 1.1ms
R = 5KΩ => t_on = 8.9ms, t_off = 3.4ms
R = 7KΩ => t_on = 12.5ms, t_off = 4.8ms

Now, as per equation (3), for C = 1μF, and the above three R values, we should have got the following:
R = 1.5KΩ => t_on = t_off = 1.0ms
R = 5KΩ => t_on = t_off = 3.5ms
R = 7KΩ => t_on = t_off = 4.9ms

t_offs are pretty exact, but t_ons are really high. After quite a bit of analysis, Pugs realized that the peak Vo is not actually reaching Vcc. Debugging trick he used, was to replace the 1μF capacitor by a 100μF capacitor, thus reducing the frequency in Hz (eye observable), and then measuring the Vo using a multimeter. Aha! if the Vo doesn’t reach Vcc, then in the above circuit, we are not charging the capacitor using Vcc but this measured peak value of Vo. Mathematically, this changes our derivation for equation (1) in the previous article, though equation (2) remains the same. And hence, getting a correct t_off but incorrect t_on. Even conceptually, we can see that as Vo is less than Vcc, the capacitor would take more time to charge, and thus increasing the time (t_on), as observed in all the readings above.

On this realization, Pugs approximated the measured value of maximum Vo to 3.65V, i.e. 3.65/5 of Vcc instead of Vcc in deriving the equation (1) of the previous article, getting the following relation:
2/3 * V_{cc} = 3.65/5 * V_{cc} * (1 - e^{\frac{-t_{on}}{R*C}}) + 1/3 * V_{cc} * e^{\frac{-t_{on}}{R*C}},
which on simplifying gives:
t_{on} = R * C * ln(6.2632) = R * C * 1.8347

Putting in the values, gave t_on values amazingly close to the observed values, thus again verifying the theory.

Summary

Also from the 555 IC datasheet, Pugs found that there is always some expected drop on the peak Vo from the supply voltage Vcc, and the peak Vo in most cases would be less than Vcc – thus rendering all our standard calculations of t_on futile. In fact, if we put the actual value of peak Vo in our calculations, we would get the results as observed. But getting the actual value of Vo is non-trivial and non-standard. Moreover, even if we do that somehow, we are not going to get our desired 50% duty cycle.

Thus, moral of the story is that, in general, Vo should not be used to generate the trigger voltages, as practically it may not be reaching Vcc, as in the case above. And, Pugs would have to find out some other way to achieve 50% duty cycle.

Next Article >>

   Send article as PDF   

Square Wave using 555

This 20th article in the series of “Do It Yourself: Electronics”, explains the basic working of IC 555 and generating a square wave using it.

<< Previous Article

Playing with raw electronics (without any microcontroller), further boosted the confidence of Pugs to dive into non-microcontroller electronics. This time he decided to explore the ever popular IC 555, loosely also known as the timer IC.

555 Functionality

555 is basically an 8-pin IC, with pin 1 for GND, pin 8 for Vcc, and pin 3 for Vo – the output voltage, which goes either high (Vcc) or low (GND), based on the other pins.

Vo goes high if the trigger pin 2 senses voltage less than 1/3 of Vcc. Vo goes low if the threshold pin 6 senses voltage greater than 2/3 of Vcc.

Pin 5 can be used as a control voltage always fixed to 2/3 of Vcc. Putting reset pin 4 low any time makes Vo go immediately low. So, if not in use it is recommended to be tied to Vcc.

Discharge pin 7 becomes GND when pin 6 senses voltage greater than 2/3 of Vcc and becomes tristate (open) when pin 2 senses voltage less than 1/3 of Vcc. In other words, discharge pin 7 becomes GND when Vo goes low and becomes open when Vo goes high.

Generating a Square Wave

Given this background, one of the common uses of the 555 IC is to generate a square wave of any particular frequency and duty cycle (on pin 3), by varying some analog voltage between GND and Vcc (on pins 2 and 6), more precisely between 1/3 Vcc and 2/3 Vcc, both inclusive. And this analog voltage is typically achieved by charging / discharging a capacitor through one or more resistors. Thus, the time constants given by τ = RC, R being the resistance, and C being the capacitance in the corresponding charging & discharging paths, controlling the corresponding on & off cycle of the square wave.

Let’s consider the following circuit with R1 as a variable resistance (pot) between 0-10KΩ, and R2 as fixed resistance of 4.7KΩ, and C as a 1μF capacitor.

Square Wave using 555 (Schematic)

Square Wave using 555 (Schematic)

In the on cycle (when Vo (pin 3) is high), pin 7 would be open. Pins 2 & 6 can be assumed tristate. Hence, then C is getting charged towards Vcc through R = R1 + R2.

In the off cycle (when Vo (pin 3) is low), pin 7 would be GND. Pins 2 & 6 can be assumed tristate. Hence, then C is getting discharged towards GND (pin 7) through R = R2.

Moreover, note that in the on cycle as soon as capacitor voltage reaches 2/3 Vcc, Vo (pin 3) becomes low, and pin 7 becomes GND, i.e. off cycle starts.

And, in the off cycle as soon as capacitor voltage drops to 1/3 Vcc, Vo (pin 3) becomes high, and pin 7 becomes tristate, i.e. on cycle starts.

And the above sequence keeps on repeating, thus giving a square wave on Vo (pin 3), with on time t_on controlled by charging through R1 + R2 and off time t_off controlled by discharging through R2.

From RC circuit analysis, we have that voltage Vc across a capacitor C, getting charged through resistance R, at time t is given by:
V_c = V_s * (1 - e^{\frac{-t}{R*C}}) + V_i * e^{\frac{-t}{R*C}},
where Vs is supply voltage (Vcc in our case), Vi is the initial voltage on the capacitor.

So, t_on could be obtained from the fact that it starts with inital voltage Vi = 1/3 Vcc, and ends when Vc = 2/3 Vcc, being charged by Vs = Vcc through R = R1 + R2. That is,
2/3 * V_{cc} = V_{cc} * (1 - e^{\frac{-t_{on}}{R*C}}) + 1/3 * V_{cc} * e^{\frac{-t_{on}}{R*C}},
which on simplifying gives:
t_{on} = R * C * ln(2) = (R1 + R2) * C * 0.6931 … (1)

Similarly, from RC circuit analysis, we have that voltage Vc across a capacitor C, getting discharged through resistance R, at time t is given by:
V_c = V_i * e^{\frac{-t}{R*C}},
where Vi is the initial voltage on the capacitor.

So, t_off could be obtained from the fact that it starts with initial voltage Vi = 2/3 Vcc, and ends when Vc = 1/3 Vcc, being discharged through R = R2. That is,
1/3 * V_{cc} = 2/3 * V_{cc} * e^{\frac{-t_{off}}{R*C}},
which on simplifying gives:
t_{off} = R * C * ln(2) = R2 * C * 0.6931 … (2)

Live Demo

Pugs doesn’t get a punch unless he sees the theory working in practice. That’s where, he sets up the above circuitry on a breadboard as shown in the figure below:

WARNING: Do NOT put the pot to a value of zero, as that will short Vcc & GND, and may blow off the circuit. A safety workaround could be to put a fixed 1K resistor in series with the pot.

Square Wave using 555 (Breadboard)

Square Wave using 555 (Breadboard)

The audio jack is being used for observing the waveforms on the home-made PC oscilloscope, as created in his previous PC Oscilloscope article.

Below are the three waveforms Pugs observed for the values of R1 being adjusted to 1.28KΩ, 4.2KΩ, 8.6KΩ:

R1 = 1.28K, R2 = 4.3K

R1 = 1.28K, R2 = 4.3K

R1 = 4.15K, R2 = 4.3K

R1 = 4.15K, R2 = 4.3K

R1 = 8.60K, R2 = 4.3K

R1 = 8.60K, R2 = 4.3K

From the waveforms, Pugs approximately have the following t_on & t_off:
R1 = 1.28KΩ => t_on = 3.8ms, t_off = 3.0ms
R1 = 4.15KΩ => t_on = 6.0ms, t_off = 3.0ms
R1 = 8.60KΩ => t_on = 9.0ms, t_off = 3.0ms

Now, as per equations (1) & (2), for C = 1μF, R2 = 4.7K, and the above three R1 values, we should have got the following:
R1 = 1.28KΩ => t_on = 4.1ms, t_off = 3.3ms
R1 = 4.15KΩ => t_on = 6.1ms, t_off = 3.3ms
R1 = 8.60KΩ => t_on = 9.2ms, t_off = 3.3ms

Pretty close, but the t_off not really satisfactory. That triggered Pugs to take out his multimeter and check the resistance of the fixed resistor R2, he used. Ow! that actually measured 4.3K. Recomputing using R2 = 4.3K, gave values amazingly close to the observed values.

Summary

Thus by appropriately choosing the R1, R2, and C values one should be able to get a square wave of a desired frequency given by 1 / (t_on + t_off) and duty cycle given by t_on / (t_on + t_off). Obviously, the frequency would have a practical upper limit dictated by the 555 IC, though it is typically in MHz. What about duty cycle? Note that as per relations (1) & (2), t_on will be always greater than t_off. Thus, duty cycle would be always greater than 0.5.

So, what if we need duty cycle less than 0.5, or at least equal to 0.5, where t_on = t_off. This is what Pugs is working out on. Watch out for the next article.

Next Article >>

   Send article as PDF