Design & Order on EasyEDA, PCB+SMT $10 Off: https://easyeda.com/editor
Get coupon & Join JLC&EDA Group: https://jlcpcb.com/EDA
Nobody told me the formula for a non-inverting op-amp is 1+Rf/Rg (not just Rf/Rg).
I should have known.
Subscribed to my 2nd channel? Watch all my 3 minute videos on Julian's Shorts: https://www.youtube.com/channel/UCeewzdnwcY5Q6gcbnZKIY8g
Interested in my new garden workshop? Follow the entire build on Julian's Shednanigans:
https://www.youtube.com/channel/UCXfDjPehpC7B7lW2JFxeS4w
Join me on Odysee/LBRY: https://lbry.tv/$/invite/ @julian256:d
Octopus Energy referral link: share.octopus.energy/aqua-birch-918
(We each get ยฃ50)
#EasyEVSE
#ElectronicsCreators

Good afternoon, all today, i want to add this to this, so this circuit diagram here is just a couple of op amps. Now the top one is a non-inverting. Isn't it because we're going into the positive and the bottom one is an inverting op-amp uh, because we're going into the negative and our feedback resistors are from output to negative. Well, they are in both cases.

Aren't they of course. So what does this do? Well, it takes the voltages at this point and this point and on this top one, it scales it by a factor of 12 down to five, so 12 volts at this point here will look like five well will be five volts on the output, because i've got A 24k input resistor and a 10k feedback resistor this one down here, scales it similarly 24 to 10 or 12 to 5. i'll, probably go for these higher value resistors, but in addition, this one inverts and that's because the voltage on this capacitor is negative. At this point here with respect to ground - and i want the output to be positive - with respect to ground and scaled naught to five volts rather than naught to minus 12 volts, so that a microcontroller can read these two voltages.

These two voltages will end up both being positive with respect to ground. So what's on these two inputs? Well, actually these are connected together. I might as well draw that in so they are the same signal and it's this cp signal that goes off to an electric car, while it's being charged with an electric vehicle supply equipment evse. Now this signal here goes between plus 12 volts at the top and minus 12 volts at the bottom and is typically a well.

It is a one kilohertz square wave with typically a small high period and a long low period here is zero volts. This is plus 12 volts, and this is minus 12 volts, but these voltages can change, because this signal is being driven by this device here through a 1k resistor. So, by putting in another external resistor on here, we can force these two signals to pull in towards this zero volt. I should mark that zero volt potential, so what's this, for this, is so that um a microcontroller, i'm, of course talking about arduino, can measure this top voltage and can measure this bottom voltage, which is negative by simply putting these two voltages through these two op amps.

This one just scaled 12 down to 5 and this one both scaled and inverted now. Fortunately, this can be implemented with a dual op amp, so it's only an 8 pin device. Now, the only bit of prototyping area i've got left which could take a dual op-amp. Is up here so i'm going to place an 8-pin socket there um these diode capacitor and one meg resistor circuits are already on here, actually they're here, so you've got one diode pointing in towards its capacitor and one meg resistor.

That's this circuit up here and you've got this other diode. This is the cp line down here, um pointing backwards towards its capacitor and resistor, which is this circuit here. So the diode, capacitor and resistor elements are both in there. So all i'm building actually are these op amp elements.
That's a shame. They have to be up here because my capacitors are down here, but it's not a major problem. I'll just run flying leads across to here and all i'm interested in is measuring these two outputs. Um making sure they don't go over 5 volts, they shouldn't do because the maximum voltage here on cp is plus 12 or minus 12.

We then have diode drops we're going to lose 0.6 volts here, so the maximum voltage on this capacitor is going to be 11.4. This one minus 11.4 and when you scale 12 volts to 5 volts you'll, get something a little bit less than 5 volts. So everything should be within the scaling for the op amps and also the scaling for the microcontroller which is going to measure these two signals. Both of which are between 0 and 5 volts, so they can be measured on two of the analog inputs of an arduino, but i found this strip of turn pin socket.

So, let's cut that into two four pin arrays, if indeed it will tolerate that without flying across the room and making an awful mess. Oh yeah, that's! Okay! That's a four pin array: that's a five pin, but i'm going to cut it down and the chip i found is a jfet input. Op amp, it's a tlo72 that'll! Do these quite high impedance inputs, because i've got a one, meg discharge resistor on these hundred n capacitors uh? That's why i went for the higher value resistors in the end. Also, there's no such thing as a 5k resistor, but there is such a thing as a 24k.

I think i'm not sure if i've got any but quite sunny today, which i'm sure you can see which is making photography. Why isn't this melting? Because i'm not hitting the solder onto the end of the iron yeah, making the photography slightly tricky, but let's just get this chip soldered in and then i might have a think about improving the light contrast ratio to improve the video photography quality can't see very well. What i'm doing anyway now pin eight needs plus 12 volts, so that's nice and easy there's one just there. I can route that up to there uh pin four needs minus 12 volts, which i think is on the bottom end of this potential divider.

Here with these five resistors, so this wire here can produce -12 route it round to there i'll do those next now this circuit needs a resistor to ground and ground is available. It's this line running across here. So i think i'll make this um non-inverting op-amp down the bottom here and the inverting op-amp up the top here, because there's no ground nearby up here, but then this circuit doesn't need a reference to ground other than that one meg, which is already in circuit down Here, that's my justification for putting uh one circuit on the bottom of this op-amp and one on the top. Let's get on with it.

So i need some pin numbers on here. Positive input is three negative input is two and output is one and on the other, op amp uh positive is five negative is six and output is seven? Okay, i'll use those numbers to wire the op amps up. When i look what i found in a box marked resistors, which were obviously some i bought on ebay some time ago, i found these 10k and 24k. That's what i need for my circuit, i'm putting the resistors in here, so that the accessible leg goes to the output, pin, pin one here on this side and pin seven there.
That means, if i need to scope probe these later on uh, the outputs are far more interesting to me than some sort of point at the front. So that's why i've put the resistors in that way round. Right! That's all wired up, apart from putting sort of connection points test points a bit like my zero volt and 12 volt test points um for the outputs of these two op-amps. So for the moment i'm just going to have to go on to these resistor legs.

Now, the next thing i want to know is, if i put 12 volts from my bench, power supply set of 12 no 10 batteries 1.2 volts each onto these original connection points thus back feeding the 12 volt power supply. Will it blow up said 12 volt power supply only one way to find out: let's do it: okay, wires connected to 12 volt power supply, let's connect that now the other thing we should see when i connect and disconnect. This is brief, pulses on these two relays, because the measured voltage on the comparators briefly as the voltage on these resistors goes up and down, will pull these relays in so connect didn't see the green disconnect. I did see the green flash connect uh so no smoke.

That's a good sign, no smoke coming from this power supply and no smoke coming from my new op amp. So now we need to start looking at the voltages on the outputs of the two op amps and we should have about five volts in each case. So, let's check this one pin one quite difficult to hold that on there ooh 11 volts. That's not quite right.

Let's check this one pin seven um that one is 4.48, which is correct, but this one is wrong: that one's not being ratio ratio, metrically, adjusted down to 5 volts. They should both be positive as well. That one is 4.49, this one isn't 11.05. So i've done something wrong.

What have i done wrong so on pin seven, which is the output of the inverting amplifier i've got there um. This is 10 volts per division. Can we see that so it's about half division. So that's about five volts, which is correct.

On the non-inverting amplifier so here on, pin one we've just got 12 volts and that should be scaled by these two resistors 10k and 24k. So i should be getting a similar sort of five volts here so have i got my non-inverting amplifier circuit wrong? I'm going to have to check just noticed in the equations for the non-inverting amplifier. The gain is one plus this resistor over this resistor. So if this is um 5 over 12, let's call it a half.

The gain of this circuit is one and a half. So, that's probably why it's not giving me the scaled output that i want. So how do i get the gain of a non-inverting amplifier to be 5 over 12 or sort of around about a half? Ah i'll have to rethink this. What i really wanted here on the non-inverting amp is a high impedance buffer to this peak follower.
Well, maybe the answer, then, is simply to put the output straight back into the negative input, a unity gain buffer and then put the potential divider on the output of the op amp and then measure the point between the upper and lower resistors. So i need to have a strategy rethink but uh for today. I think that's going to be it so cheerio.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

2 thoughts on “Op-amp oops”
  1. Avataaar/Circle Created with python_avatars SDG Electronics says:

    Don't forget to add some bandwith limit onto the op-amp circuits. At the moment, the frequency response is uncontrolled and can lead to unstable operation, especially if the op-amp has any kind of high GBW.

  2. Avataaar/Circle Created with python_avatars Mark Flack says:

    No magic smoke though.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.