# Reduce input voltage into a simple differential opamp circuit

#### Travm

Joined Aug 16, 2016
324
I'm trying to reduce the input voltage into an opamp from about 15 to 4. I have mocked a circuit up and it kinda works but I want to understand the math better. It is wired up to be a differential opamp for current sensing.
How I wired it up is with 2 1.6k input resistors, then 2 46k a feedback resistors, one I to ground the a other I to the inverting input. Then I added two more resistors to ground on a the inputs creating effectively a voltage divider. This seems to work, however in spice simulations adding these two resistors increases the gain. I want to be able to calculate the gain, but when I add these resistors the gain is tweaked just a little bit. It would be amazing if someone could point me at some info, I'm sure it's simple but I can't grasp it. I'm trying to write this on a cell phone, so I can add a diagram later if that is necessary, and I apologise for the rampant auto correct, is it's there.

#### crutschow

Joined Mar 14, 2008
25,632

#### Travm

Joined Aug 16, 2016
324 My simulator circuit has different values for the resistors, the load is only 60mA, but the gain is similar, Vin is only 12V on the simulator as well. The physical circuit works, and the math is kinda close. The physical circuit is also very close to the spice simulation.
Now I want to get to actually driving the larger load in a more finished item, but I want to understand what is going on with the opamp specifically so that I can be as accurate as possible.

#### crutschow

Joined Mar 14, 2008
25,632
Why are you using different values for the simulator as compared to the actual circuit?

#### Travm

Joined Aug 16, 2016
324
The simulator is a physical simulator. Using a small bank of LEDs to simulate the load. Different values because the current is way lower, and I calculated the ideal numbers for it.
I have spice simulations for both, they react similarly under spice. I was going from memory earlier.
I created the simulator circuit so I could make the software. Now I'm about to build the final unit and want to have a more accurate understanding of all my component choices.

#### crutschow

Joined Mar 14, 2008
25,632
I'm not much on mathematical calculations, so if you want a mathematical analysis of your somewhat oddball circuit you will need to do it yourself, or perhaps someone else on this forum can help you. #### AnalogKid

Joined Aug 1, 2013
8,675
The circuit as shown exceeds the opamp input voltage range. Depending on the qualities of the SPICE model and program, this might be a perfectly acceptable condition. The real world will have a different opinion. Also, your schematic shows three components connected to radio antennae, while only one is connected to GND.

ak

#### Travm

Joined Aug 16, 2016
324
The circuit as shown exceeds the opamp input voltage range. Depending on the qualities of the SPICE model and program, this might be a perfectly acceptable condition. The real world will have a different opinion. Also, your schematic shows three components connected to radio antennae, while only one is connected to GND.

ak
Spice model and actual measurements from the circuit disagree.
The two 1.2k resistors pull the voltage down at the inputs.
My radio antenna appear to ground the circuit just fine.

#### AnalogKid

Joined Aug 1, 2013
8,675
A 2K-1.2K divider is 37.5%. Throw in the 58 K and it drops to 37.0%. 15 V to 4 V is 26.7%.

ak

#### Bordodynov

Joined May 20, 2015
2,694

#### Travm

Joined Aug 16, 2016
324
You're missing the 58k to ground as part of the feedback circuit

#### Bordodynov

Joined May 20, 2015
2,694
Yes, I lost, but not 58 kOhm, but 100 kOhm. You do not like the transmission ratio of 10? In this case, the maximum signal will be 0.05 Ohm * 3A * 10 = 1.5V. Another output of the operational amplifier is to connect a 10 kΩ resistor (the other pin of the resistor to the GND)

#### Travm

Joined Aug 16, 2016
324
Yes, I lost, but not 58 kOhm, but 100 kOhm. You do not like the transmission ratio of 10? In this case, the maximum signal will be 0.05 Ohm * 3A * 10 = 1.5V. Another output of the operational amplifier is to connect a 10 kΩ resistor (the other pin of the resistor to the GND)
No I want a specific gain for maximum resolution.

#### crutschow

Joined Mar 14, 2008
25,632
If you give us the exact gain requirements, then we can help you better.

#### Travm

Joined Aug 16, 2016
324
I think I did. I may have my voltage divider values wrong, I have been plugging different items into spice and must have overlooked that when making the schematic.

#### crutschow

Joined Mar 14, 2008
25,632

#### Travm

Joined Aug 16, 2016
324
A 2K-1.2K divider is 37.5%. Throw in the 58 K and it drops to 37.0%. 15 V to 4 V is 26.7%.

ak
I'm expecting this is what is messing with my gain. The voltage divider on the leg that had the 58k to ground needs a different value?
What effect does the feedback loop on the other input have on that divider?

Wrong divider values aside, I will correct those.

#### Travm

Joined Aug 16, 2016
324
I missed that.
What is the value?
The gain is very specific, but indeterminate at the moment. Even the 3A load at this point is subject to variation. What i need the opamp to do is amplify the difference between the voltages on either side of the series sense resistor to approximately 4volts. Due to limits on opamp choices i cannot apply more than 5v at the input terminals. The system voltage will be around 14-15V, not important... (well it is, but it isnt). So the gain is dependant on the voltage drop of the chosen series resistor, and the load, both of which are not set in stone at this moment (although, they both have limits). The output cannot exceed 4v, however I want it as close as possible.
I created a circuit to test all of this. It worked, except under simulation the addition of a voltage divider at the inputs to ensure I dont smoke my opamp tweaked the gain ever so slightly from the expected value.
I got looking at it and beyond using the stated formulas for calculating resistor values and gain for a differential op amp, I dont know how to even start figuring out how to calculate what adding the voltage divider resistors does to my circuit.

I'm not looking for someone to troubleshoot my circuit, and i'm not looking for someone to do the math for me. Although a small kick in the right direction towards doing it myself would be ideal.

My circuit works awesome, but the fact that i can't connect the theory to the practical is a problem. The realisation (that i came to just earlier) about how the 58k resistor to ground actually modifies the voltage divider on that side might actually be the cause of the problem 100%. I am seeing about a 10% variation on the spice sim between having the divider connected, and not. So when i get a chance to sit down with a pencil thats where I'm going to look, I know how to do that math.

Thanks for even taking the time to read all this.

#### AnalogKid

Joined Aug 1, 2013
8,675
Start here - add reference designators to every component so I don't have to type so much.

There is no need for two of your resistors in the post #3 schematic. A balanced diff amp has two series resistors and two shunt resistors. If the series pair are equal and the shunt pair are equal, then the diff gain is based on a gain equation and the common mode gain is zero, which is what you want. The + input shunt resistor goes to GND. The - input shunt resistor goes to the output. You can get a precise values for these resistors by having two or more in parallel, but as a starting point it just clutters up the schematic. One opamp, one gain equation, four resistors - that is the starting point. Then things like offset voltage, bias current, the opamp's gain-bandwidth product, and real world component values product come into play as error terms, but they can be addressed *after* the base design is intact.

http://www.electronics-tutorials.ws/opamp/opamp_5.html

The next step is that this is not the complete solution for your application. However, without going through this step, the next one will make no sense.

ak

• Travm

#### crutschow

Joined Mar 14, 2008
25,632
Doing a high side current measurement is difficult due to common-mode errors.
There are ICs specifically designed to measure high side current which will save you a lot of grief.
Can you use something like one of these?