
Schmitttrigger circuit tutorial
Noise reduction with hysteresisNoise elimination is one of the main problems in achieving higher data rates and longer communication cables. There are several ways noise can be reduced. Communication lines can be shielded. Differential communication like with RS422 and RS485 is quite immune to noise, especially when the wires are twisted. Low output impedance and proper termination resistors to reduce reflections may also help, but there will always be some noise left on the line. This noise can be reduced by adding input filters, for example with an RC network, but input filters have the disadvantage that they not only reduce noise, but also the maximum allowed data rate. Another possibility is adding a hysteresis in the input line. An input line with hysteresis uses two switching levels V_{high} and V_{low}. When the input voltage exceeds V_{high}, the output switches to a high level. Only when the input voltage falls below V_{low} (which should be lower than V_{high}), the output switches back to its low state. This type of noise reduction is implemented in the inputs of the I2C bus. The effect of an hysteresis can be seen in the next picture.
The first graph shows the actual input signal. There is quite some noise on the line, and if the center voltage is used to determine if the input is in the on, or off state, there can be four high periods detected in the signal as shown in the second graph. If we however use two trigger levels with hysteresis, it is possible to reduce the number of detected logical highs to only one. This is what the Schmitt trigger does in the last graph. Low level Schmitt trigger circuitMaking an electronic circuit with hysteresis is not difficult, thanks to Otto Schmitt, an American scientist. He invented a simple electronic circuit which has a builtin hysteresis effect. This circuit is now known as the Schmitttrigger. Two transistors and a handful of carefully chosen resistors are enough to create the circuit. The values of the resistors define the input voltage levels where the Schmitt trigger circuit changes state. The basic Schmitt trigger circuit is shown in the next picture.
Calculation of the high trigger levelLet's try to understand this circuit by assuming the input voltage is zero. Transistor T_{1} will not conduct because of the zero input voltage. The state of transistor T_{2} is totally determined by the resistors R_{C1}, R_{1} and R_{2}. These three resistors create a voltage divider. Let's assume that the base current flowing in T_{2} is small enough to be neglected. With modern transistors where the gain h_{FE} is often larger than 150 this assumption will create only a very small error. The base voltage of T_{2} can then be calculated asV_{B2} = V_{supply} * R_{2}/(R_{C1}+R_{1}+R_{2}) The emitter voltage of T_{2} will be less, because of the V_{BE} voltage difference between the base and emitter. For a silicon transistor where current is flowing, the V_{BE} voltage can be estimated at roughly 0.61 Volt. The emitter voltage can be calculated as: V_{E2} = V_{B2}  V_{BE2} = V_{supply} * R_{2}/(R_{C1}+R_{1}+R_{2})  0.61 The Schmitt trigger circuit uses emitter coupled logic. Therefore V_{E} = V_{E1} = V_{E2}. Now consider the situation that the input voltage of the circuit increases. As soon as V_{B1} is larger than V_{E1}, a very small current will start to flow through transistor T_{1}. This current also passes resistor R_{C1}, and therefore the base voltage of transistor T_{2} will decrease. As the base voltage gets lower, so does the emitter voltage of transistor T_{2} and because the emitters of transistor T_{1} and T_{2} are directly coupled, the voltage difference V_{BE1} will increase. More current will start to flow through transistor T_{1} and transistor T_{2} will close. Please note that the emitter voltage over resistor R_{E} won't fall to zero. Although T_{2} is closing, T_{1} is opening at the same time keeping the emitter voltage more or less stable at a value of V_{in}  V_{BE}. When T_{2} is totally closed and T_{1} has opened, the system has changed state. The output will change to the high state because resistor R_{C2} pulls the output to the power supply. The trigger voltage where this effect starts to happen is called the high trigger voltage and can be approximately calculated as V_{high} = V_{supply} * R_{2}/(R_{C1}+R_{1}+R_{2})  0.61 It is evident that an increasing voltage at the input of the circuit will keep the circuit in the high state. This is because a higher voltage at the input will create a higher base and collector current and this higher collector current will pull the base voltage of transistor T_{2} even further down. But when does the circuit fall back to its zero state again? This requires further analysis of the circuit. Calculation of the low trigger levelIf V_{in} is lowered, the current flowing through T_{1} will decrease. This causes the current through resistor R_{C1} to decrease and the voltage level at the base of transistor T_{2} will increase. Because the transistors are emitter coupled, the emitter voltage of that transistor decrease, and when V_{in} is low enough, the base voltage of transistor T_{2} will become slightly higher than the emitter voltage, causing a small base current to flow through T_{2}. This small base current will create an emitter current through the shared resistor R_{E}. The emitter voltage will rise and less current will flow through T_{1} because the voltage difference between the base and emitter of T_{1} gets smaller. This causes less current to flow through R_{C1} and the base voltage at T_{2} increases even more. T_{2} will open and T_{1} will close at the same time. At this input level V_{in} the circuit has changed state back to zero. But at what specific voltage is this state change triggered?Calculating the low trigger voltage for a Schmitt trigger circuit is a little bit more difficult than calculating the high trigger level. T_{2} will start to open when the base voltage V_{B2} gets slightly larger than the emitter voltage V_{E2}. We will try to calculate the input voltage where V_{B2} and V_{E2} are equal when T_{2} is closed. First some basic calculations for voltages and currents in the circuit when T_{2} is closed. As stated above, we assume that the base currents flowing through the transistors are small. Therefore the collector current and emitter current through T_{1} are considered equal. Also because T_{2} is closed, there won't flow any base current through this transistor. V_{E} = I_{E1} * R_{E} V_{C1} = I_{R1R2} * (R_{1}+R_{2}) V_{supply}  V_{C1} = (I_{C1} + I_{R1R2}) * R_{C1} The important factor in this calculation is the collector voltage of transistor T_{1}, because if we know this value we can easily calculate the base voltage of transistor T_{2}. Given the above equations and the assumption that I_{E1} equals I_{C1}, we can derive V_{C1} = V_{supply}  R_{C1} * (V_{E}/R_{E} + V_{C1}/(R_{1}+R_{2})) V_{C1} is still on both sides of the equation, but this can be solved with some simple mathematics. This gives: V_{C1} = (V_{supply}  V_{E} * R_{C1}/R_{E}) / (1 + R_{C1}/(R_{1}+R_{2})) With this equation, we can easily calculate the voltage level V_{B2} of the second transistor. V_{B2} = V_{C1} * R_{2}/(R_{1}+R_{2}) V_{B2} = (V_{supply} * R_{2}  V_{E} * R_{C1}*R_{2}/R_{E}) / (R_{C1}+R_{1}+R_{2}) This is where the magic jumps in. We are looking for the value of V_{B2} where the transistor T_{2} starts conducting. This is the point where the base voltage V_{B2} equals the emitter voltage V_{E}. We can therefore substitute V_{E} for V_{B2} and reduce the equation further. I will skip some steps, but the endresult can be shown below: V_{E} = V_{supply} * R_{2}/(R_{C1}+R_{1}+R_{2} + R_{C1}*R_{2}/R_{E}) When transistor T_{2} starts to conduct, the transistor T_{1} is still open, so the calculate the input voltage where T_{2} starts to conduct, we have to add V_{BE} or 0.61 Volt to this equation to calculate the value at the base port of T_{1}. The low trigger value of the Schmitt trigger can therefore be calculated as V_{low} = V_{supply} * R_{2}/(R_{C1}+R_{1}+R_{2} + R_{C1}*R_{2}/R_{E}) + 0.61
