[Solved] Measure higher voltages with a voltage divider

Hello.

I want to be able to measure voltage of a battery pack which exceeds 36v. To reduce voltage to the point where it could be measured with an ADC a voltage divider can be used.

To reduce losses on a divider a large values of resistors can be used together with a capacitor to ground, which would provide the necessary current for ADC to take meaningful readings.
A pair of multiturn potentiometers of different values should allow for accurate adjustment.

I wonder.. What if to simply use fixed 0.1% resistors instead of potentiometers?
Or what if to use a pair of fixed resistors and a smaller value potentiometer at the 'bottom' to still have it adjustable..
Or perhaps there is an alternative to a voltage divider - some kind of 'high-voltage' ADC or a dedicated voltage supervisor IC?

Any suggestions are welcome.

You can use fixed resistors, and they need not be precision. You have to calibrate the divider/ADC combination anyway, by measuring a known voltage. After all, the ADC reference voltage is not known with much accuracy, unless you measure it too.

I would use an ~8:1 divider for ~40V max (68K/10K) on a 5V Arduino.

Voltage readout depends on two things.

  1. the output of the voltage divider
  2. Aref of the A/D

No point in using multi-turn pots or 0.1% resistors if you're going to use an A/D with a potentially unstable Aref
(Arduino's default).

Resistor/Aref inaccuracy can be fixed in code.
Resistor.Aref instability, e.g. with temp, is much harder for 'fix'.

So what resolution do you expect for that 36volt supply.
A 0.1volt resolution with two fixed 1% metalfilm resistors and the internal 1.1volt Aref should be possible.
Leo..

Thank you for your replies guys.

Umh… There are nice and convenient (and cheap too!) 16bit ADC modules built around ADS1115 IC. Unfortunately this IC does not have a Vref pin at all, but it can be used in differential mode.
For noise rejection and all that it’s of benefit to use ADCs in differential mode in any case.

A precision voltage reference like a MAX6126 with 4.096V output and 0.02% error will do nicely for the ‘top’ or upper input of a differential setup.

As for resistors and temperature drift - that’s a good point. Just checked with local supplier (RS components), they do stock many variants with 15ppm/°C temperature drift at fairly low prices (under £2 per bad of 10).

Nice thing about ADS1115 ADC is that it does not have alot of complicated registers - only two in fact…
There is a Config register to set prescaler and which channel to read from.
Second register is where the voltage reading is kept.

Here is a piece of code (should somebody be interested in future) that reads from channels 0 and 1 in differential mode:

int read_channels_0_to_1() {

  // Step 1: set which channels to read
  Wire.beginTransmission(I2Caddress);
  Wire.write(0b00000001);  // Point to Config Register
  Wire.write(0b00000000);  // AIN+ve = AIN0 and AIN-ve = AIN1 and 2/3x gain
  Wire.write(0b10000011);  // sampling rate 128SPS
  Wire.endTransmission();
  delay(17); // to give ADC time to make next reading. These delays are essential!!

  // ====================================

  // Step 2: Set the pointer to the conversion register to retreve last reading
  Wire.beginTransmission(I2Caddress);
  Wire.write(0b00000000);  //Point to Conversion register (read only , where we get our results from)
  Wire.endTransmission();
  delay(17); // to give ADC time to make next reading

  // =======================================

  // Step 3: Request the 2 converted bytes (MSB plus LSB)
  Wire.requestFrom(I2Caddress, 2);

  // Read the the first byte (MSB) and shift it 8 places to the left then read
  // the second byte (LSB) into the last byte of this integer
  voltage_across_shunt = (Wire.read() << 8 | Wire.read());
  return voltage_across_shunt;
  delay(17); // to give ADC time to make next reading
}

The AD1115 has a buildin reference. No external one needed (and not possible to add).
All you have to do is drop the 36volt with a voltage divider to one of the ranges of the PGA.
A convenient one is 4.096volt (PGA gain 1x).

Not sure why you need differential mode to measure a single voltage.
Note that voltages (any mode) have to fall within supply and ground limits of the chip.
Leo..

Indeed, no external reference needed for the ADS1115, it's built in. 4.096V is fine for a 5V Arduino, or use 2.048 for a 3.3V Arduino (the maximum voltage that can be measured is the supply voltage, even if the range is higher).

A 1:10 divider would work very well (10k + 100k - don't make those larger or you run into problems with the rather low input impedance of the ADS1115). Then 36V would become 3.27V, offering a good resolution (almost 80% of full scale; about 26,000 ADC points for 1.4 mV resolution on the battery voltage), and allowing you to measure up to about 44V battery voltage which is important as at full charge your voltage will go well above nominal.

Note that due to the 1% resistor tolerance the measurement error is up to 2%, albeit highly constant over the range so if you have a more precise voltage meter you can use that to calibrate your sensor and add a correction factor. That way you should be able to get 0.1V or better accuracy.

A 1:10 divider would work very well (10k + 100k

That would be an 11:1 divider.

Yes indeed, ADC input impedance is not infinite… That’s why I’m thinking of adding a capacitor connected in parallel with ‘lower’ resistor which should provide current for the reading…

Anyway, since the voltage divider seems to be the only way now it’s the matter of assembling few versions on a perfboard.

Thank you very much for the reassurance!

A capacitor doesn't change that. The input impedance may mess up your voltage divider, capacitor or not. A capacitor may however help smoothing out noise.

At 2.048 and 4.096V ranges the input impedance is 6M, so negligible compared to your 10k resistor. But if you would use 100k + 1M for divider you would get a measureable error because of that!

Ouch, have not thought of it.. Thank you for the warning!
Definitely should go with 10k + 100k.

A capacitor on a ADC input it is a good idea too.. On MAX6126 voltage reference in the datasheet they recommend a pair of capacitors 10uF and 0.1uF on its output.
Will try putting same combination on the 'lower' line of differential input.

Thanks again!

Why differential.
I thought you wanted to measure a single ~36volt source.
Leo…

AlfaOmega:
A capacitor on a ADC input it is a good idea too.. On MAX6126 voltage reference in the datasheet they recommend a pair of capacitors 10uF and 0.1uF on its output.

Don't mix up output and inputs.
The 10µ electrolytic is for decoupling (stabilises the output; catches current spikes). This is not applicable at all for your voltage divider as you have a very stable and minimal load (the ADS input). It will slow down reaction of your voltage divider to a change in the battery (10µF and 100kΩ makes for a 1 second RC time constant).
The 100n ceramic is for filtering of noise and further decoupling. That is to a certain extent applicable to your voltage divider (mostly depending on length of wires and general electric environment), may not be necessary, that's a matter of experimenting. It won't hurt, either.