# Designing a 555 timer wannabe

As I’ve previously said I’m not actually very good at analog design – due to a mixture of not really being taught past the basics and maths not being my strong point! Nonetheless, I enjoy doing it and when the circuits I design work as I intend, its a great feeling of achievement, much more than programming a finite state machine in C!

The majority of my analog design happens when I don’t have access to my own programming tools and when I’m bored – e.g. lunch time (post eating of course!) at work. So, one saying that I really dislike is “why bother re-inventing the wheel”, its a pretty dead-end saying and in my view, squashes any creativity and learning experiences that can come with re-designing an already existent item. Enough of my rant! Today, I decided to re-invent the wheel known as the 555 timer. My main aims was to re-invent the 555 timer with the least amount of components I could manage while keeping some of the 555 timer functionality. To cut a long story short, I managed to get pulse width modulation, a maximum simulated frequency of 2MHz and breadboard frequency of ~350KHz (MASSIVE additional capacitance). The power consumption was somewhat reasonable and the whole circuit was just made of BC337-40 transistors and standard valued resistors.

I think that the 555 timer though not found in too many commercial products today is an absolutely genius piece of design and in theory, so simple but useful in so many applications. The way that it works for astable mode is:

From 0v, charge a capacitor connected to the trigger and threshold pins with two series resistors. Once the capacitor passes the 2/3Vcc mark, pull down the midpoint of the two series resistors to ground and discharge the capacitor. Once the capacitor voltage has dropped below 1/3Vcc, let the midpoint of the two resistors float and commence the charging cycle again. Continue indefinitely and voila, a square wave source!

The way this was implemented in hardware is brilliant though. There are two comparators, an upper and lower comparator. The upper comparator has a constant voltage of 2/3Vcc one the non-inverting terminal and the capacitor is connected to the inverting terminal. When the capacitor voltage is <2/3Vcc, the output will be high. When the capacitor voltage is >2/3Vcc, the output will be low. Simple! The lower comparator has a constant voltage of 1/3Vcc connected to the inverting terminal. The capacitor is also connected to the non-inverting terminal of this comparator. When the capacitor voltage is <1/3Vcc, the output will be low. When the capacitor voltage is >1/3Vcc, the output will be high. The two outputs of these comparators are connected to an RS flipflop. When the upper comparator is high, the output is set. When the output of the lower comparator is high and the output of the upper comparator is low, the output is reset. When the upper comparator is low and the lower comparator is low, the output will be set and so on. This feature is really useful as it acts as a somewhat delayed schmitt trigger. A schmitt trigger is another brilliant device which has a feature known as hysteresis. In laymans terms, hysteresis is the “dont care” region of a schmitt trigger. A schmitt trigger generally has one input and one output. I’m not going to explain schmitt triggers here as there are brilliant articles everywhere about them (http://goo.gl/oO7GdS).

Back to the original point however! To make my discrete simplified 555 timer, I’m going to need an RS flip flop, two comparators and a “discharge” transistor (using 555 timer terms there!). An RS flip flop is really easy and can be made out of 4 transistors. This was optimized for my circuit as you will soon see! For those who are interested, in non digital transistor terms, this is known as a bistable multivibrator (http://goo.gl/tAAs2). It uses two transistors with a feedback loop between then, the base of one transistor is connected to the collector of another and vice versa.

The next required part is a comparator. A bit more thought was required for this part. A comparator can be made with a differential amplifier but that requires two transistors and a couple of resistors atleast! When you decompose the definition of a comparator however, my solution becomes much more apparent so lets discuss what a comparator does: If X>Y, output = 1, if X<Y, output = 0. Or vice versa depending on X and Y and if you want an inverting comparator… So what simple electronic devices output a voltage if an input voltage is exceeded? Or more so, what electronic devices have some form of voltage dependency? To which I hear the resounding cry “MOSFET” to which I say yup, MOSFETs are voltage controlled devices where the drain current is dependent on the voltage across the source and gate. A MOSFET can actually be used as an inverting “comparator” where the trigger point is equal to the Vgs(th). With a resistor between the drain and a positive supply, the source connected to ground and the gate connected to a voltage source, a simple inverter is formed (http://goo.gl/z2i9h5). The output will be low when the input is > Vgs(th) and the output will be high when the input < Vgs(th). This will produce a crude comparator and the output will change “relatively” slowly to the signal. If you place 3 of these in a chain, you will have your inverting comparator with a pretty snappy change point.

The thing with MOSFETs however is that they’re more expensive than your run of the mill transistor and are much more sensitive to static too! Not forgetting that I have a load more transistors than MOSFETs. Which leads to the next step. I could’ve used MOSFETs for the comparators, that’s a definite, I wanted to however use a transistor. Transistors are also great devices, if you flow current through the base, to the emitter, a multiplied current will flow from the collector to the emitter with the multiplication equal to the DC gain of the transistor (varies with all sorts of parameters such as temperature, voltage etc). One pretty interesting thing however is that the base-emitter junction of a transistor is essentially a forward biased diode. Diodes follow the standard laws of physics too. They have a relationship stated by the Shockley equation that the current through the diode is exponentially proportional to the voltage (http://goo.gl/D00Gvw). This means that for a small change in voltage, you can get a pretty drastic change in current! This feature also allows a transistor to be used as an inverter just like the MOSFET (http://goo.gl/9JNZII), with the addition of a base resistor, of course. The threshold voltage of a transistor inverter will be equal to the forward bias voltage which can be quite often be assumed as 0.5v-0.7v. This threshold voltage can however be changed with a potential divider. And with all this bro-theory, its time for some simulated proof!

A simple RTL inverter. As you can see, the threshold (the point where the input bisects the output – blue goes through green) is at ~0.7v.

Adding a resistor from the base to ground of equal value to the base resistor halves the voltage at the base. As you can see, the threshold point has now moved up to ~1.2v.

Finally, simulating both circuits together, it can clearly be seen that by adding a base resistor, the threshold voltage has increased!

So! By varying the potential divider (or omitting the base to ground resistor completely), the threshold voltage at which the output goes high can be adjusted. By cascading two of these stages together, an inverting or non-inverting comparator can be formed where the threshold voltage for the potential divider version will be roughly equal to: 0.6*(R1+R2)/R2 where R2 is the base resistor to ground and R1 is the resistor between the base and voltage source.

We now have the two main building blocks for a 555 timer – A RS flip flop, or bistable multivibrator and a voltage configurable comparator! Now as I’m sure you’ve all been waiting for, I’ll show off my final schematic for the Harris ® 555 timer. Actually, scratch that! An electronics company called “Harris” already developed the 555 timer so I’m going to pretend I never said that!

Voila! The big daddy of a circuit consisting of 5 transistors and 6 resistors (excluding timing components!).

As I originally stated, I was only going to implement a few features of the 555 timer, and the main feature of this one is the fact that is works as an astable oscillator! The calculations will not be the same as for the 555 timer as the voltage the capacitor bounces between is defined by the VFwd of Q2 and the VFwd (after the divided voltage) of Q1. It does however oscillate and produce a pulse width dependent on the values of R7 and R8. The actual duty cycle calculation: (R1+R2)/(R1+2R2), is somewhat accurate showing that it is working the the “same manner” of the 555 timer.

The simulation results are pretty conclusive in showing that by varying the ratio of discharge to charge resistor, you can change the pulse width.

Using equal resistors should theoretically give 66.6% duty cycle but this is however looking pretty close to a mere 50% duty cycle, shock horror at the non-perfect 555 timer!

Changing the ratio of resistors results in a different duty cycle, as expected!

One of my main explanations to why this is imperfect is the input current requirement for the two comparators. The capacitor has a charge current of 5/(10k+1k) = 454uA and as stated by the simulator, both comparators draw ~10uA together. The “discharge” transistor also doesn’t provide a perfect discharge path. All of these factor into non-perfect frequency and duty cycle control.

As you can see, the lower comparator has a pretty poor switching action, its not got a very good fall time at all compared to the upper comparator! This if I added two inverters on the output of this stage, this would be much better but in the grand scheme, it seems to work fine!

So why bother going to all this effort of optimization if I’m not going to try it in real life?! WELL! Thats where you’re wrong!

As you can see, it works in real life and even produces a nice variable pulse width with the addition of 3 more components! I’m not sure if you can use github for anything other than code (namely the spice files for this project) but it’s worth a try!