Op-Amps - Using Operational Amplifiers

Terrific Physics
41 followers
Today in the workshop we're working with operational amplifiers.
You'll see how op amps work and how to use them in several popular configurations.
We'll also build a light activated switch, a dual power supply,
and we'll use op amps with an Arduino.
We're back in operation today, so welcome to the workshop.
Well hello and welcome to the workshop and today we're going to be working with
operational amplifiers, more commonly known as op amps.
Now op amps have been available in integrated circuit format for about six
decades now and during that time they have been used in thousands and
thousands of different analog designs. One of the reasons for their popularity
is because they are so versatile. You can literally configure an op amp
in a couple of dozen different ways and each of those configurations can be
considered to be an analog building block that you can use to build more
complex circuitry. Op amps can also be used to interface
analog electronics to digital electronics. Op amps are also
extraordinarily inexpensive. In fact one of the op amps we're using today
is a quad op amp that costs all of 40 cents,
so each op amp costs a dime. Now what we are going to do today is we're going to
of course start off by learning a bit about op amps
and then we're going to put some of that theory into practice. We're going to
take an op amp, put it on a sawdust breadboard and wire
it in a number of different configurations.
After that I'm going to show you how we can use an op amp with a micro
controller. We're going to connect one to an Arduino
Uno. After that we're going to build a little project, the light sensitive
switch that is built with an op amp and will
probably cost you about two dollars in components to put together.
And finally many op amps need a dual power supply, a supply with both a
positive and a negative component. Well most of us have bench supplies that
only are single power supplies, so we're going to build a converter that
converts a single supply to a dual supply
and of course that converter is going to be built with an op amp.
I told you these things are versatile. So let's start off by learning a bit more
about operational amplifiers. An op amp is a high gain differential
amplifier. It has both a positive or non-inverting
and negative or inverting input. An op amp amplifies the differences
between these two input voltages. These devices are characterized by having
a very high input impedance and a very low output
impedance. Originally operational amplifiers were
developed for analog computers. Analog computers used voltages to
represent numbers. The first operational amplifier was
built with vacuum tubes in 1941. The UA702 was the first integrated
circuit operational amplifier and it was designed in 1963.
The schematic symbol for an operational amplifier
shows as a triangle with a number of connections to it.
On the top we have the positive power and on the bottom the negative power.
Most operational amplifiers require a bipolar power supply with both
positive and negative components. There are two
inputs in the op amp, an inverting input and the non-inverting input. Note that
the inverting input on top and the non-inverting on the bottom is not a
convention and when you see op amps drawn in
schematic diagrams you can see it drawn the other way
around as well. It just depends what looks better on the diagram.
Finally the output of the op amp is at the point of the triangle.
In order to visualize how an operational amplifier works first we need to power
it up. We will use a bipolar power supply for
the op amp that has both a positive and a negative component.
Note that the power supply has a common ground point.
This ground point is a reference point. We'll also connect two input voltages to
our operational amplifier. V1 which is connected to the inverting
input and V2 which is connected to the
non-inverting input. Again the two voltages reference the
same common ground point. If we apply a voltage of 4 volts to V1
and 6 volts to V2 that will create a difference of positive 2 volts.
Since this is a positive difference our output will be positive
and the greater difference the greater the output will be.
If we increase V1 to 9 volts then our difference will be negative 3 volts and
so our output will go negative. Again the amplitude of the output will
depend on the amount of difference between the two inputs.
If we reduce V1 to 6 volts and keep V2 at 6 volts there will be no difference
between the two inputs. Therefore the output of the operational
amplifier will be zero. By itself an operational amplifier has a
great deal of gain. In fact the typical op-amp has a gain of a hundred thousand
times or more. Since this is likely too much for our
circuit we need to regulate it and we can do that by applying feedback
which is to take the output of the op-amp and apply it to one of its inputs.
Over here I show it being applied to the inverting input. This will actually
create an amplifier whose gain is only one. In other words what goes into the
amplifier will be what comes out. Since we might
want a little bit more gain than that but not the infinite amount of gain that
we get with the open loop we can apply a feedback resistor. The
value of the resistor will determine the gain of the amplifier
and the higher the value of the resistor the higher the amplifier's gain will be.
A common configuration for an operational amplifier is as an inverting
amplifier. An amplifier whose output is 180 degrees
out of phase with its input. The two components used with the
operational amplifier in this configuration are the input resistor and
the feedback resistor and these two components determine the
gain of the inverting amplifier. Another common configuration is the
non-inverting amplifier. An amplifier whose output is in phase
with its input. Once again the feedback and divider
resistor will determine the gain of this type of amplifier.
A unity gain buffer is an amplifier that has a gain of
one. This is also known as a voltage follower and takes advantage of the fact
that the operational amplifier has a very high
input impedance and very low output impedance.
Unity gain buffers are often used throughout op-amp circuitry.
The voltage summing amplifier is an application from the op-amp's analog
computer days. The op-amp will output a sum of the
three different input voltages. The feedback can be used to amplify this
and effectively do a multiplication on the voltage.
Another mathematical operation that could be done with an op-amp is as a
differential amplifier. In this case the output of the amplifier
will be the difference between VIN1 and VIN2.
Integration is another mathematical operation that operational amplifiers
can perform. And when performed upon a square wave
it can turn it into a triangle wave. You can also input a triangle wave into
an integrator and come out with an approximation of a
sine wave. And the differentiating amplifier
performs a differential operation on the voltage coming in. You'll notice
its effect on a square wave here. An open end comparator is a very
common configuration for an operational amplifier.
A comparator has a reference voltage and an input voltage and if the input
voltage exceeds the reference voltage the output voltage will go high or to
positive VCC. If it's below the reference voltage
it'll go low or down to the ground level.
Comparators are often used to interface analog electronics to digital
electronics. A low pass active filter is a very
common application in audio. A low pass filter allows low frequencies
to pass while attenuating high frequencies.
And it can be built as follows with an op-amp.
A different configuration creates a high pass active filter.
A filter that allows higher frequencies to pass but attenuates lower ones.
And a multivibrator is a configuration which an operational amplifier can
produce a waveform. In this diagram we are producing a
square wave whose frequency is determined by the value of Cx and Rx.
R2 and R1 can be used to determine the duty cycle and the amplitude of our
square wave. Now when selecting an operational
amplifier you should go and take a look at the spec sheets as they'll give you
all the information you need to know. There's quite a bit of info here and
some of it may be confusing. So here are some of the key
specifications to look out for. The open loop gain of the operational
amplifier defines the gain of the op-amp without any
feedback. Now an ideal op-amp would have an
infinite open loop gain. In the real world values typically
range from 20,000 to 200,000 or even more.
Now keep in mind that the maximum output that your operational amplifier can give
is going to be limited by the power supply voltage and not the gain.
The input impedance of the op-amp is defined as the ratio of the input
voltage to the input current. Impedance is a factor that is measured in
ohms. An ideal op-amp would have an infinite
input impedance and real world values for op-amp input
impedance are typically several megohms meaning
op-amps won't load down the driving circuitry.
The output impedance of an op-amp is also an important
specification. An ideal op-amp would have a zero output impedance.
In the real world the values are typically about 100 to
20,000 ohms. The gain bandwidth product or GBP
is a very important specification as it refers to the frequency response of your
op-amp. Now an ideal op-amp would of course have
an infinite bandwidth. The bandwidth of the op-amp is limited
by the gain bandwidth product and this is defined as the bandwidth
with an open loop gain of one. In the real world op-amps
typically have values from 500 kilohertz to 20 megahertz or more.
The offset voltage is the output voltage when the difference between the inputs
is zero. An ideal op-amp would have no offset
voltage. In the real world the values typically
are one millivolt to 10 millivolt and this is an inaccuracy in the op-amp.
Some operational amplifiers have an offset pin to allow adjustment of the
offset voltage. Op-amps are available in several
different packages including dip and surface mount.
You can get single, dual or quad op-amps in the same package.
Op-amps are available using both single and traditional dual power supplies.
You also might see the term rail-to-rail designs. These are op-amps whose output
can go all the way to their VCC. On most op-amps
the output is slightly less than VCC unless it is specified as being
rail-to-rail. So now let's take a look at a couple of
op-amps and put them to use. Now here are a number of op-amps that I
got out of my parts drawer and each one of these is unique in its
own right. Some of them are single op-amps, some are dual, some are quad.
There are op-amps here that are single supply and there are dual supply
op-amps as well. Now all of these are in dip
or dual inline packages. Of course you can get op-amps in other packages
but for experimenting the dip package is what we'll use because they fit into a
sawdust breadboard. Now I'm sure you've probably worked
with them before but if you haven't, on a dip package there is usually a
notch over at the front and quite often a dot like you'll see
over here and that indicates pin 1. So when you're orienting things that's
the way it is and they'll be numbered 1, 2, 3, 4 down
this side and then they'll go 5, 6, 7, 8 up on the
other side and of course for a 14 or 16 pin package the number
follows accordingly. And so let's take a look at the
characteristics of some of these operational amplifiers.
The LM324 is a very popular quad operational amplifier.
This device uses a single supply and can handle 32 volts maximum VCC.
The LM324 is used in a lot of equipment especially because of its low low price.
Currently this retails on digikey for 40 cents per unit and so when you
consider you get four op-amps in it they work out to about a dime per op-amp.
The NE5532 is another very popular operational amplifier. This is a dual
op-amp and it uses a dual power supply. Each power supply can have a maximum of
15 volts. This is a high performance
operational amplifier with very low noise and distortion so it can be used
in audio equipment designs. Another popular
operational amplifier is the LM358. It's also a dual op-amp and has
essentially the same pinout as the NE5532. However the LM358 has been wired
to use a single power supply. This is a very common operational
amplifier and as its power supply can range from 3 to 32 volts DC
it can also be used to interface analog and digital circuitry.
The TL072 is a dual operational amplifier that uses dual power supplies.
This is a very popular audio amplifier for audio designs as it has a very high
GBP and a very high slew rate and very very low noise and distortion.
The CA3140 is a single operational amplifier that uses a dual power supply
and has a maximum GBP of 4.5 megahertz. The CA3240 is the same operational
amplifier in a dual op-amp pack. These op-amps are often used in
automotive and industrial designs as they incorporate both
MOS and bipolar transistors for a very high input impedance
and a very high current output capability. The MCP6002 is a dual
operational amplifier that uses a single power supply
and that power supply has a maximum of only
6 volts. It has a 1 megahertz GBP. The MCP6022 is the same operational
amplifier with a much higher GBP. Because of the voltages these
operational amplifiers use they have been designed to be used with logic
circuits as they're perfect for both 3.3 and 5 volt logic.
They also use rail-to-rail input-to-output so they can swing
all the way up to their power supply voltage. They're very low noise and
distortion and they consume very little current.
Okay enough of the op-amp theory let's put some of it into practice. We're going
to take an op-amp and put it onto a sawdust breadboard
and wire it in a number of different configurations so we can see how these
building blocks are really created. Now the op-amp we're going to be using
is the NE5532 which is a very common operational amplifier.
It requires a dual power supply but don't worry about it you can just use a
couple of 9 volt batteries for these experiments.
So let's see how the NE5532 is wired up and then we'll proceed to use it in a
number of basic configurations. I'll be basing all of my experiments
around an NE5532 operational amplifier. This is a very inexpensive and easy to
obtain device. This is a dual op-amp and it contains
two operational amplifiers that are wired as follows.
Pin 3 of the device is connected to the non-inverting input on amplifier 1.
Pin 2 is connected to the inverting input on that amplifier.
And pin 1 is connected to the output of op-amp 1.
Pin 5 is connected to the non-inverting input of amplifier 2.
Pin 6 is its inverting input and pin 7 is the output of op-amp 2.
The positive end of the power supply is connected to pin
8 and the negative end to pin 4. Note that there is no connection on the
op-amp for ground. The positive and negative power supply
for a NE5532 can be up to 15 volts and a very convenient way of
powering these for our experiments is just to use two 9 volt batteries.
Connect the positive side of one of the 9 volt batteries to pin 8 which is the
positive VCC and connect the negative side to pin 4
which is the negative VCC. The remaining two battery terminals are
tied together and this is our ground point.
Again there is no ground connection to the NE5532.
We'll be using this basic circuit with all of the different configurations that
I'm about to show you. Now the first configuration that we'll
examine with the NE5532 is obviously the simplest configuration
there is and that's the unity gain buffer. You'll
notice that in this configuration the output of the op-amp is fed back into
its inverting input and that the input to the op-amp
is fed into the non-inverting input. Wired like this the op-amp will have a
gain of one so what goes in is exactly what will go
out and you might think that this is a pretty useless circuit but it actually
is not. The unity gain buffer is also called a
voltage follower and it can be used to take advantage of the fact that the
op-amp has a very high input impedance and a low output
impedance. If you want to mix several signals
together you can precede each one of these with a unity gain buffer
as though not to overload an input. The unity gain buffer is a circuit that
you'll see used quite often in op-amp designs.
And so here we have our first experiment the voltage follower
and of course the very simple circuit that it is.
You can take a look at how I've got it on the breadboard. I've got my two
batteries each going to the different rails and I've also got
a jumper over here and that connects the negative of the
positive supply to the positive of the negative supply if that makes sense to
you and that is the common ground. So this
makes certain that you realize that on the bottom over
here the red is actually a ground and the blue is the
negative voltage. Otherwise it's a very simple circuit
just wired up with a few jumpers. When you're working with analog
electronics on a sawdust breadboard you will find out that the breadboard does
pick up a little bit of noise etc. Now these breadboards I have on the
bottom of them they have a little aluminum plate that's supposed to help
shield them but since it isn't grounded I don't know if it's working or if it's
even adding to the problem. But you try to keep all your leads as
short as you can if you're using resistors and capacitors try to use
those to make the connections without any additional jumpers
just so you get a more stable circuit. So if you take a look on the oscilloscope
you'll see what we've got are two sine waves the yellow one on the top is the
input and the blue one on the bottom is the
output and of course they're exactly the same
and that's what you would expect with a voltage buffer it just has a gain of one
so what goes in is what comes out and of course the high impedance input
can be used to buffer sections within your design.
Probably the most common configuration that you'll see an op amp used in is as
an inverting amplifier. You'll see this used throughout audio
equipment designs for example. Now this is how we're going to wire our
NE5532 up as an inverting amplifier and we'll need two additional
components. An input resistor that's labeled as Rin
and a feedback resistor that's labeled as RF and both of these resistors in our
case are going to be 1k. Now you can see from the formula here
that the gain of the amplifier depends upon the ratio of these two resistors
so with each of them being the same value our amplifier will have a gain of
one. If you want to change the gain of the
amplifier you can do so by altering the values of the resistors
and it is common to leave the value of Rin in place
and change the value of the feedback resistor RF.
If you wish you could use a potentiometer for RF instead of a fixed
resistor so you could have a variable gain
amplifier. So let's wire this up and test it out.
Now here's the demo of our inverting amplifier. I'm applying a one kilohertz
sine wave and that is the yellow one that you see
over here on my A channel and the output channel is this one over
here and as we can see the output has been
inverted 180 degrees thus an inverting amplifier
but otherwise it looks very good it's a very nice sine wave
and again this is one of the most popular configurations of an amplifier
that you can have using an op amp. Now the opposite of the inverting amplifier
would of course be the non-inverting amplifier an amplifier whose output is
in phase with its input and this is how we would wire up our
NE5532 as a non-inverting amplifier. Note that we're using the same two
components the same resistors as we did with the inverting amplifier
and that once again the gain is dependent upon the ratio of the values
of these resistors. As with the previous design you could
change the feedback resistor if you wish to change the gain of the amplifier
or you could use a potentiometer to build a variable gain amplifier.
I should point out that the formulas I'm giving you for gain are actually
approximations because true formulas for amplifier gain
need to include the impedance of both the input and output devices
but for most cases these formulas should work fine for you to calculate the gain
of your op amps. So let's wire up our non-inverting
amplifier and test it out. And so now we have our non-inverting
amplifier demonstration and as you can see it's pretty well the same as the
inverting amplifier with one obvious difference the output signal here
is in phase with the input signal so it has not been inverted
and between inverting and non-inverting amplifiers
you can pretty well control the phase of the signal throughout your design and
it's not uncommon to use a combination of both of these
in an audio design or in other op amp circuitry.
Now the next circuit that we're going to look at is also a very commonly used
audio circuit and that's the low pass active filter. This is a filter that will
allow low frequencies to pass while attenuating the higher frequencies
and this one is a very simple filter that attenuates at a rate of three
decibels per octave. We can calculate the frequency that it
operates as by using the formula in the corner
and you'll see that with the values that we have here it'll cut off at about
1592 hertz. Now you can change the frequency of course by changing the
value of both the resistor and capacitor and in practice it's easier to
change the capacitor to a fixed value and then trim the value of the resistor.
So let's wire this one up on the breadboard and check it out.
And so here's our low pass filter demonstration hooked up and
visualized on the oscilloscope once again. Now a low pass filter of course
will attenuate higher frequencies so right now
we have a one kilohertz sine wave being fed into it
the top waveform the yellow one is the input and the blue one at the bottom
is the output. So let's increase the frequency up a little bit
and we'll go to two kilohertz and you'll notice the bottom has started to
attenuate and as I go higher in frequency
the top stays the same but the bottom goes down
and so now we're at 10 kilohertz over here and you can see it's quite a bit
less than if I back off to one kilohertz and
so our filter is working now a simple filter like this only attenuates at
about three decibels per octave but you can build more advanced filters
that can attenuate at a higher rate or a sharper rate
using the same basic circuitry that we just used over here.
Now if we exchange the position of the capacitor and the resistor in our filter
we can turn it into a high pass active filter
a filter that allows higher frequencies to pass while attenuating lower
frequencies. Once again the formula for the filter
is essentially the same and ours has a crossover of 1592 hertz.
Now high pass and low pass filters can be used to build things like tone
controls, equalizers, crossover networks and to
eliminate noise and circuits so they're very useful things to be able to know
how to construct. So let's wire this one up on our
breadboard and check it out. And here's the demonstration of the
high pass filter which of course has the opposite effect of low pass filter
the higher the frequency is the more of it it will permit through and low
frequencies will be attenuated. Now once again for the demo the input
waveform is the top one and the bottom one the blue one is the
output and we're at 500 hertz right now we're
going to go up in increments of 100 hertz this time so that you can see it
and take a look at the level on the bottom as I increase the frequency
so I'm going up in frequency now and as you can see the level is increasing
the higher I go in frequency and now I'm at five kilohertz
and the level is quite a bit higher I'll go back down so you can watch the
effect in reverse. And so a high pass filter basically just
lets high frequencies through and attenuates the lower one and again this
is a very simple filter three decibels per
octave but you can cascade these to get a sharper filter.
Now in our final basic experiment we're going to use both of the op amps in the
NE5532 and we're going to wire the first one
as a multivibrator that will produce a square wave.
The frequency of our square wave is going to be determined by capacitor CF
and resistor RF and so you could use a potentiometer for RF if you want to make
a variable frequency oscillator. Resistors R2 and R1 will determine both
the pulse width and the amplitude of our square wave.
We're going to take the second op amp in the NE5532
and wire it up as an integrator as you recall an integrator
performs a mathematical integration on a waveform.
We'll be using the value of 10k for R3, 100k for R1 and C1 will be using
100 nanofarads. Connect everything up and connect it to
the square wave oscillator that we created earlier.
We can then monitor both the square wave and the output of the integrator which
should be a triangle wave. And here's a quick demonstration of our
waveform generator and as you can see the top waveform is the square wave
and the bottom one is the triangle wave. The square is tilted a little bit at the
top but the triangle wave is just about perfect
and actually the tilting on the square could probably be fixed just by adjusting
the capacitance on my scope probe that may not be exactly accurate.
And so it works very well as a generator it's generating a frequency
now of 1.88 kilohertz but of course you could alter that frequency
by changing the resistor and capacitor values.
So if you need to generate a waveform an operational amplifier is actually a
great way to do it. Now although they are analog circuits
operational amplifiers can also be used to glue together analog and digital
circuitry and there's a couple of methods they can use to do this.
One method that we've used before is to run an op amp as a comparator
and use the comparator with a digital input pin on a microcontroller.
Another thing you can do with an op amp is to use it as an amplifier to amplify
the signal for the analog to digital converter and that's what we're going to
do right now. We're going to take an op amp and use it
to amplify a very small signal and read it with the A to D converter on
an Arduino Uno. So let's go and see how we hook that up
and then we'll put it to use. Now here's the circuit that we're going to be using
to amplify the signal for our Arduino and we're building our amplifier
around an MCP6002 op amp. This op amp is an excellent choice when
you're working with digital circuitry as it is a single supply op amp and it
has a maximum supply voltage of only six volts.
It works perfectly with 3.3 and 5 volt logic so again it's ideal for working
with digital circuitry. Now what we have here is essentially a
classic amplifier design. You can see the feedback loop in the
light blue up there. The capacitor across the resistor is
just for stability and to prevent it from going into oscillation.
The 100k pot you can use to control the gain
of the amplifier and the output of the amplifier you'll also notice is a 220
picofarad capacitor across it just for a little bit of noise reduction.
Now the input has a 100 nanofarad capacitor you can see it on the yellow
on the left side. If you were going to be amplifying DC
voltages you can eliminate the capacitor and just connect them directly.
But I've got this set up so that you could use audio
voltages from something like let's say a microphone for example.
Otherwise it's a fairly basic circuit. Note the 2.2 microfarad capacitor
that sits across the 5 volt and ground line.
You want to get that capacitor as close as you possibly can
physically to the chip. Ideally you'll straddle the chip
with that capacitor and the function of that capacitor
is to take some of the noise that might be on the line. Remember you're sharing
5 volts with an arduino and microcontrollers and their
peripherals can sometimes put noise onto the line.
Now after you've got this all wired up in the breadboard you'll need to hook it
up of course to the arduino and the hookup is very simple.
The power supply for the circuit the 5 volts will connect to the arduino's 5
volts. The ground will of course connect to the
arduino's ground. And we're going to feed the output into
analog input A0. And so once you've got that wired up
you can feed a signal into it and run a bit of code and look at it with the
arduino. So let's go and do that right now.
Okay here's our demonstration of the arduino with the op amp
amplifier and you'll notice I've also added the signal generator and an
oscilloscope to the mix right now. Now the signal generator is currently
giving out a two kilohertz sine wave at half a volt and it's being amplified
by the amplifier. What I've got the scope set to here
right now is one volt per division and so I've got just about a full output
over here it's amplifying just about 10 times. Now I'm going to reduce the
level of the input over here and now we're at 0.1 of a volt and we've
still got about a one volt sine wave over here. I'm just going to
play with the gain control a bit just to see the effect that has and
over here I can get it so high I can clip it right now if you can see that.
And I can also adjust it down so I've got a lot of gain over here a lot of
potential gain this is a 0.1 volt signal that I'm getting in here
and I'm amplifying it almost to the full voltage right now.
Now if we take a look at the arduino side of things the sketch is very very
simple. We start off by defining the pin that
we're using analog pin a zero and a variable just to hold the value of
that. In the setup we'll set up the serial
monitor that's all we do and then in the loop we're just going to
do an analog read to that pin assign the value to that variable
and then we're going to do a serial printlin
of that variable to the display and then we're going to delay for
50 milliseconds and do the whole thing over and over again.
And actually it looks better running on the plotter which is what I really wrote
it for so let's put the plotter on and as you can see on the plotter you
can see we do have a representation of our sine wave and the level is much
much higher than you would expect from a 0.1
of a volt signal so this is a really great way of
amplifying and extending the analog to digital converter
not just in an arduino uno but on any microcontroller because
this op amp will work fine with 3.3 volts as well
it's got a very good frequency response it's audio capable so you could use it
with a very high quality analog to digital
converter and also there are two op amps in the
package so you could actually build a second circuit
and amplify a second one of the a to d inputs
and really add a lot of versatility to your projects
with an op amp and a microcontroller. Now if I gave you the task of designing a
light sensitive switch one that would turn something
on or off based upon the absence or presence of light
chances are you would probably start thinking about using a microcontroller
with perhaps an ldr or a phototransistor on it
and while that will certainly work there is a much easier way of doing this and
that is of course to use an operational amplifier
we're going to build a small light sensitive switch with an
op amp that's just going to control an led but you could extend it to use a
relay or a power transistor to control something else the best deal
is that this entire design is going to take about two dollars worth of parts
and no programming required so let's go and take a look at the hookup for that
now here's the schematic for our light activated switch and we're building this
around an lm358 op amp the lm358 is a very
inexpensive and commonly available device and it has an advantage in that
it can work off of a single power supply so we're going to power everything with
one nine volt battery now the output of the lm358 is going to
a 220 ohm dropping resistor and then to an led so
we're just going to be turning an led on and off
but of course you could change this for a relay or a power transistor to drive
something else now essentially what we're doing here is
running this as a comparator with a voltage divider consisting of the 210k
resistors attached to the inverting input on the
non-inverting input we have another voltage divider which consists of the
light dependent resistor or photocell and a 20k potentiometer
you can adjust a 20k pot to adjust the trip point over here
so this is a very simple circuit let's wire it up and give it a test
and here's our light sensitive switch you can see the led is on right now
and if i go and cover the photocell the led goes
off and so basically it's being triggered whenever it sees light now of
course the led is just an indicator you could
replace the led with a transistor and a relay to drive something if you wanted
to there's also another trick you can do
with this let me show that to you right now i'm going to disconnect my led
and connect it up another way i'm going to now
put the anode up to the positive power supply
instead and now what we've got is the led is off if i cover the
photocell the led goes on so we've got the
opposite arrangement right now it's detecting dark instead of light so you
can wire it up either way that you want to which is
pretty versatile and as i said if you want to tie a transistor or a relay onto
the output you could drive something else so here
we have a photoelectric controlled switch that is
not dependent upon a microcontroller and a very
simple and inexpensive thing to build if you need something like this this is
a great way to go now as you've noticed many operational
amplifiers require a dual power supply a power supply that has both a positive
and a negative component in reference to ground
and you may not own a dual power supply my workbench supply for example
is just a single output power supply but there is a converter that you can build
to convert a single supply into a dual supply and the converter is
based around an op amp so let's go and see how easy this is
to wire up and convert a single power supply
into a power supply we can use with operational amplifiers
now here's the circuit for our power supply converter and this is being built
around in any 5532 op amp you could use another op amp if you
wish providing it is an op amp made for dual power supplies
i'm also using two output transistors a tip 31c and a tip 32c
now you could use different output transistors if you wish
the key here is to use complementary transistors
an npn and a pnp transistor that have otherwise the same characteristics
the tip 31c and tip 32c are capable of handling three amperes of
current so we can power something with up to three amps here
although if you're going to go anywhere near the current rating you should
probably put a heat sink on those transistors
if you wish you could substitute a tip 41c and 42c
and go to six amperes you'll also need a couple of 100 microfarad filter
capacitors for the output and these need to be rated at at least the supply
voltage so i would rate these at 35 volts or
more now the operational amplifier has a
voltage divider on the input that is made of two 10k resistors and that's
being applied to the non-inverting input and the
inverting input is just taking feedback from our reference or ground point on
the output and it will adjust the operational
amplifier if the op amp finds itself going at a
different reference point and this will keep the voltages
regulated on the output side so it's actually a pretty simple circuit to hook
up make sure you've got it all hooked up correctly though because you are
dealing with your power supply voltages so let's put ours onto a breadboard and
check it out and see if we can drive another op amp
circuit with our single to dual power supply converter
and so here's a demonstration of my power supply splitter now i've got it
connected to the square and triangle wave
multivibrator that we created a little bit earlier
so i'm driving one of our circuits with this circuit
i'm using my bench power supply and it's giving out 20 volts right now and it's
important to note that the bench power supply
has a floating output in other words the negative side of the power supply is not
connected to ground and that's very important
if this had been connected to ground i would have literally shorted everything
out when i connected my oscilloscope up over here and we certainly don't want
that to happen but otherwise this is the breadboard
with the splitter on it i think if you look
very carefully down here you'll see the two power transistors
and it is powering this circuit here and as you can see from the oscilloscope
it is indeed working we've got the square wave and the triangle wave
now i've got a multimeter over here and we'll measure a couple of voltage points
here is the positive voltage i've got right now the multimeter is tied to
ground and i've got 9.98 volts i'm not sure if
you can see that and i'm going to go over to my negative
side right now and i've got negative 9.96 volts so it's regulated pretty well
now as i said earlier when i showed you the design if you wanted to
you could also put a couple of three pin voltage regulators on the output
to regulate it even further but it actually splits the supply
pretty well so this is a great solution if you need a dual
power supply for your op amps and you don't have one
just use an op amp to take a single power supply
and make it into a dual one and so this concludes our look at operational
amplifiers i do hope that you enjoyed the video
and more importantly i hope it's opened up your eyes to the fact
that not everything has to be built around the microcontroller
you can build a lot of useful circuitry and projects
around analog components like operational amplifiers
now if you want to get some more information about op amps or if you
want to get the circuits that i used today you will find all of that on the
article that accompanies this video on the DroneBotWorkshop.com website
and there's a link right below the video to that article
when you're on the website if you haven't yet please consider signing up
for my newsletter it's not a sales letter it's something i send out now and
then to let you know about things that go on
in the workshop because sometimes things do go on in the workshop and the
newsletter of course is absolutely free another thing that's absolutely free is
the DroneBotWorkshop forum so if you're having a problem with
one of your op amp designs get on the forum there are a lot of
great people on the forum who can help you out with your electronics projects
and finally if you haven't yet please subscribe to the youtube channel
i make videos about electronics microcontrollers programming
and i think you would really enjoy them and all you need to do to subscribe
is to hit that little red subscribe button that you'll find below the video
and if you also hit the bell notification you will get notified
every time that i make a new video assuming of course you enable
notifications in your web browser and with that said please take care of
yourself please stay safe out there and i will see you soon here in the
DroneBotWorkshop goodbye for now
