>> In this video, I'd like to talk about using the op-amp as a voltage-controlled switch.
Basically, we put two different voltages Vp and
Vn into the positive and negative terminals of the op-amp.
Remember that there's going to be no current going into either
of these terminals if we assume that this op-amp is ideal.
So, in this case, what happens is V0 comes out as three different possibilities.
We've got a plus Vcc and a minus Vcc,
and then what's going to happen is V0 will equal to zero if V,
let me put an if statement right here.
If Vp is equal to Vn,
it's going to be equal to plus Vcc, if Vp is greater than
Vn and it's going to be minus Vcc, if the Vp is less than Vn.
So, in effect, the two voltages that we put in Vp and Vn are going to control
what our output voltage is and it's basically going to
rail out between the positive and negative Vcc.
Now, how could we use this as a switch?
Remember that no current is coming in from our input circuit right here.
So, this side is completely isolated from our output side.
Here's the input and here's the output and these two sides are isolated.
The current actually comes from our source right here, and it is used for V0.
So, we would be able to switch something on and off drawing the
current from the power supply for the op-amp.
If we wanted to do another possibility such as V0 is equal to zero, if they are equal,
and let's suppose we want it to be some positive voltage if Vp is equal to Vn,
and then maybe we would like it to be off if Vp is less than Vn.
On that case, what you would do is you would hook up your op-amp like
this with the plus and minus terminals and you'd hook it up to Vcc,
and then your negative Vcc would just be ground.
This value, right there.
That's how you'd be able to make the switch function just a little bit differently.