Measuring between -12V and 12V using Arduino analog pin

Hi,

Apologies but my google-fu is failing me. Once before I know I've used an op amp circuit to translate a range from -12V to 12V into 0-5V that the Arduino can tollerate on an analog pin. I know the circuit had a dual op-amp in it, and a 5V zener as a final protection stage. But because I can't recall what that configuration is called I've not been able to search for it (and most forum search engines seem fail with the term "-12V").

Can you aim me in the right direction for a schematic, or, if this is a super-simple one, to the name of that use/configuration for an op amp?

Thanks
Geoff

Differential

Connect a 12 volt battery to the signal so it is increased into the range from 0.00 volts to 24.00 volts. Then use two resistors as a voltage divider.

5v = 24v (R1/(R2+R1))

set R1 = 10k

5 = 24(10k/(R2+10k))

solve for R2

Use non-inverting summing amplifier.
Use a voltage divider on the +/-12V input to bring it down to +/-2.5V range, and add 2.5V to it so output is 2.5V +/- 2.5V max.
http://masteringelectronicsdesign.com/the-transfer-function-of-the-summing-amplifier-with-n-input-signals/

No need for anything so complicated, all you need is 3 resistors:

84K from +/-12V input to analog pin
60K from analog pin to ground
35K from analog pin to +5V

  • or any other 3 resistors with values in the same ratio. That will translate -12V to 0V and the pin, and +12V to +5V.

In practice, you'll want to use standard value resistors, and you can accept the voltage range on the input pin being slightly less than the full 5V. So you can use e.g. 81K, 56K and 33K.

Those high values might be ok for a slowly changing signal. Op amp would be better for faster changing signal to maintain the <10K source impedance to charge up the sample & hold capacitance of the ADC.

CrossRoads:
Those high values might be ok for a slowly changing signal. Op amp would be better for faster changing signal to maintain the <10K source impedance to charge up the sample & hold capacitance of the ADC.

Or use lower value resistors, e.g. 12K, 8.2K, 4.7K. But high values give better protection against transients on the input.

You are also assuming the +/-12V source has enough drive to overcome the DC level created by the bias resistors.
Perhaps it does not. Then driving the high impedance input of an op amp is the better way to go.

strykeroz:
Hi,

Apologies but my google-fu is failing me. Once before I know I've used an op amp circuit to translate a range from -12V to 12V into 0-5V that the Arduino can tollerate on an analog pin. I know the circuit had a dual op-amp in it, and a 5V zener as a final protection stage. But because I can't recall what that configuration is called I've not been able to search for it (and most forum search engines seem fail with the term "-12V").

Can you aim me in the right direction for a schematic, or, if this is a super-simple one, to the name of that use/configuration for an op amp?

Thanks
Geoff

How accurate do your readings need to be ?

Thanks everyone,

I'm glad I posted as it seems my recollection was well wrong - just one op amp for starters. The situation is measuring the voltage output by an ATX power supply between the -12V and 12V rails with a LM338 variable voltage regulator applied so the range is an effective 1.2V through around 20V. For the accuracy question it's to display a guide of the voltage output only, so the 0.02V (or thereabouts) steps are satisfactory.

Thanks again,
Geoff