>  Home

> BEAM background

>  Getting started

V Tutorials

 > The "Miller" walker tutorial

 > Mechanics tutorials

 > Schmitt triggers, logic, and feedback

 > "Hacking" a Mac floppy eject motor

 > Reversing a motor without sensors

 > Build an RJP


BEAM From the Ground Up is a BEAM Reference Library site.

Schmitt triggers, logic, and feedback
Wilf Rigter tells all...

This tutorial started out with a look at Richard Piotter's Schmitt.gif schematic.


This circuit is simple but non-inverting, has no input diodes, and has relatively low input impedance so it can't be easily used as a substitute for a 74C14 / 74HC14 Schmitt trigger inverter for BEAM type applications.

So I modified it as shown in the following diagram which more closely simulates a 74C/HC14 Schmitt trigger including inversion, reasonably high input resistance (4M) and the all important input protection diodes.


Then I decided to write a little description of operation and before you know it turned into a tutorial. The Schmitt trigger is a nice example of positive feedback so trying to describe that concept took another few paragraphs.

"Why?" you may ask. Fourteen components may seem like a lot to simulate 1/6 of one 74HC14, but this discrete circuit shows you what is really going on inside that little black IC we so often take for granted.

The Schmitt trigger is used in BEAM for Nv and Nu neurons but is more generally used to clean up analog voltages and convert them into nice sanitary binary logic levels. If you are in a hurry you can skip straight ahead to the section on the Schmitt trigger but if you like some background read the bit about digital and analog signals and feedback first.


Digital signals are generally considered to be one of two logic states called by various names: On / Off, High / Low, One / Zero, 1 / 0 and Vcc / Gnd. These are called logic signals because they are unambiguous "either / or" values.

In the real world, the voltage levels that represent logic states are not precisely Vcc and Gnd. When these fuzzy real voltage levels are applied to digital inverter inputs, they are compared to an internal voltage threshold and the difference between the applied input voltage and the threshold is amplified (multiplied) by a factor of about 100. These real voltage levels representing 1 and 0 must be in a range of values, sufficiently above and below the actual switching threshold so that despite their fuzzyness (noise) they always generate logic 1 or 0 levels at the output of the circuit.

In 74HCxx logic logic "1" signal levels are defined as greater than 2/3 Vcc and a logic "0" signal must be less than 1/3 Vcc. The range of voltage levels between 1/3 Vcc and 2/3 Vcc is considered to be in the "forbidden" zone since signals in that range cannot be guaranteed to be 1 or 0. When a voltage near the switching threshold in the middle of the "forbidden" zone is applied to a digital input, the digital output can and does generate a burst of pulses which can play havoc in the precise digital world of counters and registers.

In the real world, we also have to consider that when a 1 changes to a 0 and vice versa, the change is not instantaneous and while the logic voltage level slews from 1 to 0, it traverses through the "forbidden" zone. But since digital logic cannot react instantaneously to change either, there is a specification given for the minimum rate of change (switching time) which is guaranteed not to generate more than a single transition in response to the logic level change.

So our unambiguous digital logic ignores glitches as long as the time of change is sufficiently short duration (< 500 ns). In short, a digital circuit responds to and generates one of two digital voltage levels, nominally labeled "1" and "0". These levels must be above and below the "forbidden" zone and any changes in logic levels must be sufficiently rapid to meet the minimum specified switching times. Perhaps now is a good time to mention that in the world of BEAM circuits, these rules are generally ignored. Also note that On / One / 1 / High is generally, but not always, equivalent to Vcc; meanwhile, Off / Zero / 0 / Low is generally, but not always, equivalent to Gnd. Sometimes this common-sense correlation is reversed (so that "On" is denoted by Gnd, and "Off" by Vcc) -- this is called "negative logic," and happens to be used in microcores.

But I digress.


Digital signals are to analog signals what black and white is to the full spectrum of colors. Analog signal levels can be any value and each value is significant. In the real world there is a limit to the minimum and maximum values that can be distinguished by the input of an analog circuit and the values that can be generated at the output of an analog circuit. Usually these signals fall in the range between the circuit power supply voltages. The main thing to remember is that sensors such as such as LDRs, PDs, thermistors and time sensitive circuits, such as RC networks (Nv / Nu), all generate analog voltages including those that are in the digital "forbidden" zone.

In order to interface the analog and digital worlds we must use special circuit designs to avoid generating unpredictable chaotic results. This is done by using positive feedback.


One of the most important concepts in electronics is feedback. Once you understand this basic principle which applies to all dynamical systems, you will experience a quantum jump in knowledge. If I may be so bold to suggest this idea: Chaos, Order and Feedback rule in a delicate balance that gives rise to all phenomena in this universe.

Feedback, as the name implies, occurs when a process or interaction is recursively modified by the output or result that it generates. In electronic circuits this occurs when all or a part of the output signal(s) is added or subtracted from the input signal(s). Feedback therefore has two distinct forms: Positive and Negative. To keep things simple and on familiar ground, we will just discuss in general how BEAM circuits use feedback and in detail how positive feedback is used in Schmitt trigger circuits.


The essence of BEAM is the "autonomous" interaction between the electronic and mechanical assembly called the robot and it's environment as seen through it's sensors. The sensors provide input signals which modify the action of the robot and, in turn, that action modifies the signals received by the sensors. Well that is a fine example of electromechanical feedback!

In a phototropic robot like a photopopper, the circuit that controls the motors sends more current pulses to the side that receives less light. This causes that side to turn towards the light source until both light sensors are balanced. Then both sides receive equal current pulses as the robot "waggles" towards the light.

In the Herbie line follower, the motion is continuous rather than pulsed and the robot follows a broad white line against a dark background. Each motor receives current in proportion to the imbalance (also called error or difference signal) of light on the two photo sensors that point to the left and right edges of the white line. For example, as the 'bot drifts left, off the center of the line, the left sensor receives less light as it moves over to the dark background while the right sensor receives more from the center of the reflective white line therefore creating an imbalance signal that increases the current to the right motor and moves Herbie back on track.

Phototropism is an example of negative feedback because the system as a whole moves towards the "balanced sensors signals" condition. This is a very important distinction from the "maximum sensors signals" condition. Photophobic behavior is and example of positive feedback that steers the system as a whole towards "unbalanced sensor signals" rather than the "minimum sensor signals" condition. However don't let these subtle distinctions get in the way of the main idea that the action of the system influences the sensors which influences action of the system and so on - that is the feedback loop we so often mention in the discussion of BEAM circuits.


If you got the idea of mechanical feedback, then electronic feedback should be easy. In BEAM type applications which use digital inverters for quasi analog applications , the feedback balance point is the input voltage level (threshold) at which the output switches over. For 74HCxx inverters like the 74HC240 that level is 1/2 Vcc, right smack in the middle of the "forbidden" zone. We mentioned earlier that negative feedback subtracts from the input signal and steers the circuit output towards the balance point. Positive feedback adds to the input signal and steers the circuit output away from the balance point.


Negative feedback subtracts from the input signal because it is inverted before it appears at the output and any inverted output signal will subtract from the input signal.

A good example of negative feedback would be a 74HC240 inverter with a resistor connected from input to output. If you measure the output of that circuit with a voltmeter you will know precisely what the threshold voltage of the inverter is. For a 74HC240 at Vcc = 5 V the output will be very close to 2.5 V. As mentioned before digital logic is not designed to operate with input voltages from the forbidden zone and if you measure the Vcc current you will know why it draws 50 mA or more current. In addition, if you turn on a radio near the circuit, the high frequency oscillation radiated from the circuit should be quite overpowering compared to local radio stations.

In general, negative feedback is undesirable in digital circuits but it can be harnessed and put to good use as will be discussed later.


Positive feedback adds to the input signal and steers the output away from the balance point, out of the forbidden zone and towards the Vcc or Gnd levels of ideal logic signals. This is why positive feedback is generally useful in BEAM circuits and can in fact be used to counteract the effects of negative feedback.

There are many examples of external positive feedback in BEAM bicores, monocores, SE triggers and latches. But the 74HC14 of Microcore fame, is an example of internal positive feedback because the feedback occurs inside the chip. As a black box, all we know about the 74HC14 is that it has two thresholds and that regardless of the input signal, the output signals always have nice clean single transitions, are always at Vcc or Gnd and never at some in between value (unless we forget to add a resistor in series with the LED indicators). This internal positive feedback is what makes the 74HC14 Microcore work and why, without positive feedback, a 74HC240 Microcore always degenerates into saturation.


The Schmitt trigger is a special circuit which acts like a switch that changes state at two different thresholds. These are called the upper and lower threshold or the positive and negative going threshold. The difference in these two threshold levels is called the hysteresis voltage.The Schmitt trigger does not react to any input voltage level in the range between the two thresholds, which for a 74C/HC14 corresponds precisely to the "forbidden zone".

A Schmitt trigger can also be likened to two comparators controlling an RS flip-flop at the output. In fact, the schematic of the 74C14 shows it to be designed that way. The upper threshold comparator sets the output latch and the lower threshold comparator resets the output latch.

These two thresholds (balance points) makes the 74HC14 Schmitt trigger different from an ordinary 74HC240 inverter with a single threshold at 1/2 Vcc.

Each of the six inverters in a 74C14 Schmitt trigger uses 12 MOSFETs, so by comparison the discrete version of the Schmitt trigger using 3 transistors and 11 other components is about as complex.

Normally the 74HC14 threshold parameters are a fixed ratio of Vcc. This keeps the device functionally simple and as a result the 74HC14 Schmitt trigger is one of the most popular devices for interfacing real world signals to digital electronics. It just doesn't get any simpler compared to the other versions we will discuss.

However it is a little known fact that it is possible to alter the thresholds of a 74HC14 by using negative feedback from output to input. For example, by adding a 5.1M resistor from output to input and a 1M input resistor this will provide about 15% negative feedback. That is subtracted from the internal 30% positive feedback and with Vcc=5V, it effectively changes the thresholds at the input of the 1M resistor to approximately 2.1V and 2.9V. Very useful if the signal of interest has smaller transistions than the normal 74HC14 hysteresis voltage.

Beside the 74HC14, there are a number of ways to impliment a Schmitt trigger in CMOS logic. The simplest is to use a non-inverting buffer like the 74HC245 and connect a 3M resistor from output to input to provide positive feedback which is summed with the input signal through the 1M series resistor. These values will give the same thresholds as a 74HC14 but keep in mind the input resistance is 4M to GND or Vccc depending on the current output state.

CMOS logic Schmitt trigger schematic

The same circuit can be achived with two inverters like the 74HC240 version shown. The two inversions of the signal generate the required positive feedback. Both the true and inverted output signals are available. One variation on the last circuit is to add some negative feedback with a 4.7M resistor from the inverted output to the input. This cancels out part of the positve feedback and reduces the hysteresis voltage while permitting a larger input resistor.

Ideal amplifiers called opamps (a.k.a., operational amplifiers) can be used to make a simple (compared with the discrete version) Schmitt trigger but don't let it lure you away from the object of the exercise showing just what goes on "under the hood" of a transistor Schmitt trigger:

Operational Amplifiers Schmitt trigger

I have included the inverting and non-inverting examples of opamp Schmitt trigger which have adjustable threshold and hysteresis voltage. Note that in both cases the potentiometers settings interact so that the threshold and hysteresis must be adjusted by trial and error.



The above diagram reproduces the basic Schmitt trigger circuit of Richard Piotter. It consist of two inverters (NPN and PNP) which give a double inversion to the input signal. The output of the second stage is fed back and summed with the input signal and a resistor to ground. Think of those resistors as forming a voltage divider which determines the input voltage required to cross the 0.6 V threshold of the NPN base emitter junction to turn the transistor on of off. With the values given the positive going threshold is 1.95 V and the negative going threshold is 1.34 V assuming a Vcc of 5V. The output signal at the PNP collector is non-inverting with respect to the input signal.


This diagram shows how the basic circuit is modified to give the symmetrical 1/3 - 2/3 Vcc thresholds equal to the 74C/HC14 Schmitt trigger. This is done by setting NPN emitter voltage to 1/2 Vcc - 0.6 V which makes the on / off switching threshold at the input NPN base exactly 1/2 Vcc. The 1M input and 3M feedback resistors form a voltage divider that sets the values of the positive going input threshold to 2/3 Vcc and the negative going input threshold is 1/3 Vcc.

The positive feedback signal at one end of the 3M feedback resistor is alternately Vcc or Gnd depending on the state of the non-inverted output signal at the collector of the PNP transistor. The other end of the 3M feedback resistor is at the base of the input NPN which is at 1/2 Vcc during switching. The voltage at the input of the 1M resistor is therefore 1/3 * 1/2 Vcc = 1/6 Vcc above and below 1/2 Vcc which at Vcc = 5V is 3.33 V and 1.66 V respectively. This ignores the effect of the <0.1 uA that sinks into the base of the NPN at switching.

The inverting NPN output stage provides isolation, and input protection diodes were added to simulate the 74C/HC14 inverting Schmitt trigger so that this circuit can now be used in the same kind of applications as that device but at Vcc up to 24 V or higher depending on the transistors. The NPN output drive to positive is limited by the 4.7K resistor but it could be replaced with a smaller resistor or even a pager motor. The resistor in the PNP collector was chosen for low power but can be replaced with 4.7K to increase base drive for the NPN output transistor.

The input diodes are not needed for protection since the 1M resistor takes care of that but may be needed to clamp an input coupling capacitor (i.e., Nv) to the negative and positive rails. This is called DC restoration since it removes the residual charge from the capacitor so it has no memory of any previous switching operation which might otherwise affect the timing of a subsequent switching operation.

While this circuit is not an economical substitute for the 74HC14, it gives a good insight into the design of trigger circuits in general.



For more information...

The material in this page is an edited and updated (based on email conversations) version of a BEAM-list posting by Wilf Rigter.

Sitemap  Image  Search  Image  Legalities  Image 
Page author: Wilf Rigter
This page was last updated on

Creative Commons License
This work is licensed under a
Creative Commons License.