Op-amp subtractor

Hello World !

I would like to compute my motor tachometer's signal. This signal is a variable voltage going from 9v to 14v.
As Arduino can only accept signals from 0v to 5v on analog inputs, I have to decrease my signal's voltage.

I don't want to use a voltage divider with resistors, because I lose precision. I would like to use a Op-amp to shift the signal from 9v-14v to 0v-5v. With a Op-amp with a substract circuit I can substract my signal with a 9v regulated voltage...

Q1) Could you tell me if my reasoning is good ?
Q2) I don't have a symmetric power supply (+/- 14v) on my motor, can I put the Vcc- to GND and the Vcc+ to 14v ?
Q3) As my input and my output are close from the Op-amp power supply, I guess that I need a rail-to-rail Op-amp ?
Q4) What Op-amp should I buy for my project ? Preferably in DIP package.
Does the TLV2370 or the LMC6482 could works ?

Thanks,
Regards.

  • Sort of. You don't need a 9V reference, you need an accurate reference of any reasonable voltage, such as 5.
  • That's what you would do.
  • Indeed.
  • I don't know either, but someone else likely does.

Hi Paul,

Thanks for you reply.

Q1) In my circuit, the output will be Vout = (V2 - V1), where V2 = my signal 9v-14v and V1 = my 9v reference. Like that when my signal is at 14v the output will be 5v and when the signal is at 9v my output will be 0v. Is it correct ?

You don't need a 9V reference. You don't need the op-amp to be powered from 15V.

Let's start with a rail-to-rail op-amp operating at 5V, and a 5V reference. (This has the great advantage that there is no way it can feed an excess voltage into the Arduino :grin: ) OK, let's divide the input voltage by three with a voltage divider - let's say a 22k resistor to ground and a 47k resistor to your voltage to be measured (assuming that connecting a 69k load to that voltage will not cause problems). This voltage divider feeds the "+" input of your op-amp.

To cause the output of the op-amp to mirror the input, you connect the same divider between the op-amp output and the "-" input (that is, 47k from output to "-", 22k from "-" to ground). The op-amp will now keep its output at the same voltage as the input to the circuit.

But you want an offset. OK, let's not connect the 22k that is part of the voltage divider at the "-" input of the op-amp to ground, let's instead connect it to, say, 4.2V.

Now when your input voltage is 9V, there will be 2.87V on the "+" input of the op-amp and in order for the "-" input of the op-amp to be the same voltage, it will have to pull its output to ground - which is where you desire it to be when you have 9V on the input.

On the other hand, when you have 14V on the input, the "+" input to the op-amp will be at 4.46V and to match the "-" input, the op-amp will have to output 5V - again, exactly what you want!

The only remaining problem is deriving that 4.2V reference. To do this you replace the 22k resistor to the op-amp "-" input with two resistors, one to ground and one to your 5V (or any other) reference such that their parallel resistance is 22k. I leave you to figure out that calculation! :grinning:

I don't want to use a voltage divider with resistors, because I lose precision.

If you want better precision , you should start with better resolution
16-ADC

Yes, resistor divider, an ADC with more than 10 bits of resolution and a precision voltage
reference would do better than a difference circuit - finding a precision 9V reference doesn't
sound likely, 4.096V references on the other hand are plentiful.

Yes, resistor divider, an ADC with more than 10 bits of resolution and a precision voltage
reference would do better than a difference circuit

a precision divider requires precision resistors (1%,0.1% etc.)

If you're happy with the 10-bit precision and the 5volt ref of the Arduino, then I think you could shift the voltage with one rail to rail out opamp, supplied from Arduino's 5volt rail.

Basic circuit:
Step down the 9-14volt with a resistor divider to e.g. 0.9-1.4volt, and feed that into the +in of the opamp.
Three resistors with starpoint to -in of the opamp.
~1k to ground, ~10k to opamp output, ~4k1 to +5volt.
Values have to be calculated/finetuned.
Leo..

Hi,

Find wawa circuit attached.

Tom.... :slight_smile:

Thank you TomGeorge. Didn't have time to draw it up.
Looks good, except for the 4-14v label.
That should be 9-14volt.
Leo..

That's good.

I thought someone might draw up my circuit for me. :grin:

Hi,
Glad to be of service, error corrected...

Tom.... :slight_smile:

@Wawa,
Dumb question;
I recognize the Gain of 11 non-inverting amplifier but what is the purpose of the 4k pullup on the -V pin ?
That should yield a voltage divider output of 1.0 V. Is that how you offset the circuit to 0.9 to 1.4V ?
(by biasing the virtual ground)

Robert

Hi raschemmel.
I have just picked some resistor values out of my hat that worked. Could have done better by calculating them.
I think this might be the way to do it properly (please correct me if I'm wrong).

Find the center voltage between 9v and 14v >> 11.5volt.
Calculate the input voltage divider so that 11.5volt on the input gives half of the opamp's rail voltage (2.5volt).
e.g. 18k/5k.
Pick equal values for R3 and R4.
e.g. 2x4k7
The opamp's output, with 11.5volt input, will now be mid-voltage (2.5volt). Independent of the value of R5.
R5 gives the required deviation of 9-14volt by changing the virtual ground (-input).
~8k2 should do it.
Leo

Wawa:
I think this might be the way to do it properly (please correct me if I'm wrong).

Find the center voltage between 9v and 14v >> 11.5volt.
Calculate the input voltage divider so that 11.5volt on the input gives half of the opamp's rail voltage (2.5volt).
e.g. 18k/5k.
Pick equal values for R3 and R4.
e.g. 2x4k7
The opamp's output, with 11.5volt input, will now be mid-voltage (2.5volt). Independent of the value of R5.
R5 gives the required deviation of 9-14volt by changing the virtual ground (-input).
~8k2 should do it.

Using your choice of resistors, the voltage divider formed by R1 and R2 has a gain of 5/(18+5) = 0.217.

The amplifier has a gain of (R5+R3//R4)/(R3//R4) = (R5+2.35)/2.35.

As you want an input swing of 14V to 9V to give an output swing of 5V to 0V you need an overall gain of 1. So
0.217 x (R5+2.35)/2.35 = 1

Giving R5 = 8.46KΩ.

Thanks for the detailed explanation.
I picked 8k2, because rail2rail out opamps are almost rail2rail.
Leo..

@Archibald,

I'm not following your math.

The circuit you described (SEE ATTACHED) has the following values:

R1 =18k
R2 = 5k
R3 = 4.7k
R4 = 4.7k
R5 = 8.46k

This results in a voltage divider with an output = 0.217*Vinput (as you stated)

This also results in the -V pin biased midpoint (2.5V).
The amplifier gain is given as:
Vo = VIN * [1+R5/R4]
= VIN * [1+8.46k/4.7k]
= VIN * [1+1.8]
= VIN * [2.8]

Since input voltage divider gain = 0.217,

Overall gain (as you put it)
= 0.217 * 2.8
= 0.6076
which is biased at (or added to) 2.5V (since R3=R4)

Clearly one of us in wrong, (probably me).
If you could explain how you arrived at your conclusion I would appreciate it.

Maybe I am being too simplistic but I just see an input voltage divider [A=0.217] followed by a non-inverting amplifier [A=2.8] biased at 2.5V.
Non-Inverting Amplifer

I have to say the part that confuses me most is this:

R5 gives the required deviation of 9-14volt by changing the virtual ground (-input).

R5 in Wawa's circuit is the feedback resistor for the amplifier.
Are we talking about the same schematic ?

Why not just divide the voltage by 3 and feed to an ADC ? I am having trouble understanding why an op-amp is really beneficial here.

michinyon:
Why not just divide the voltage by 3 and feed to an ADC ? I am having trouble understanding why an op-amp is really beneficial here.

Resolution goes down when you use a voltage divider.
A 1:2 divider (so you can measure to 15volts), and only using 1/3 of it (9-14v) drops resolution to ~15mV/digital step, and ~330 steps.
Fine if you're happy with that.
Using an opamp like this changes resolution to ~5mV/step, and ~1000 steps.
Leo..

@ raschemmel.

Vo = VIN * [1+R5/R4]

I think you're forgetting that R3 AND R4 are both attached to a fixed point.
So from a dynamic point of view (opamp output), R3 and R4 are in parallel (2K35).
Leo..