A “dynamic voltage divider” is that even a thing? I am using an ADC ADS1115 to measure voltage on batteries. Now these batteries are sometimes 12 Volt, 24 Volt or a bank of 48 Volt or even 72 Volt.
To get 5 Volt at the output of a voltage divider with 72 volt I need R1 to be 3K Ohm and R2 to be 220 Ohm. Like this I can have 0 to 72 Volt measured. However now the voltage is 12 Volt… using the same voltage divider I get 0.833 Volt output and with 24 Volt battery I get 1.667 Volt output.
Is there a way I can measure these voltages without doing any hardware or source code modification and reupload to code to Arduino?
Set the resistor divider for 100V.
Show your code, in code tags. When I measure 5V i get near 5V. I'm figuring the formula being used may be incorrect.
voltage divider calculator
I need R1 to be 3K Ohm and R2 to be 220 Ohm.
They don't need to be those values, there are many combinations that would give the output voltage you want. Those values seem too small. Don't the resistors get hot? What power rating are these resistors?
ADS1115 has several ranges that can be set, from ~6V, ~4V, ~2V, ~1V, ~0.5V and ~0.25V, so your code can start at a higher range, and if the value is low, switch to a lower range and take a second, more accurate reading.
2021: marcwitteveen invented the "dynamic voltage divider"
No, it is not a thing, but autoranging is.
A Arduino pin can be high impedance, but also connected to GND. That makes it possible to have a voltage divider and let the Arduino choose which R2 will be connected to GND. There are many ways to mess around, but it might not be useful.
Selecting an other range might increase the accuracy for lower voltage.
However, if you are okay with the same accuracy for all voltages, then use a voltage divider for 100V as Idahowalker wrote.
Can you tell how accurate you want to measure the voltage ?
Make sure you get the 0.1% accuracy precision resistors. Regular ones are 5% or 1%. Auto scale from largest to smallest that will fit. Try switching to more precise scale if the read out is less than 10% of the full scale. Don't forget to switch to highest scale after done!
The method Koepel mentioned is potentially dangerous. If none of the arduino pins is set to ground then they all are potentially exposed to the full battery voltage.
The method Koepel mentioned is potentially dangerous.
It sure is That's why I used the term "mess around".
Just a suggestion get the schematics for several VOMs and see how they did it. This will also give you an idea of resistor values, switching etc.
"Dynamic voltage divider" == potentiometer.
Anyway, just set up your voltage divider to give 5v output (or whatever your Vref is) for the highest battery voltage anticipated. You're using a 16 bit ADC, right? That will give you 1 mV resolution. Do you need better than that?
You’re using a 16 bit ADC, right? That will give you 1 mV resolution. Do you need better than that?
The ADC has programmable gain with ±0.256V range with 16 bits with 0.15mV offset error and 0.002% gain error at room temperature so it can do much better than that. Read the spec sheet.
The ADC has programmable gain with +-0.256V range with 16 bits with 0.15mV offset error and 0.002% gain error at room temperature so it can do much better than that. Read the spec sheet.
I have used the ADS1115 extensively and am familiar with its characteristics. I'm saying that if the voltage divider is set up for a full scale reading of 72 volts, that translates to 1 mV resolution with a 16 bit ADC (2 mV for differential operation with a sign bit). If that level of accuracy is sufficient, then a single voltage divider is all that is needed.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.