We've explained amplifiers, we've explained op amps. We've brought it all together as to why we wanted to build this amplifier from the get go, and now we need to show you how to calculate your resistor values. So that just in case you don't want to build the exact amplifier that we built, you could actually go in there, calculate other resistances, change the factor of amplification up or down, and do it on your own. So we're gonna go ahead and show you how to do that. >> Yeah, so we quickly wanted to give you a little bit of theory behind an op amp and how it works. Normally when you're doing calculations for an op amp you take an ideal consideration towards it. And so there's, there's a few things that are involved with that, but, it's basically you're just gonna assume that no current actually flows into the inputs, but it does flow out. And you're gonna make, the ideal assumption is that the voltage difference is zero between the input and output, even though that's not true, and you're gonna assume that there's, it has to do with the gain, but, it's kinda complicated. We're just gonna make some of these assumptions while doing the calculations so that it'll make it a lot easier. And the values that we're gonna calculate are gonna be very close to the actual values so that it works very well. But we're basically, you can see here on the right that's the setup of our circuit. And so we have the plus is the non-inverting input, the negative is the inverting input, and the point on the triangle is the output. And so the chip also has to be grounded and powered but we have these resisters set up in this fashion so that we can get the gain, which is gonna be AV over there is gonna be equal to one plus R1 over R2. And so we're gonna calculate that in a second, but what that means is you can take the value of R1 divided by R2 added to one, and that's gonna be the gain of the system. And so, in our case, I think we chose R1 to be 10,000 Ohms and R2 to be 5,000, so that you get a gain of three. >> Yeah and just to note, a side note, you can see up there that, what he was just talking about, that little triangle being the op amp, the chips that we have, they're quad op amps, right? So, quad op amps. >> Yeah, so there's four of them in each chip. >> There's four of those diagrams in each chip. Which is why you're basically going to mirror, you're gonna build it once and then you're just gonna mirror it four times or eight times or 12 times based on how many GPIOs you wanna amplify. >> Yeah, and then one last thing to note is that you do have to power the chip, and depending on what power you give for the VCC rail is gonna determine how much you can amplify it. So we typically have been powering it with five volts, which means you can't get higher than five volts. And in fact, you can't get higher than about 4.3 would be the maximum you can get. If you want to go higher than that, then you do need to use a 12 volt or something from the DC in jack. >> Yeah, fully capable with this port. Actually, there's plenty of options to change your amplifications, not only just the resistance but, like he said, just changing the power to the chip. >> Yeah, and we didn't need it to go any higher than that so we just used the five volt and that gets it right to where we want it to be. All right. So we wanted to take you through some of the calculations here. And so this is, again, our amplifier diagram and how we had it set up. We can change it around and you can see how this is ideally how it's gonna work. And so we have, this is the setup, it's almost like a voltage division setup because, again, we're gonna be using those ideal assumptions that no current is actually flowing through the v negative terminal there. All right? And, so now, again, our other assumption is that the difference between the non-inverted and inverted input is zzero, so that they're actually the same voltage level, and then we also assume that the current going into the amplifier is zero. Now, we've used Ohm's law and kind of rearranged it and then we've added them together and used the voltage division, and you can see how we're working out the steps to get to the v out. And then we want the transfer function basically, which is gonna show how much it's being amplified by. So we get v out divided by v in, and that's where we get our AV right there, and so that's basically how much we're multiplying the input by to get to v out. And so it works for us, and it's gonna basically multiply, in this case, it's gonna multiply the input voltage by three, and get us an output actually gonna be capped off around 4.2 or so. >> Yeah, so again, this is just showing you how we worked it out. But you could literally go to that last step where it says AV equals R1 over R2 plus one, and plug in 15,000 over 5,000, and then that's just three plus one, so then you'll be having a gain of four which means you'll be amplifying your signal by four times. >> As long as you increase the power rail so they can go higher. >> So if your power rail is capable of amplifying 1.8 volts four times then you can do that, and that's all you really need is that last formula there. Yeah. >> Yep. >> All right?