Comparator circuit (electronic if-statement ):

Hello guys, you know the importance of "if-statement " in programming but How you can Do if-statement with electronics?

We will do this by comparator:

In electronics, a comparator is a device that compares two voltages or currents and outputs a digital signal indicating which is larger. It has two analog input terminals; A comparator consists of a specialized high-gain differential amplifier. They are commonly used in devices that measure and digitize analog signals, such as successive approximation ADCs, as well as relaxation oscillators.
DAC with comparator :slight_smile:
Let’s do this algorithm:
power supply circuit:
We will use 12 v low-frequency transformers with bridge followed by filter capacitors.
Explanation of the circuit the Zener will make the volt staple at 5.1v on inverting pin of an op-amp, volt that is compared it will come from the pot
By variation, the pot: if the volt is more than 5-volt op-amp output is 12v led is on
Else "less than 5v the output will be zero led is off
Full circuit:

Link of the circuit:
feel free to ask me any question:


Facebook: Eng. Darwish Ali