hi welcome to fundamentals Friday today we're going to take a look at the operational amplifier or better known as the opamp really important building block absolutely essential that you understand how they work now there are two ways to learn about opamps one is this way the hard way we don't want to do it that way that sucks so let's get rid of this and let's do it the easy way so what is an opamp or an operational amplifier well the name operational amplifier comes from the fact that when they were first developed they were developed to do mathematical operations hence the name operational amplifier and back then we didn't have digital computers they did they used these for analog computers so analog mathematical operations addition subtraction integration differentiation stuff like that even that real hard calculus stuff opamps could actually do these operations in Hardware now of this digital software rubbish so that's where they came from so although we don't have analog computers today we still use them for those mathematical operations you can uh turn an opamp into an integrator for example you can turn it into a summer which is just an adder and things like that so they're really useful circuit building blocks but the main thing we're going to look at is the operational amplifier as an actual amplifier cuz that's what they most commonly use for and probably what you mostly use them for as well so an op amp is essentially just an amplifier yes it can be used for those mathematical operations but essentially what it comes down to is this is a differential amplifier and what that means is that it's got two inputs over here which we'll talk about and an output and it's got some gain in there because amp amplifiers have a gain and what it does is it takes the difference between these two input signals amplifies it by its internal gain or what's called open loop gain and gives you an output voltage but opamps really can't be used as differential amplifiers on their own even though that's what they are rather confusing but an important aspect you should understand so why can't this be used as just a differential amplifier input signal here output signal with some gain in there well the answer is they're not designed to be used as differential amplifiers as strange as that may seem because they are essentially differential amplifiers that was that was that hard circuit you saw over here before was actually the internal circuitry of an opamp showing it as a differential amplifier but hey let's forget about differential amplifiers I shouldn't even mention it but it is important to understand the operation of how an opamp actually works now the reason they don't work is differential amplifiers because the opamp the gain of the natural gain the internal natural gain of the op amp is enormous and that's the first thing you need to know about opamps is it's not quite infinite but you can think of it as infinitely large it's like millions of times and well the data sheet won't even tell you so if we just tried to use an opamp like this with no external circuitry and just fed you know like one molt on the input here the gain is so large that the output voltage is going to be so huge that it's just not a practical device at all so that's why you never see an op amp with without any external circuitry or what's called negative feedback so that brings us to our first practical application for the opamp which is a comparator but before we look at that we will look at the symbol here now an opamp is typically drawn as a triangle like this it's got two inputs over here and one input here sometimes it might be flipped depending on uh the ease of drawing your circuit and the way the signal flows but it's exactly the same thing now these two inputs here one is the the positive input is called the non-inverting input easy to remember because it's positive the inverting input is likewise easy to remember because it's negative negative inverts something so that's the terminology you should be using when referring to opam it's very important to get the terminology right otherwise you sound like a bit of a dill now there's an output pin here easy and there's two power supply pins a positive and a negative one which we'll talk about as well so I mentioned that the gain of an opamp naturally inside is designed to be enormous almost infinite so what happens if you just feed voltage on the input here well let's assume that we have one volt on our non-inverting input here and we have 1.01 volts or slightly above 10 m volts or even 1 molt above this one here well the amplifier will actually amplify the difference or attempt to amplify the difference between these two inputs so the output put here will be this huge gain like a million times that one molt so it'll try and output hundreds and hundreds or thousands of volts and Well it can't do it because well your circuit's only you know 5 10 15 volt something like that so your output is going to saturate so if you've got 1 volt here and let's say 1.1 volts here then your output is going to go boom right up to v+ it's just going to saturate right up at the positive voltage so we've got ourselves a comparator and likewise if you swe switch those voltages around so that the non-inverting input is bigger than the inverting input even by a tiny amount Bingo your output is then going to go from positive and it's going to slam right down to the negative rail down here so you can see that it's just used used as a comparator it's a going to be a very crude comparator and you can use an opamp as a comparator in a pinch but they aren't quite as good as a proper comparator that you can actually buy they're designed to be comparators but hey you can actually use op opamps as comparators but that's what happens if you connect an opamp with no feedback at all and what that's called is the open loop configuration because there is no Loop there's no loop the loop is open and we'll close the loop in a minute but with an open loop configuration like that an opam is just a comparator so now that we got that little nonse out of the way the the Oddball configuration of the comparator for the opam let's have a look at what where opamps come really useful and that's as proper amplifiers now to do that as I said we need to go from the open loop configuration with no feedback to add in what's called negative feedback and hence the T-shirt negative feedback and once you do that opamps become incredibly useful and Powerful devices now there are two rules with opamps that's all you have to remember it's fantastic this is how easy opamps are if you know these two rules if you remember these two rules you can analyze practically any opamp circuit you can't get into the real nitty-gritty details of the performance of it perhaps but you can look at a schematic and you can understand how it works and the two rules are very simple rule number one no current flows in or out of these inputs so there's nothing flowing in or out of these two input pins ever that's it nothing nothing flows in or out regardless of how you connect this circuit up whether it was the open loop comparator configuration we saw before or whether or not it's uh a Clos Loop configuration and inverting or non-inverting amplifi is we're going to look at nothing flows in or out rule number two now this rule only applies when you have a closed loop like this it doesn't apply at all to the open loop one we just saw with the comparator that's why I did the comparator first even though it might have been a little bit confusing to start that way most people start opam explanations with these two rules but I wanted to show you that comparative first because to highlight that rule number two does not apply or only applies to closed loop configurations with negative feedback now rule number two is the opamp does whatever it can internally right internal circuitry which we won't going into but it does whatever it can to keep these two input voltages the same now the opamp can't actually change its input voltage it has these are inputs it has no way to actually drive a voltage out and keep them the same but it can do it with feedback and that's why this rule only applies to Clos Loop configurations so the op amp only has control over its output but if you have feedback it will change this output voltage to make sure this input equals this input here and that's a very powerful rule of opamps and if you see a Clos Loop configuration like this you can be pretty sure that rule is going to apply so using these two rules let's look at the simplest conf opamp configuration possible and it's not this it actually has no external components so what it has is the output tied back to the inverting input like this and you feed your signal or your voltage into the non-inverting positive input like that and this is called an opamp buffer so using our two rules very easy to analyze this opamp buffer circuit let's say we let's just do DC because opamps the other thing is opamps are DC coupled amplifiers they can uh amplify DC as well as AC signals very important property so but let's do the DC case we're feeding one volt into our non-inverting input here what do we get on the output of our opamp well look rule number two always applies when you're uh when you've got feedback in a circuit in in an opamp circuit the opamp tries to keep these two input voltages identical so because of the rule this inverting input here is going to be equal to this pin up here the the op an will ensure that by driving this output to get this input to match this one so we' got one volt here then we've got one volt here and because it's just connected by a bit of wire we're going to get 1 Vol out here that's why it's called a buffer it's not an amplifier it because there is no gain 1 volt in 1 volt out minus one volt in minus one volt out whatever the voltage is within uh within the limits of the power supply voltages here what use is that well rule number one no current flows in or out of the inputs so nothing no current flows in so if you've got a load over here I don't know it could be some sort of sensor or whatever it could be a uh low pass filter for example like you're feeding a pulse withth modulated signal from your microcontroller or something like that and then you want to buffer that voltage off there because no current flows into the input this opamp does not disturb your sensor or your circuit that you're actually trying to do it's a what's called a very high impedance input essentially open circuit so it doesn't disturb anything you hook up to it but the op amp has a what's called a low impedance output so we can drive you know a reasonable amount of current you know milliamps tens of milliamps that sort of thing some can go as high as a couple hundred milliamps for your power op amps but it can drive a reasonable amount of current so that's why it's buffering the signal a high impedance signal and giving you a low impedance output just allows you to drive things with a sensitive input like that pretty easy very useful configuration the opamp buffer now the next configuration we're going to take a look at is What's called the non-inverting amplifier and this is where we tame our opamp Beast that huge unwieldy gain that changes everywhere with temperature and it's horrible anyway it's got this massive unusable gain in there as a differential amplifier but as a single-ended amplifier that's what single-ended means your feed input here and it's always referenced to ground we can use this as a single-ended amplifier and we can tame that gain by adding negative feedback on it and I won't explain negative and positive feedback in the mechanisms and how it works because well that's for a more advanced topic but anyway we feed in a feedback resistor here just like we did before it was shorted out but we put a resistor in there and we put a resistor back down to ground so what it's doing now is this input the inverting input is taking a small portion R this feedback resistor we'll call RF is always bigger than R1 here so fence so we just got a voltage divider here that feeds back a smaller part of the input and that's essentially what negative feedback is you taking a part of the output and you're feeding it back to the input and there's a very simple formula you need to remember for this non-inverting amplifier configuration and I won't try and derive it but the gain of this amplifier or what's called AV that's the actual terminology used AV is just gain you can use gain gain equals RF the feedback resistor divided by R1 which goes down to ground here plus one you've got to add that plus one on there so easy if we've got a 9k feedback resistor and a 1K resistor down to ground here our gain is 9k on 1K or 9 + 1 our gain is equal to 10 so if we feed 1 volt into the input here we'll get 10 volts on the output easy and because we've got positive and negative rails which will get into we can feed AC or DC signals into here about ground and so we can feed negative uh 1 VT into here and we'll get -10 volts out so there you go that is the basic configuration of a noninverting amplifier and you might see weird configurations there might be a capacitor across here or something like that which we won't get into in this one but you know the configuration is the same if you see your input being fed into the non-inverting input and the feedback going back to the inverting input you know that's a noninverting amplifier and this formula here applies and from this formula you can also see why our buffer amplifier had a gain of one before because our feedback resistor is zero was Zero ohms so zero on R1 here which was infinite so zero on over infinity or a very large value is 0 + 1 so our gain is one that that's why our buffer had a gain a one easy the math doesn't lie so now we get on to the second of our two major configurations we've already looked at the first one which was the non-inverting amplifier the buffer was just a variation of that now we have instead of the non-inverting amplifier we have the inverting amplifier how can you tell it's an inverting amplifier well just like before we could tell it was a non-inverting one by the signal going into the positive input here the non-inverting input hence the name non-inverting amplifier our signal now goes into our inverting uh amplifier pin so hence it's called an inverting amplifier and you'll notice that I've switched the two symbols around here the positive is now on the bottom our op amp hasn't changed I've just done that visually to uh you know to make it a bit easier here and that's what you'll commonly find in schematics and CAD packages and all sorts of stuff you might find them flipped around upside down back to front whoop-de-doo or going all around the place some pointing down for various feedback passs and all sorts of things it's exactly the same opamp it's just visually different you can draw it any way you want now our uh inverting amplifier that this one is we have the same as before we have our feedback resistor we have our negative feedback going to in this case our inverting amplifier pin instead of our non-inverting one so now uh we are feeding our in put into uh through the resistor here so it's a different configuration our signal is not going directly into the non-inverting pin and this brings up our next really important concept with opamps that you really need to understand and here's where rule number one really comes into play in trying to analyze this thing it's called virtual ground stick with me so once again how do we analyze this always go back to your two rules what's our second rule here the opamp tries to keep the input voltages the same in fact it will if you've got this non-inverting configuration and you haven't hit the rails yet so if the amplifiers working normally within normal bounds of your power supply rail these two inputs will always be the same so uh we're actually connected our non-inverting input down to ground here it's connected to ground we're forced it to ground it's never going to change so what is the inverting input here going to do well of course rule number two it's going to be identical it's going to be the same so this point is also going to be ground or Zer volts so this seems like almost like a pointless circuit cuz look at rule number one no current flows in or out so there's no current flowing in or out of that pin and it's ground we've got both pins grounded and no current flows in or out it's is that what's the point of having an opam it's very confusing concept but once you grasp it you go oh that's easy and it's quite brilliant so the opam remember does whatever it needs to on the output drives it to whatever voltage positive or negative in order to make sure that this inverting pin here is equal to the non-inverting pin down here makes them the same we force this pin so it can't change this pin all it can do is change the voltage via the nature of the feedb back resistor here to make this zero and trust me we'll do a practical uh measurement of this in a minute and this node here will actually be zero volts and this confuses the heck out of a lot of beginners they build up their upam circuit they start probing around and they've got their input signal here you know it's a 1 khz 1vt sine wave for example and so they measure this side of the resistor and the signals there they measure this side of the resistor and it's ground the Signal's vanished where's it gone on H strange but true so let's follow this through and use our rules and see if we can analyze this circuit once again the DC case to make it make it easy we've got one volt on the input here positive 1 volt with respect to ground of course now we've said before that trust me we'll measure it later but this pin is going to be ground it is going to be zero volts there always so all we've got is one Volt across our R1 here which is 1 K so we're going to have 1 milliamp flowing through there where does it flow well it doesn't flow down here to ground how can it because no current rule number one no current flows into or out of the input pins so it can't flow through the ground here it has to flow it's going through here it's going somewhere there's one Volt across that 1K resistor ohms law always it must be B so that current is Flowing trust me it can't flow into the input pin when we know it's high impedance so it must be flowing up here like this through this 10K resistor and it's being sourced from the output remember this opamp has internal circuitry it's got an output buffer so it can actually drive currents into and out of the various supplies back into there and that is where it's sinking in the current to and that's the sneaky part about this our current has now been forced up this node here and is flowing through in this case our our feedback resistor RF which is 10K I've made it 10 times larger you'll see why in a minute then it's it must be flowing through there so we must have a voltage drop across that resistor once again ohms law always must be obeyed so if we got that 1 milliamp flowing through our 10K there we're going to have 10 volt drop across this resistor with positive here and negative here aha negative this these voltages are with respect to the ground here now here's where it gets a little bit tricky this positive voltage here is we are going to get the plus 10 Vols across that resistor there but because this pin is positive but we're forced we know this pin is zero okay we know it's zero because we' forced it by way of the amp action and rule number two here in what's called a virtual ground which I talk about in a minute then we have that means if this is ground this is positive then we've got minus 10 Vols coming out of here Bingo there's our inverting amplifier 1 volt in minus 10 volts out so our gain our formula AV gain equals r f on R1 there is no+ one with the inverting amplifier the plus one only applies to the other non-inverting configuration so by way of opamp action we'll call it and negative feedback here this point this node here at the non at the inverting pin is what's called a virtual ground because typically in this configuration it is actually grounded because we've grounded this pin doesn't have to be we can feed other voltages into this pin and offset and do all sorts of other stuff but it's still called even if you do feed another pin in here it's still called virtual ground because it's virtual it's not real it's not hard tied if it was hard tied to ground if we actually tied that PIN to ground this thing wouldn't work because all of our current would flow through here like through this resistor down to ground and around like that and then this output here well it wouldn't know what to do the output would be zero because there'd be zero volts difference in here remember it's still a differential amplifier as such so we got zero volts difference here we're going to get zero out we'd have no current flowing through here and we'd have zero volts out so you can see that it doesn't work unless if you T tied that hard ground but when it becomes a virtual ground by nature of the opamp action it all magically works I hope that makes sense cuz once you get it it's really easy so functionality wise it's pretty much exactly like the non-inverting amplifier except it inverts and that's it and the gain formula is slightly different but apart from that pretty much works exactly the same but that magic virtual ground is at play in this configuration and of course as with opamps they're DC coupled so it works with DC signals you can just feed in a fixed DC voltage as I said 1 VT DC in would give minus 10 volts out in this case with these value resistors or we can feed in a 1V uh Peak to- Peak or or RMS uh sine wave for example about ground so it's centered on ground like this this is the blue waveform here let's just say that's 1 volt it's not quite the scale but you'll get the idea and then our output will be the inverse of that so when the input Rises the output goes negative because it's an inverting amplifier now of course one of the disadvantages of the inverting amplifier compared to the non-inverting we saw before is that as you can see there is input current coming from your load here so you don't want to use this where you have a high impedance load because then it can change the gain equation and Max everything up that's where you want a non-inverting amplifier or at least a buffer some people will actually follow will uh put a buffer on the input here and then drive the inverting amplifier but usually in that sort of case you'd probably use a non-inverting amplifier now we have to go deeper into this and talk about the power supplies and split rails and all this sort of stuff and uh single Supply op amps I'll try and keep it as brief as possible but you saw in this configuration the opamp only has two power pins okay it's usually called v+ and V minus now V minus you can actually connect that to ground there is nothing regardless of what the data sheets tell you there's nothing inherent in opamps that make them really a single Supply opamp so you can take an opamp that has v+ and V minus and connect this down to ground like that there's nothing to stop you as long as you meet the minimum voltage specification and don't exceed the maximum Etc so what happens if we did that in this case our input is or our non-inverting input is also grounded here well now it becomes a problem you get into the Practical limitations of op ANS we've been talking about what's called an ideal opamp up until this point these rules here aren't strictly true I lied but there's still a fantastic way even professionals used to analyze these circuits as a first order as a first pass no current flows in or out well if you've been watching my videos you'll know I've done a previous video on this talking about input bias current so little itty bitty teeny weeny currents can flow into and out of these pins depending on on what type of op app you're actually got and that's a real practical uh limitation of these things and the other one is that I've talked about in previous video which I'll link in down below if you haven't seen it the inputs cannot necessarily go right to the rails be it uh whether it's positive negative reference to ground or whatever so you can get uh what's called railto rail opamps or railto rail input opamps in this case if you had a railto rail input opamp then yeah you might be able to get away with this and have the uh invert and have the uh non-inverting input tied down the ground like this but hang on what's the point of that if you've only got ground this is an inverting amplifier it inverts your signal so if you feed one volt in you're going to try the opam is going to try and give you one or minus 10 volts out but how does it do that when you Supply is negative like that it doesn't work so you have to um it's got no room to do it so your opamp has to always be powered in the configuration that you expect your input signals to be referenced to so if we were to use the inverting opamp configuration like this with a single Supply rail like this and we wanted to amplify AC signals well the signals can't go negative like this they can get negative on the input but you're never going to get that negative voltage on the output but you still want to amplify your signal cleanly like this well what we need to do is this zero point needs to go right down the bottom here like this so we need to offset so if that's Zer volts we need to offset our input wave our input and output reference by a certain amount of voltage how much well typically half your supply rail to Max maximiz your head room how do we do that I hinted at it before you feed in if this is v+ you would go v+ on two you would feed that voltage half rail in there You' usually do that simply by putting a resistor like that going to v+ and a resistor down there going down to ground and bingo voltage divider there's your half rail so we're offsetting our voltage here our virtual ground remember this is still called a virtual ground even though it's not going to be so the voltage here is going to be equal to the voltage here due to our second opamp rule so if our power supply is 20 Volts for example this point here would be half that if we make these you know exactly the same value of course make them the same value half rail so we're going to have an offset voltage here at this point and that shifts our waveform up and we'll see that in the Practical experiments to follow now as I said some time back you might see some other components around here like some capacitors and things like that around the circuit that is to change the bandwidth of the circuit effectively um because we're not going to go into it I'll have to do a second part of this video that goes into opamp bandwidth and things like that I have done one on C cascading opamp bandwidths which I'll link in down below but suffice it to say that an ideal opamp that we've been looking at has an infinite bandwidth it's infinite frequencies and signals but in practice no of course not your practical op amp might have a one MHz bandwidth or 100 khz bandwidth or something like that you know it could be a nice fast 100 mahz but it's always going to have a bandwidth which changes with your gain or gain bandwidth product and I've done a separate video I'll link it in but sometimes you might see a little bypass capping there it might be you know 10 puff or 100 puff or something like that and that's just rolling off the frequency response to that and likewise you might see a little cap across something like this for example if you have um if you are offsetting this thing using a single Supply like this you know I I won't go into the details but basically any noise on this point here will be Amplified and picked up on that virtual ground so you'll get noise on your output signal so you might stick a big ass you know one or 10 microfarad cap across here for example and really make that virtual ground really Noise free but hey that's that's beyond the basics one little mistake I noticed oops my formula here for the inverting amplifier it needs a negative in front of it because the gain is actually negative so it's so the gain is not in this case is not 10K is not 10 it's minus 10 oops so just back to this voltage rail thing uh briefly because it is something that is rather confusing because there is no round pin on an opamp there's only the positive and negative so well where does your reference go well the reference is part of the external circuit in this case back to our noninverting amplifier configuration here's our ground reference here and then our positive and negative Supply is here like this so plus 15 Vols and minus 15 Vols if we want to feed in a signal that goes both positive and negative if we're only feeding in a signal that is positive above ground then this here could be tied down to here like this and then uh it has to be above that the output cannot magically go negative it can only go negative to your ground reference if you have that minus 15v rail in there clear as mud and just like the inverting configuration if we wanted to power this from a split Supply we could have this grounded like this and then we can add a bias voltage in here like this to actually offset the voltage and then you can get into all sorts of uh weird and wonderful things with AC coupling these amplifiers all of the op configurations we looked at have been DC coupled but you can actually AC couple them so that's why you start might SE capacitors on the inputs and outputs to the opamps now here's a tricky configuration which I'll briefly touch on that combines the two different configurations we've seen before and a couple of the things with looked at it's the differential amplifier you know how I said opamps are essentially a differential amplifier that's how they work but you have to but they do that in the open loop configuration so they're hopeless they're useless for that but if you combine the N the inverting amplifier configuration that we just saw so we got the feedback going here our signal going in that's a standard uh inverting configuration and we have exactly those two resistors that we saw before to bias that voltage up but instead of going to the supply rail we make that our other differential input and bingo it becomes a differential amplifier I'll let you go through the actual calculation yourself to find out but basically the difference that we're feeding in if we're feeding in 1 volt into here and 1.1 Vols into here we have a difference of 0.1 volts and the gain of this amplifier exactly like the inverting configuration R2 on R1 we used RF before I'll call it R2 here so R2 on R1 10K on 1K we have it G and you got to add negative in there so it's a gain of minus 10 but because our bias voltage is not fixed it's actually the differential input signal aha look what happens we got one volt here we've got our divider here R1 these two values are the same R1 is equal to R1 here R2 is equal to R2 here they must match precisely to get good common mode rejection ratio which we won't go into but suffice it to say if we got one volt on this point here relative to ground we'll have 0.9999 repeater at that point there and that becomes our virtual ground Bingo we have that same voltage there then we'll have our 1.1 volts here that has X and then you subtract uh that from that that you get x amount of current flowing through here which then must flow through the 10K which has 1.0 99 volt across it subtract the difference there it's exactly the same configuration as before with the biased voltage but then we'll left with an output voltage of minus one so we've Amplified the difference in our input signal by the gain here 10 it's not a terrific differential amplifier but it works so we've tamed our opamp that is a differential amplifier anyway but pretty unusable we've actually made it into a pretty usable differential amplifier Beauty just combines both those techniques and there's lots of tricky stuff like this you can do with opamps and just briefly another one of these tricky configurations goes back to their name the operational amplifier and one of those mathematical operations the integrator I won't go into integrals and all that sort of stuff but what we can do a basic inverting configuration here except instead of a feedback resistor we have a feedback capacitor what does that do well our standard input voltage here following the rule no current flows in but we have a virtual ground of course rule number two so if that's 1K and that's one volt there where we have 1 milliamp flowing through that resistor where does it flow can't flow into the opamp it's got to flow up here and through the capacitor so you've got effectively a constant current of 1 milliamp you've just made this is now a constant current flowing through this this resistor and when you have a constant current flowing through a capacitor you end up with a well in this case it's going to ramp negative down like that if our input go if our input is a step and it goes up like that the constant current because it takes time to charge a capacitor the voltage on the capacitor will increase like that I say increase because it's an inverting amplifier so it's going to go negative but that's what it does and that's an integrator and that is actually a mathematical integral of your input signal anyway that's way too much Theory more than I wanted to do and longer than I wanted to take actually but suffice it to remember that these two rules of opamps allow you to analyze practically any configuration and as a bit of homework I go recommend you look at the sum opamp configuration the sum amplifier and figure out how it works because you're going to be using those two rules to figure it out so I'll leave that one up to you but enough of that let's head on over to the bench here and see if we can measure some stuff make sure I wasn't bullshitting you about this virtual ground stuff let's check it out sounds a bit sus see if it really works all right we're at the breadboard let's take a look at an inverting amplifier here because I wanted to show you that virtual ground point there just to show you that there really is no signal there it actually vanishes in quote marks when you go from the input here to here and then it magically reappears at the output cuz that's how an opamp works as I've explained anyway got a jelly bean lm358 here it's actually a dual op amp so we've just uh tied off the uh terminated the top opamp here could probably do a separate video on that on how to properly terminate uh opamps that might make an interesting video um thumbs up if you want to see that one anyway here we go I've got it configured I've got a a 10K input resistor here 100K feedback so we've got a gain of 10 the formula of course is the feedback resistor on that one Bingo easy times 10 so I'm going to feed uh 2 volts Peak to Peak input here we should get uh 20 volts Peak to Peak on the output so we're using pretty much near the maximum Supply rail of the lm358 in this case I'm powering it from plusus 15 volts so we have a split Supply so our ground reference our input signal is reference to ground I should actually draw that on there there we go that's clearer so our input is referenced to ground and our non-inverting input here is referenced to ground and our output is referenced to ground also but for signals to go negative for output signals to go negative we need a negative rail on here so we're using minus 15 Vol so plus 15 to power at minus5 as well so 30 volt total Supply on there allows us to go positive and negative signals input and output so let's go over to our power supply here it is plus - 15 Vols I got dual tracking on there and you notice that I've joined the um supplies here generating a split Supply so this one actually becomes the negative so this is our positive 15 from here to here and this is our -5 relative to here because we've strapped the positive one over and Tada there we go we're feeding in our uh one we've just got a one khz low frequency signal 2 volts Peak to Peak uh here on the input and you can see our input and output waveforms and these inputs are of course all uh AC coupled and their bandwidth limited as well to 20 MHz to reduce the noise and we're using our high resolution mode as well so we get some Box Car average in in there and that's why we got a nice crisp waveform like that beautiful so what happens if we turn our bandwidths back to full in this case it's my 1 GHz tectronics 3000 Series and we turn off high-res mode go back to sample mode there we go we get our nice fuzzy waveforms because we got that massively high bandwidth that's the advantage you can go into averaging of course but high res mode does Box Car averaging just cleans it up of course you can do envelope mode look at that pretty horrible waveform so when looking at this sort of stuff you definitely uh don't want to use your regular mode you want high res mode if you've got it there you go we're getting exactly what we expect look at that uh 2 volts Peak to Peak in roughly 20 volts out there's probably going to be some error due to the uh resistors in here anyway we're getting our time 10 and of course the blue the blue waveform there is the input that's 500 MTS per division so we're getting our 2 volts Peak to Peak and our output is 5 vs per division so which is the yellow waveform there and look at that and of course because it's an inverting amplifier the output is exactly 180° out of phase it's inverted so the moment I'm probing the input and the output now you want to see the virtual ground didn't you what happens if I move my input probe the Blue Wave form here from the input over to this you'd expect to see the signal but as I've told you and as you should trust me let's move the probe over that is our virtual ground Point look Flat's attack the signal has vanished magic but of course you no it's not magic it's just standard op amp Behavior with virtual ground on the input that's how an opamp works and no the current hasn't magically vanished the current is going through the resistor ohms law still holds current is changing because we've got an AC uh resistor here there's AC current flowing through this resistor and it's all flowing up here but this point by nature of the opamp action and the negative feedback that is a virtual ground our opamp rule number two there inputs are the same the op amp changes the output here in order to Ure that that point is equal to that input there easy and that's why we don't see any signal on there so trap for young players when you're uh probing around circuits like this don't think the signals vanished virtual ground remember your op out rules always now I actually chose the LM 358 for a reason because it is not like a regular op amp and not quite like a railto rail opamp it's sort of halfway in between check it out here we go it it eliminates the need for dual supplies okay you can use it as a single Supply opamp but as I said you can use any opamp as a single Supply opamp but this one is extra special and that allows direct sensing near ground so and V out also goes to ground so effectively it's it's it's not rail to rail it won't go up to the all the way to the positive rail on the input and output but it will go down to ground all the negative because an op amp doesn't have a ground pin it's the negative rail so even if we power it from split supplies plus -15 like we are now it'll still go down to that -5 Vol pin or that pin 4 it'll go down the input will this input here will allow to sense all the way down to the negative Rail and also so the output will go all the way down to the negative Rail and I'll demonstrate but what we've got to look at here is a couple of things on the data sheet our input common mode range and our voltage range here as we said it goes all the way down to that negative pin or zero volts as they're calling it here but on the positive side this opamp will not go um sense or go to the output less than 1.5 Vols uh below or above 1.5 vol below the positive rail v+ there so if we've got an output signal of 10 Vols for example the voltage range says if we want to get an output voltage of 10 Vols Peak well we need a v+ rail of at least 1 and2 volts above that so 11.5 volts so what we're going to do is lower the voltages here on these rails we're going to lower v+ from 15 Vols down to 11.5 and around about that 11.5 volts because we're getting 10 volts Peak on the output 20 volts Peak to Peak 10 volts Peak we should start seeing Distortion or clipping of our waveform at around about 11 1/2 volts let's see if we do okay so here we go we have 15 volts I'm going to drop it down by 0.1 volts at a time you notice that it's split Supply it's dual tracking so our waveform is still looking good still looking good but we expect it to start clipping around about 11 1/2 it may not be precise this is not an exact value on the data sheet but there we go 112 it's still there still there there we go it's starting to clip it's starting to clip you can see it it's actually about 11.2 volts there but you can start to see that waveform flatten out now I wind it down even more because this is a not a symmetrical Supply upam it actually goes down to zero we don't start seeing clipping on the bottom here the bottom rail until a significant time after that now we're getting both but I wind it back up there and that's about 11.1 volt but we're seeing that clipping on the top and we won't see it on the bottom for time after so there you go just be aware of that and if we had a a even a worse op amp uh in this respect like a lm741 or something like that that can't even go down to the negative rail we would start to see these clip right roughly at the same time and you remember that open loop gain I was telling you about how large is it well it tells you a couple of ways in the data sheet not all data sheets will have it but this one does large DC voltage gain so it doesn't say it's open loop gain but that is effectively the DC voltage gain is the gain of the the inherent differential amplifier in there and they put it in DBS so you use your 20 log uh formula you uh reverse and you get about 100,000 and likewise here on the data sheet they' got another way to tell you it's called now it's called something different it's got the large signal voltage gain there uh it's specified for a certain rail but there we go typically 100 and they specify it in volts per molt so if you uh divide 100 volts by 1 molt what do you get same figure 100,000 there's your open loop game so there's just a quick uh practical demonstration showing the virtual ground effect there and also the voltage rail limitations positive and negative I should do another uh part of this video on opamp limitations practical limitations things like that that would be interesting thumbs up if you want to see that one but I got I'll leave you with one last thing and I won't explain it I'll leave it to you to try and figure out I chose these values higher than what I had on the Whiteboard there I chose them for a reason let's lower them down to 10K and 1K K here and see what happens with this specific opamp lm358 H let's drop these down still quite High values 1K and 10K they're not you know like 10 ohms or something like that but let's give it a go and there it is 1K input resistor 10K feedback resistor exactly the same gain exactly the same input signal but what's that little funny business going on in there and over there H and if we measure our virtual ground Point wow look at these little spikes there and there corresponding to that little bump in that waveform interesting so as Professor Julius S Miller said why is it so I'll leave that to you to figure out catch you next time