How to make Comparators, simple explanation from an op amp circuit
Comparator circuits are very handy when you need a visual representation of an adjusting voltage level. My most common application is a volume indicator on an audio source. The output can be shown through a few LED's and give the user a quick and easy to understand volume representation
When using the op amp, if you apply a voltage to the negative input pin, and no feedback loop (the output is not connected to the input), the output will only go high when the positive input pin has a higher voltage than the negative input pin.
We can use a voltage tree to create the negative pin's input voltages.
Example : We have a tree set up with +9 Volts at the top and ground at the bottom
using 4 x 100 ohm resistors in series along the tree we get the following tap-voltages from a "tree":
9 V, 6.75V, 4.5V, 2.25V, and 0V
(see more detail on voltage trees in my other tutorial: https://www.instructables.com/id/Voltage-Tree/)
We can make each one of those an input to a negative input of an op amp (5 op amps total). We will then connect our output of our audio device to all of the positive inputs of the op amps.
Finally connect a simple resistor and LED from the output of each op amp to ground.
Now what will happen is as the output of the audio device (simulated here as a function generator +-9 V sin wave) rises to and above each of the tree tap voltages, that op amp will go high and turn on the LED at the output. Putting these LED's in a row will show that they will turn on in order as the audio gets louder.
And that is a simple way to use Op-amps as comparators for visual representation of an output. This was just one example, but you can use Op-amps almost anywhere. You can replicate this for any voltage-taps you want along the tree, and any max or min voltages.
I have images here of one example where i implemented it into an audio device. The voltage values are different, but it is the exact same technique. As the music plays louder, the LED's along the side of the board each light up.