Sunday, 21 October 2012

Op-Amps and Inverting and Non-Inverting Amplifiers

For the signal generator project we need to add an amplification stage.  Why?  - Well because most signal generators have a slightly larger output available than 1.4V pk-pk which is what the Sparkfun AD9835 breakout board provides.  The output from most signal generators is also variable so lets add that functionality if possible too.

The way to get a larger and variable signal at the output is to make an electronic signal amplifier.  We could use transistors but I think in this case it would be more prudent and easier to use a  integrated circuit which is a collection of transistors already designed for the job.  These analogue integrated circuits are some of the best pieces of electronics around (IMHO) and they are known as operational amplifiers!

These circuits are extremely versatile and can be used to make lots of different things possible.  They are used in Music amplifiers, scientific instrumentation, radio frequency transmitters and receivers, Analogue to digital converters, Digital to analogue converters and active filters.  I could probably list more places they could be used given time and the inclination.  Take my word for it....these things are useful and entire books have been written on the subject.

I think for any decent post on a component there should be a section on the history of the device and I always try to at least link to where information can be found.

Op-Amps were made out of vacuum tubes or valves before the bipolar transistor was invented.  The initial design is credited to Karl D. Swartzel Jr. of Bell Labs in 1941.  Several different types of amplifier were made out of separate valves to get the amplification required.  In 1961 Bob Widlar working for Fairchild Semiconductors (He's also famous for the transistor current mirror) made the first integrated Op-Amp the uA702 and then later in 1967 the ubiquitous and world famous uA741 Op-Amp was released by again by Fairchild.  The uA741 is probably after the 555 timer the most famous integrated circuit in the world!  In my career I have seen and used them in various guises at one time or another.  

Enough and what do we use these things for?  They can be used for lots of things but we are going to go through two distinct uses - Inverting and non Inverting Amplifiers.  What do they do? - OP amps are very sensitive transistor amplifier circuits that amplify the difference between the two signals at their inputs.  The output is often a thousand times bigger than the signal at the input.

I'm not going to go through the internal circuitry of an's really complicated and not really that important - treat them as a magic black box where if you apply signals to the inputs they will appear at the output significantly bigger as long as you follow the rules given in the datasheet for the device.  Here is the symbol for an Op-Amp.

Schematic symbol for an Operational Amplifier

The signals are applied to the V+ and V- terminals.  The supply voltage is applied to the +V and -V terminals and the output is seen at Vout.  The triangle is used to signify amplification.  Wherever you see a triangle like this in electronics or in flow diagrams it's to show amplification.

Op-amps is a very large and diverse topic and going through everything in one blog post isn't possible....I wish it were so simple!  So really how do we use these things?  Ok there are formulae and datasheets and a few things we need to know before we can design a circuit.  Lets set the design parameters and then get started:

What kind of signal are we needing to amplify? Fast, slow, large, small, alternating etc  By fast or slow what I'm really asking is how fast does the amplifier need to react to a change.  This is known as Slew Rate.  Large or small means Input Voltage range and alternating really means frequency range of operation or Bandwidth - as in how often will the signal applied to the inputs repeat.  It is also important to know how much supply voltage we need and whether the device is single rail or dual rail operation.  An example of single rail is a device that can work with 0V on the -V terminal and +5V on the +V terminal.  Dual Rail would mean -5V on the -V terminal and +5V on the +V terminal.

So lets recap on the most important parameters that we need to look at for selecting a device:

Size of signal to amplify - Input Voltage Range
Frequency of signal - Bandwidth
Size of Supply - Voltage Supply
Amount of Gain required -

For an example I'm going to use the UA741 Op-Amp - it's the most popular and most people will be familiar with it.  Here is the datasheet:

Let set some parameters for an example.  Lets say we want to amplify a 1kHz 0.5V AC signal - like say the output from a microphone or something.  Lets say we want to use a +/-5V supply and that we want the output signal to be bigger lets say 5 times bigger!

The first thing I would do is check the datasheet to make sure that this Op-Amp can do all of those things - don't worry it can!

Here is the circuit:

741 Non inverting Amplifier with no gain
 What this circuit will do is take the 0.5V pk-pk signal applied to the V+ or non inverting terminal and try to amplify it as much as possible!  It can only get as big as the supply voltage applied though to the output will be 5V pk-pk.  The output signal will also be clipped because we are not controlling the amount of gain we require.  Check out the oscilloscope screen!

741 Non Inverting amplifier with no Gain Oscilloscope Output - Blue = Input, Red = Output
What this shows is that the signal is being amplified and it's in phase but we are losing part of the signal integrity because we are cutting off the top and bottom of the wave.  If the input signal shape was important we couldn't use this circuit as we have lost information (how big was the signal etc).

It's better to control the amplifier so that we can tell how much our input signal is going to be amplified so we don't lose part of the signal and we can be sure that all the signal information at the input is present at the output.  We do this by setting the gain of the amplifier and there are two very important formulas that any aspiring electronics engineer needs to know:

Av (Gain) = Vout / Vin or Av (Gain) = - Rf / R1 for an inverting amplifier

Av (Gain) = 1 + Rf / R1 for a non inverting amplifier

A non inverting amplifier is a circuit where the signal is applied to the V+ terminal (pin 2 on a uA741) and an inverting amplifier is where the signal is applied to the V- terminal (pin 3 on a uA741)

The gain of an amplifier is set by choosing to place resistors around the op-amp circuit so that part of the signal at the output is fed back to the input reducing the output signal and getting a more stable lower voltage response.  Lets check out an inverting amplifier with a gain of ten:

uA741 Inverting Op-Amp with a Gain of Ten
Before we show the oscilloscope output lets do a quick bit of mathematics - Lets plug the values into the formula and prove we will get the gain of ten.  The circuit is a standard circuit for an inverting amplifier.

Av = - Rf / R1

Rf = 10k Ohms or 10,000 Ohms
R1 = 1k Ohms or 1000 Ohms

Therefore Av = - (10,000 / 1000)
Av = - 10

The hyphen '-' shows that the amplifier is inverting

So the maths show that this amplifier will try to amplify the signal at the inverting terminal to ten times it's current size (voltage).  Check out the oscilloscope screen:

Inverting Amplifier with ten times gain - Red = Output and Blue = Input
The oscilloscope screen shows that we are getting a bigger signal at the output and the more observant viewer may notice that the signal is 180 degrees out of phase with the input or it's been inverted.  The signal is still being clipped so we are over amplifying our input signal. We can fix this by either reducing (attenuating) the input signal so it's smaller or increasing the supply voltage so that the Op amp is not 'running close to the rails'.  Lets do both and see what happens:

Inverting Op-Amp with ten times gain and no clipping

I have now changed the input signal to 0.1V and the supply voltage is now +/-12V so the signal will not clip but the gain of the op-amp will still be ten.  Here is the oscilloscope output:

Inverting Op-Amp with ten times gain and no clipping
So now we have a perfect output signal with no clipping and the signal is faithfully reproduced but inverted.  If we wanted a signal that was not inverted we need to use a slightly different circuit helpfully called the non-inverting amplifier.  Here is the circuit:
Non Inverting Amplifier with a gain of 11

Lets do the maths again and see what that the gain is set to 11 this time!

AV = 1 + Rf / R1

AV = 1+ (10000/1000)

AV = 11

Just for completeness lets check out the oscilloscope output just to show that this true and what the signal will look like:

Oscilloscope output of the Non-Inverting Amplifier
Well that's about it for inverting and non inverting Op-Amps.  The reason you might choose to use an inverting amplifier over a non inverting amplifier is because the bandwidth response of an inverting amplifier is better over a longer range.  That means that you could use the amplifier with a better range frequencies of input signals.

We are going to use an Op-Amp in the AD9835 Signal generator project and the next post will go through the design of that section of the project.  I will add some video showing the actual circuits working.

Take care people! - Apologies for the really long post!

No comments :

Post a comment