Arduino as a voltmeter

I need to read DC voltages between -2.5 V and 2.5 V with Arduino. I have read that an op-amp in inverting configuration (below) can be used to add a DC component. Therefore, I have thought about using this circuit to add 2.5 V and be able to read with Arduino, since the voltage would remain between 0 and 5 V. Is this option feasible or are there better alternatives?

Thank you

• That would work fine, as long as you use a rail-to-rail op amp and make sure you use an appropriate value for V1 (the 1 V you marked there won't work, regardless of resistor values). Be aware that your signal voltage will be inverted; a 2.5 V signal will give a 0 V output and a -2.5 V signal will give a 5 V output. This can be corrected easily enough in software though. May 22, 2022 at 17:31
• Is your input voltage source grounded? If it is floating, there is a simple 2-resistor solution... May 24, 2022 at 7:01

It depends what the output impedance, aka drive strength, of your voltage source is. However, in the circuit you've illustrated, you've used an inverting configuration, which has a finite input impedance of R1 anyway, so my configuration may be no worse.

At its simplest, if you can drive the resistors, all you need is this

simulate this circuit – Schematic created using CircuitLab

Reference the ADC from 3.3 V for full range. However, for the simplicity, and not needing an op-amp, it may be worth the small sacrifice in range if you use 5 V for the reference. IIRC, Arduino does have an internal 1.1 V reference, which can be used to give full scale if you change the R values, and add an extra shunt resistor from the output to ground. Ask a separate question if it's not obvious how to do this.

The input impedance is 30 kΩ, the output impedance to the Arduino ADC is 6.7 kΩ, which is IIRC within its input impedance tolerance. I think it can tolerate higher resistors if you have a C to ground to source the ADC current spikes.

• I thought of mapping as you say, ie using a voltage divider with a shunt resistor. But, after calculations, I found that the shunt resistance had to be negative. In fact, when the input voltage is 2.5V we want the output to be 5V, so we have opposite currents circulating through the same branch. I don't know if I am explaining myself... In other words, it seems necessary that Vcc be less than the maximum value of the input voltage May 22, 2022 at 20:58
• @Sharik_97 I was suggesting that you don't have the output range all the way to 5 V. Do the sums on the values I've shown. It may be worth it for not having to use an opamp. May 23, 2022 at 4:06
• Sorry, I don't know what values ​​you are referring to. What I said is that I tried to do the mapping using a resistor between the output and ground, as you said, and I came to the conclusion that that method is valid only when the maximum input voltage is greater than the supply (Vcc). I think I'll ask another question later to make my doubt clearer May 27, 2022 at 17:00

So you want to map the voltage range (-2.5V to 2.5V) to (0V to 5V)?

To do this, you need to know what gain and offset will fulfill this mapping. This is easy to determine, you have 2 equations with 2 unknowns: -

$$a \cdot (-2.5\text{V})+b=0\text{V} \tag1$$ $$a \cdot 2.5\text{V} +b = 5\text{V} \tag2$$

Solving these yields the gain $$\a=1 \$$ and the offset $$\b=2.5\text{V} \$$. So you need a circuit with this exact gain and offset. This can easily be realised, for example with a summing amplifier topology like this: -

• Another suggestion: You can replace Voff and R2 by a 2 x 2 k voltage divider supplied by V+. May 24, 2022 at 6:57