Step 8: More on the Comparators
A large amount of my time and research was spent on the comparators. My goal was to research some about them then design my own circuit. Eventually that failed and I ended up using a tweaked version of what is shown in the datasheet schematic. Throughout the process I have learned a lot about the theory of how these circuits work so I want to share some of that with you.
I have already said that the heart of these comparators is the differential amplifier, specifically the long tailed pair. What the heck is that? I also mentioned that a diff. amp. amplifies the difference between two voltages. The long tailed pair is a common type of diff. amp. that gets its name from the resistor or other current limiter that tails off of two transistors (or vacuum tubes). The first image shows a basic long tailed pair made using 2 transistors and 3 resistors. The tail resistor connects to the emitters of the transistors; it should be larger than the two resistors that connect the collectors to Vcc. Those two resistors should be equal. Here is a (very) basic explanation:
When both inputs are at the exact same voltage, let's say 1/2 Vcc, the transistors are "on" the same amount so equal current flows through them and into the tail resistor. There is a voltage drop on both collectors but the difference of voltage between the two is 0. When the voltage of one input rises some, that transistor becomes "more on" so more current can flow through, raising the voltage at the emitters and dropping the voltage of the collector more. This rise in emitter voltage creates "back flow" into the other transistor which turns it off more. When that transistor turns off, less current flows through it so the voltage at its collector rises. So now the difference between the two collector voltages is very large, due to a small change in input voltage.
Like I said, basic. There are a few issues with the circuit: 1. Small value differences in the collector resistors unbalances the output. 2. The output is a difference of two signals, we need a single output signal. 3. When the input voltages ave very close, the output voltage difference becomes very small. How do we solve these issues? Well, there are two easy ways to improve the design. One amplifies the input and the other amplifies the output, while also solving the other issues.
Let's start with amplifying the output. Enter the current mirror. In the second image you can see the basic current mirror consists of 2 PNP transistors, one of which has its collector and base connected, a resistor tying that transistor's collector to ground, and an output from the other transistor's collector. The current mirror limits the current of the left side (in this image) to the current that flow through the right side. The transistor with its base and collector tied together acts as the control side. When the resistor drops the voltage toward ground, the transistor starts to turn on because the voltage of its base is being lowered. Then current starts to flow through the transistor which raises the base voltage until there is a balance between the amount of current flowing through the transistor and resistor. The bases of the two transistors are connected so the second transistor also turns on but only to the amount that the first one is at. Thus, the current of the second transistor is limited to the current flowing through the control transistor. How does this help the diff. amp?
First off, it helps to balance the collector current of the transistors because the current of one side is actively limited by the current of the other side. Secondly, it gives one single ended output instead of a differential output. Because one side is being used to control the current, only the other side can be used for an output. Finally, it amplifies the output. Whenever there is a difference between the inputs, one side of the diff. amp. allows more current to flow and the other side allows less. If the side that allows more current is the side that the mirror control transistor is on, then the current mirror allows more current on both side. The excess of current on the other side raises the voltage. When the opposite happens and the side of the diff. amp. that allows more current is on the mirror's load side, the control side allows very little current so there is a voltage drop on the load side. The amount that the voltage varies is much greater than before and now its only on one output.
Now the diff. amp. works much better; it is balanced much better, it has only one output, and the output has been amplified some. The first two issues have been solved, but the third hasn't been solved fully, yet. The diff. amp. with a current mirror makes a good differential stage for an OP amplifier, but it still isn't optimal for a comparator. When the input voltages become close, the output still doesn't have a sharp transition. The way to improve that is to amplify the input.
If you take a look at the third image, you can see a diagram of the Darlington transistor, or sometimes Darlington pair when two discrete transistors are used. Invented by Sydney Darlington in 1953, the transistor is designed to create very high gain by using two transistors. A signal applied to the input gets amplified by the first transistor. The current flows through the transistor and out of its emitter. The current then goes into the base of the second transistor, which amplifies it further. The result is a gain approximately equal to the gain of the first transistor multiplied by the gain of the second. If we replace the two transistors of the long tailed pair with Darlington pairs, we can increase the amplification of the diff. amp. greatly because each input will be amplified by two transistors instead of just one.
If you look at figure 4, you can see the long tailed pair with a current mirror and Darlington transistors. This circuit is very good as a comparator because it has very high gain from the current mirror and Darlington transistors which allows the inputs to be extremely close together without the output "dropping off." The circuit is also very balanced and has a single output because of the current mirror.
This is a very well designed circuit and has taught me a lot. Hopefully you have learned some too (if you didn't already know or understand it).