Design & Order on EasyEDA, PCB+SMT $10 Off: https://easyeda.com/editor
Get coupon & Join JLC&EDA Group: https://jlcpcb.com/EDA
It's a bit heavy on the maths
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 morning all so, i built a dual op-amp circuit on my evse prototype board, and here are the two op-amps there's a non-inverting and an inverting and there's a problem with the non-inverting, and that problem is that i wanted both of these circuits to be reducers, to Reduce the voltage that they're measuring now the inverting amplifier works as a reducer by having 5k well 10k in the feedback and 24k in the input resistor. But this one doesn't work because of the equation of this particular configuration of non-inverting op-amp. So what i built was this non-inverting op-amp with a feedback resistor between output and negative input and a resistor to ground. We'll call that r f we'll call this r g feedback resistor and ground resistor.

But the problem is the input just was fed in straight into there. The formula for this is one plus r f over r g, and i don't want the one plus, because i want this thing to act as a reducer in much the same way as a potential divider acts as a voltage reducer. Now, if you're thinking julian, why are you bothering with an op-amp? Why don't you just have a potential divider top resistor bottom resistor ground, and then you tap off the midpoint well because of impedances. I need to present to this peak detector circuit, a one mega ohm, approximately impedance, but on the other side of my potential divider, which is why this won't work.

I need to present a relatively low impedance, no more than about 10k here to the next thing, which is an arduino's analog to digital input. So let's say that i made these 5k and 7 k. That's the right ratio! 5 out of a total of 12 bringing 12 volts at this top point down to 5 volts here, this 5k impedance would be great for the input of an arduino's analog to digital converter. But the total resistance 12k isn't going to be very clever here across this capacitor, because that's supposed to have one mega ohm approximately so that it doesn't drain too quickly.

12K will drain that capacitor far too quickly and you'll have some sort of ghastly ripple wave, which is very difficult to measure so because of this uh annoying formula, one plus rf over rg, meaning that the gain of this amplifier cannot be less than one. Even if you reduce rf to naught - which essentially is this it's a unity, game, buffer and rg to infinity, you still can't get the gain of this less than one the gain of a unity game buffer is one, and so the answer i've decided is a unity Gain buffer with a potential divider of sufficiently high resistance, so it doesn't drain this capacitor too quickly, uh, going into that unity gain buffer, and then that will present a low impedance going out to the arduino's analog to digital input. The question is: what are these two resistor values so calling them our top rt and our bottom rb? We know that rt plus rb must be one mega ohm, a million ohms, because there it is one mega ohm across that capacitor to provide a very slow discharge of that capacitor to ground, so that, as the voltage on this cp line comes down, this capacitor voltage Will come down with it? The capacitor course will always be 0.6 volts less than this cp line, courtesy of that diode, so rt plus rb equals a million, but we also want rb to be 5 7 of rt. So this is a five value with some.
Some number of naughts after it - and this is a seven value with some number of naughts after it. So what are these actual values? Well, these are simultaneous equations, so i'm going to have to substitute 5 7 rt into the first equation. Giving rt plus 5 7 rt equals a million. So what is 5 7 well.

5. 7 is 1.714, so adding an rt in there rt plus 5 7 of rt gives you 1.714 rt equals a million, and that gives you approximately rt being 583 k. Now, that's not a known resistor value rb. Therefore, using this formula, um of a million minus rt gives you rb gives you rb at 417 k, also not a standardized resistor value, so which is more important.

The ratio of rb and rt, or the total value of rp plus rt. Well, this one mega - and we could flex a bit on that, but i would like to keep this as 5 7 because i'm trying to measure the voltage here so i'd like that to be as accurate as possible. So, given that we could deviate a bit from this million, what we could do is either take rb and rt up a little bit or we could bring them both down a little bit. Well, how about we bring them both down a little bit.

We make rb 390 k, which is a bit less than 417k. We make rt 560k, which is a bit less than 583k, so first things. First, the sum of these two 560 plus 390 is 950 k, 950 k, which is not that too far removed from one mega ohm. So i think that would be fine.

The discharge on this resistor would be slightly quicker, but not by much. So that's, okay. Now, what about the ratio 390 to 560? Well, what i'm trying to do here is measure something that can be up to 12 volts and reduce it down to a voltage that can be up to five volts, which is what um my microcontroller, the arduino's 80 mega. Three well forgot what it's called 328 p.

That's it what that can measure. So i want to measure this 12 volts. I want to measure it as 5 volts. So, let's do these two, as ratios of 12 volts, so rb will be the lower value 390 divided by 950..

Let's do that. Three: nine zero divided by nine five. Zero is 0.410 multiply that by 12, which is the incoming voltage times 12, and that gives us 4.92. You can see the value there, so it's a little bit low because i wanted 5 volts as a reduction from 12 volts.

Okay: let's try the higher value 560k 560 divided by three. No, that's not right! Is it 560 divided by 950, 560 divided by 950? Is that multiplied by 12 and we get 7.07? So you can see i've written those two numbers down here, so the 5 volts is a bit low, it's 4.92, the 7 volts, which would be the voltage across rt if we've got 12 volts. Here is a little bit high at 7.07, but i think it's not too far away. This is eight one hundredths, isn't it or 0.08 error? This is 0.07 error, so it's not too bad and i'm not sure that i'm going to find a better ratio of resistors.
I suppose i could try the the where the ratio of resistors going above one mega ohm, so i'd need to find something above 417 that could be 430 and the next one up from 583 is probably 620. So that's that's a possibility so 620 plus 430. That looks like it goes, the other way doesn't it so i think that's. 10.

50. Okay, so it's 50k over rather than 50k, under, let's work out the ratios, and actually it's really very similar. Instead of 4.92, we get 4.91. So it's slightly further away from 5 volts and instead of on 7.07, we end up with 7.08 slightly again further away from 7 volts out of the 12 volts very little in it.

My only concern is that finding a 430 k resistor could be tricky. Let's have a look well, i have found. This must be an e24 series. I found the 560, the 390, the 620 and the 430k, but the numbers don't lie.

This ratio is slightly more accurate. Is there any downside to having um a slightly lower value resistor here and across that capacitor than a higher one? Not really so, i think i'll go for 560k and 390k, so for my non-inverting, but uh gain less than one op amp. I have to move away from this because of the formula for this doesn't work, and i have to go to this 560k over 390k and a unity gay non-inver unity gain non-inverting buffer there to present a low impedance to the input of the arduino. That's it.

Let's rip that out and put that in, but you don't want to see that do you because you prefer maths to soldering, so that's it! Cheerio.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

13 thoughts on “Resistor simultaneous equations”
  1. Avataaar/Circle Created with python_avatars Ed Luke says:

    Actually, your inverting circuit will also have an impedance problem. As it is setup it has an impedance of 12k which will totally mess up the time constant of your filter stage.

  2. Avataaar/Circle Created with python_avatars Steve Brown says:

    Why not unity gain followed by potential divider? High impedance on input and selected impedance by divider resistor selection

  3. Avataaar/Circle Created with python_avatars Simon Hopkins says:

    This went over my head sooo fast my ears are still flapping about.

  4. Avataaar/Circle Created with python_avatars Philip - Money Mongoose says:

    Add an extra resistor in parallel to one of the existing resistors to trim the divider.

  5. Avataaar/Circle Created with python_avatars kapegede says:

    Why not just using a 1 meg linear potentiometer and adjust it precisely to 5 volt?

  6. Avataaar/Circle Created with python_avatars Slikx666 says:

    So now I need to ask a question.
    If you treat the circuit as an equation and you've changed one side, do you need to change anything on the other side?

  7. Avataaar/Circle Created with python_avatars Andy Jary says:

    Great video and idea of voltage reduction keeping impedance roughly the same. I would have 'paralleled-up' some resistors to give you a resistor value closer to what you wanted, although what you did from the high end to low end values, seemed to approximately fulfil the requirements. Lets see how this works out in practice!

  8. Avataaar/Circle Created with python_avatars donepearce says:

    pop a 10k trimmer pot in series with the lower resistor. You can make it as accurate as you like.

  9. Avataaar/Circle Created with python_avatars Paul Mcgillivray says:

    Why not use a trim pot to set the exact resistance you need

  10. Avataaar/Circle Created with python_avatars Chris G says:

    Why don't you just use the opamp as a voltage follower (high impedance input, low impedance output) with the potential divider on it's output to feed into the arduino.

  11. Avataaar/Circle Created with python_avatars Mark Durbin says:

    1M / (5+7) *5 and *7 are your values

  12. Avataaar/Circle Created with python_avatars Brett B. says:

    I was actually in the mood for some soldering ๐Ÿ˜ƒ

  13. Avataaar/Circle Created with python_avatars James Sharman says:

    So weird, I used a unity op-amp in my last bit of circuitry. Can you not have the resistor values in the code and fix up the values after the AD in software?

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.