Author Topic: Voltage divider question, what R to use  (Read 2879 times)

0 Members and 1 Guest are viewing this topic.

Offline lpaseenTopic starter

  • Contributor
  • Posts: 18
  • Country: ca
Voltage divider question, what R to use
« on: February 19, 2019, 04:54:58 am »
I'm need to measure 0-14V with a MCP3424 ADC with as much precision as the wallet allows. At first I was thinking that I don't want to load what I measure to much so I put in 5.8M and 1M and started testing. Soon I realized the obvious, the ADC has an input impedance that causes a big error in the basic math. 2.5M parallel with 1M =  714285 ohm and it gets way worse if I use the PGA, 2.5M/8 makes my lower R closer to 238K. Putting a DVM or a scope on the lower R also impacts the over all current and with that the voltage over the lower resistor.

Ok, now when I know that I can adjust the math in the app but I still have the issue of whatever this is the right path. Maybe I should just go with some lower values, maybe 220K and 33K. I still need to compensate for the ADC load and so on but maybe it's some other reason to do one way or the other, reasons like that it's easier/cheaper to get 0.1% resistors at 220K than 5.8M.

Sidenote, I found out that what this contraption is going to measure will be the voltage on the different power rails on a PC motherboard so the load it creates should not be a problem.
 

Offline Nerull

  • Frequent Contributor
  • **
  • Posts: 694
Re: Voltage divider question, what R to use
« Reply #1 on: February 19, 2019, 05:01:12 am »
The MCP3424 wants a low impedence input. It measures voltage by charging a capacitor and timing how long it takes to discharge,  the source impedance needs to allow this in a reasonable time.
« Last Edit: February 19, 2019, 05:04:09 am by Nerull »
 

Offline beanflying

  • Super Contributor
  • ***
  • Posts: 7375
  • Country: au
  • Toys so very many Toys.
Re: Voltage divider question, what R to use
« Reply #2 on: February 19, 2019, 05:16:34 am »
Resistive divider unless you use very low value resistors are going to load the ADC. The Datasheet on a quick glance shows this. they actually mentioned ideally Zero.

Consider an op-amp buffered input instead of just a resistor divider. Depending on the 'accuracy' you need look seriously at the Temp Co of the resistors instead of their % accuracy and trim appropriately with a trimpot this will get you a more stable input again over a range of environmental conditions.


Lots of reading here http://www.ti.com/lit/an/sloa098/sloa098.pdf
« Last Edit: February 19, 2019, 05:18:29 am by beanflying »
Coffee, Food, R/C and electronics nerd in no particular order. Also CNC wannabe, 3D printer and Laser Cutter Junkie and just don't mention my TEA addiction....
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Voltage divider question, what R to use
« Reply #3 on: February 19, 2019, 10:30:14 am »
The problem is the voltage on the potential divider changes, when a sample is taken, as the built-in sample and hold capacitor takes a charge. If the bandwidth is low, try a capacitor across the lower resistor in the potential divider, to provide a charge to the sample and hold capacitor. Start with 1nF.

Here's a handy tool for calculating the resistor values in a potential divider.
https://www.random-science-tools.com/electronics/divider.htm
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7453
  • Country: pl
Re: Voltage divider question, what R to use
« Reply #4 on: February 19, 2019, 12:57:31 pm »
LTC2400 datasheet treats this topic in a lot of detail.
A sufficiently large filter capacitor is an improvement, but it only smoothens the ripple and turns it into a constant DC current which still flows through the resistors and causes some error, by Ohm's law.
The magnitude of that current may depend on temperature to some extent.
IIRC, for  the LTC2400, a few komhs of input resistance was supposed to be enough to get decent accuracy without any opamps and filter capacitors. With ATX voltages, such dividers would only draw a few mA of waste current on each rail.
Remember that the output resistance of a divider is equal to the two resistances in parallel.
« Last Edit: February 19, 2019, 01:01:37 pm by magic »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Voltage divider question, what R to use
« Reply #5 on: February 19, 2019, 02:46:00 pm »
Run the signal through an op amp voltage follower.  This will preserve the voltage and lower the source impedance headed toward the ADC.  But this is the reduced voltage, not the original signal.  It's kind of a PITA to work with higher voltages directly.  Ideally, the Vcc for the op amp would be the same as the ADC Vcc.

Sometimes when we talk about measuring 0-14V (or some other numbers) we don't really need to include zero.  Sometimes we really want to measure 10-14V for battery charge information.  If this is the case, read Chapter 4 of "Op Amps For Everyone" - Google for it, it's available at MIT I believe.  In fact, if you are going to use the voltage follower approach with a single supply op amp, read it anyway.

In theory, the input current to an op amp input is extremely low and for modest size resistors, unlikely to upset the reading.
 

Offline lpaseenTopic starter

  • Contributor
  • Posts: 18
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #6 on: February 19, 2019, 02:55:02 pm »
Thanks for all the info, I'm reading up on some parts of it now.
The board has 2 chips on it = 8 channels and is very tight so while I might be able to add a small 1nF cap parallel to the lower R adding an op-amp on each channel is just not practical.Given that we talking 3SPS I can probably even make that cap a little larger.
The requirement is to be able to measure 12V rail as well as cpu/ram voltages like 1.2v. My plan is to just increase the gain when measuring the lower voltage hoping it won't be to much inaccuracy in that. Plan B is to make top resistor 0R and not install the bottom one for one chip, then it's 4 channels for 14V and 4 for 0-2.048V, just afraid they would put 12V on the max 2V side and blow the port.

I understand that the ADC impedance will impact the measurements but as long as it's known I can just add some math to compensate for it. The tricky part is if the ADC impedance changing during the measurement, then it gets very hard to compensate for it unless it's some kind of formula around (didn't see anything like that in the datasheet).
 

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #7 on: February 19, 2019, 05:13:53 pm »
I understand that the ADC impedance will impact the measurements but as long as it's known I can just add some math to compensate for it. The tricky part is if the ADC impedance changing during the measurement, then it gets very hard to compensate for it unless it's some kind of formula around (didn't see anything like that in the datasheet).
There is no formula, since input impedance is quite non-linear. Lately, I was measuring an error of the voltage measurements using MCP3422 with 47k in series with input. I get 50 mV for 2,5V, or 2% off. Interesting, that putting a capacitor across input and ground makes this error bigger.
So, ether you should buffer resistive divider by OPA, or use a small value resistors, <10k for lower leg and calibrate a gain error over input voltage range
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Voltage divider question, what R to use
« Reply #8 on: February 19, 2019, 05:22:53 pm »
The datasheet seems to imply that the ADC input impedance is quite high and the sampling capacitance is quite low.  Then they turn around and say that the driving impedance should be zero and to use an op amp.

Quote
The conversion accuracy can be affected by the input
signal source impedance when any external circuit is
connected to the input pins. The source impedance
adds to the internal impedance and directly affects the
time required to charge the internal sampling capacitor.
Therefore, a large input source impedance connected
to the input pins can degrade the system performance,
such as offset, gain, and Integral Non-Linearity (INL)
errors. Ideally, the input source impedance should be
zero. This can be achievable by using an operational
amplifier with a closed-loop output impedance of tens
of ohms.

Emphasis added...
 

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #9 on: February 19, 2019, 06:03:44 pm »
The problem is the voltage on the potential divider changes, when a sample is taken, as the built-in sample and hold capacitor takes a charge. If the bandwidth is low, try a capacitor across the lower resistor in the potential divider, to provide a charge to the sample and hold capacitor. Start with 1nF.

Here's a handy tool for calculating the resistor values in a potential divider.
https://www.random-science-tools.com/electronics/divider.htm
You are confusing sigma-delta ADC with SAR. For SD sampling rate is defined by internal clock oscillator, not the user. So even small S/H cap would draw substantial current if it's charged /discharged at 100k-1M Hz. There is time constant RC - S/H cap & input series impedance and another time constant - is internal sampling clock period. To have 18-bits, first RC time constant has to be 15x times lower. Data sheet is not state internal clock, IMHO it's about 300-400 kHz.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7453
  • Country: pl
Re: Voltage divider question, what R to use
« Reply #10 on: February 20, 2019, 10:28:15 am »
I forgot to add yesterday:

Motherboards have built-in voltage sensors, accessible by software, but resolution isn't great and long term stability is unknown.

This may be of interest. Single-channel version of the same ADC, 330k/20k input divider without any capacitors, IN- hard-wired to ground. Apparently firmware-calibrated for gain and offset, multiple units reported to achieve <0.1% accuracy at various input voltages in practice. Mine always shows 4.999 on my 5V±1mV reference, close enough. Of course only good for zero ohm sources, anything else adds to the 330k resistor and throws factory calibration out of whack.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Voltage divider question, what R to use
« Reply #11 on: February 20, 2019, 11:29:49 am »
Run the signal through an op amp voltage follower.  This will preserve the voltage and lower the source impedance headed toward the ADC.
How well does this actually work in real life?

The output impedance of the op-amp will be non-zero, rising at higher frequencies, which is important as the ADC will draw a current spike when a sample is taken. I suspect the ADC will effectively see the op-amp's open loop output impedance, which will be much lower than the potential divider, but still not zero.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9963
  • Country: us
Re: Voltage divider question, what R to use
« Reply #12 on: February 20, 2019, 04:02:23 pm »
Run the signal through an op amp voltage follower.  This will preserve the voltage and lower the source impedance headed toward the ADC.
How well does this actually work in real life?

The output impedance of the op-amp will be non-zero, rising at higher frequencies, which is important as the ADC will draw a current spike when a sample is taken. I suspect the ADC will effectively see the op-amp's open loop output impedance, which will be much lower than the potential divider, but still not zero.

I suspect is works very well as the output impedance will be on the order of a few Ohms.  There's no realistic way to get that low with divider resistors.  Measuring 10V on a 5V ADC with a driving impedance of 10 Ohms takes 20 Ohm resistors for the dividers.  10V / 40 Ohms = 0.25 Amps and 2.5 Watts.  Not a very realistic divider.

The objective is to measure DC voltages that are likely to be well filtered.  If so, we're not concerned about the response up in the MHz range.

I know there are quad op amps in DIP 14 but that is pretty large.  There may be something in a smaller package, I haven't looked.  Of course you still have the divider resistors but they can be pretty small and values would probably be in the few kOhm range.  No appreciable heating so very small SMDs can be used.

Still, the OP has already stated that op amps aren't viable so the question is how to get a low impedance divider and what 'low impedance' is in numbers.  I would think the resistors would want to be in the high hundreds or low thousands of Ohms.  Since the discussion is around DC volts, a storage capacitor on the input pin will be a big help but it would have to have fairly low (and constant) leakage as it is in parallel with the lower resistor of the divider.

Where the op amp solution really shines is when you want to expand the scale around some value.  We may want to measure 12V but we're really only interested in, say, 11V to 13V - a 2V range.  And we want to use a 3.3V ADC.  The scale and offset approach can be done with a single supply op amp and 4 resistors.  We needed 2 resistors anyway but if we can sneak 2 more onto the board, we can increase resolution considerably.
Chapter 4 of "Op Amps For Everyone" - free, check Google.

FWIW, some uC ADCs spec a 2k driving impedance and a lot of people have been caught on this.  It's pretty low.

What is more interesting is that the datasheet says to put a 10 ufd Tantalum at the package along with the ever popular 0.1 ufd ceramic.
 

Offline lpaseenTopic starter

  • Contributor
  • Posts: 18
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #13 on: February 22, 2019, 03:50:12 pm »
Again thanks for all insights.
op-amp, besides space issue it is other issues also. Did take a very quick look at lm324 and started to wonder how to get say 0.2V out of it or negative voltages. While the measurement is to be done on a motherboard the requirement is to be able to measure differences and not all against ground. If I put an op-amp I would have to add a pile of more components to handle -5v or diff between say +5 and +3.3V.

At the moment adding a cap looks most promising, just have to figure out what value to use so back to the breadboard.
 

Offline lpaseenTopic starter

  • Contributor
  • Posts: 18
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #14 on: February 27, 2019, 06:19:01 am »
Done some testing and adding a 1nF cap seems to do the trick. Attached 3 pics with no cap, 0.1nF and 1nF as measured over the cap/lower resistor.
I see a dip of >50mV at about 150kHz when not using any cap, guess that's from when it takes a measurement. 0.1nF improves it but it's still a little left, 1nF and it's all gone.
Since I will read power rail values at 3 samples per second I don't see an issue with putting a cap there.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Voltage divider question, what R to use
« Reply #15 on: February 27, 2019, 07:22:14 am »
Try with 100nF ceramic (when not operating in high vibrations environment). With 3 samples per second you may go with higher capacitance at the input.
Readers discretion is advised..
 

Offline lpaseenTopic starter

  • Contributor
  • Posts: 18
  • Country: ca
Re: Voltage divider question, what R to use
« Reply #16 on: February 27, 2019, 07:18:48 pm »
Tried with 100nF (=0.1uF) and also 10uF, not much of a difference.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf