1
\$\begingroup\$

This question already has an answer here:

I am building a simple voltmeter circuit that needs to measure up to about 35 volts. Looking around the web, I am finding all sorts of suggestions for voltage divider values, like 1 Mohm / 10 Kohm, and the one I am currently experimenting with, which is 10K/2K. I am having issues with allowing enough time between readings for the Arduino Nano to settle down, of course, but that is not the question. Using 10K/2K it maxes out at a reading of 1020 on A6 with an input of 27 volts.

I do not understand why one posting says to use resisters in the Mohm range and the other (that I am using) is a total of 12k.

Question: Is there a rule of thumb that should be used to decide what resistances should be used for the divider for measuring this level of voltage?

And how important might it be to keep the resistance between Vcc and GND higher than what I am using?

-- EDIT: EE asked me if this was the same as another suggested Q/A - and this is only different because it is specific to the Arduino's ADC input impedance. The other answer only talked about the ratios.

The answers to this are great for my particular application.

--FURTHER EDIT: Based on the collective berating from the powers that be, I would mention that this started in an Arduino forum where I was concerned about the particular ADC, then it got moved here. Calling this a duplicate is incorrect. It is very specific to the Nano application. I wanted to make sure my small values wouldn't cause problems by being between Vcc and GND. Plus, I did not know the proper input impedance for the Nano's ADC. It all got answered here, nicely.

Thus I believe it stands as being unique here. I can find no duplicates of this particular question. Being marked this way with no explanation is frustrating. If there really are duplicates then I would like to see their answers. But finding none, this one adds to the community and I believe it should not be marked as a duplicate here.

And the good thing is that one respondent brought up smoothing capacitors. So now I am using one, and it helps stabilize the readings. So this has been a positive experience.

The problem now is that Arduino people won't necessarily know to look here for this answer when they try to use their Arduinos this way. So there will likely be duplicate questions there which just got answered here.

\$\endgroup\$

marked as duplicate by Daniel Grillo, ThreePhaseEel, dim, Bence Kaulics, Voltage Spike Nov 28 '16 at 16:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from arduino.stackexchange.com Nov 25 '16 at 7:58

This question came from our site for developers of open-source hardware and software that is compatible with Arduino.

  • \$\begingroup\$ This is an Electronics SE question if ever I heard one. \$\endgroup\$ – Nick Gammon Nov 25 '16 at 7:58
  • \$\begingroup\$ Somewhat related: electronics.stackexchange.com/questions/107741/… \$\endgroup\$ – Wesley Lee Nov 25 '16 at 8:35
  • \$\begingroup\$ Thanks, @Gammon. Unfortunately, over here I can't upvote answers, but I have my answers. And the unspoken part of the answers is that I don't need to worry too much about having too little resistance between Vcc and GNC. Now I am curious about capacitors. I have a 2.2F 63V cap, which would smooth things out, and of course have much smaller values so I can filter out the switching noise. \$\endgroup\$ – SDsolar Nov 25 '16 at 17:00
  • \$\begingroup\$ 1) Duplicate questions are discouraged (and shutdown), so don't post in two places. 2) If you feel its in the wrong place then talk to an admin in the chat or post on the meta. Here are some other resources for posting: electronics.stackexchange.com/help/how-to-ask electronics.stackexchange.com/help/on-topic electronics.stackexchange.com/help/dont-ask \$\endgroup\$ – Voltage Spike Dec 2 '16 at 18:35
5
\$\begingroup\$

There are two things to consider:

  1. The ratio of values
  2. The input impedance of the ADC

Point 1 has hard and fast formulae. No rule of thumb here.

Point 2 is a little more "thumby". You want R2 (the lower resistor) to be low enough that the input impedance of the ADC doesn't skew the readings much, yet large enough that you dont get excessive current draw through the divider. As a rule of thumb I work to a 10% rule. R2 should be no more than 10% of the input impedance. That means for an ADC with 1M input impedance you are looking at an absolute maximum of 100K for R2. Anything more and you start to see bad drift. Better is to go lower, but you don't want to go too low. 10K is a good value. Only 1% of the input impedance yet high enough to not waste current.

TO get more specific refer to the datasgeet.

The ADC on the ATMega328P is:

... optimized for analog signals with an output impedance of approximately 10 kΩ or less. If such a source is used, the sampling time will be negligible.

The output impedance of a voltage divider is basically the two resistors in parallel \$(\frac{R1 \times R2}{R1 + R2})\$, but if R2 is considerably smaller than R1 then it will be approximately R2, so about 10KΩ is the maximum the ADC likes to have as R2, though it can be higher if R1 allows the impedance to drop to 10KΩ.

For instance, if you have your example of 1MΩ / 10KΩ, the impedance is \$\frac{10,000,000 \times 10,000}{10,000,000 + 10,000} = 9990\Omega\$ which is about right for the ADC.

\$\endgroup\$
  • \$\begingroup\$ Excellent, @Majenko. You hit the precise points of what I needed to know. Thank you for writing it all out. I will work on this today. \$\endgroup\$ – SDsolar Nov 25 '16 at 16:51
  • \$\begingroup\$ Looks like 1M/200K will be the best solution. I am a bit limited on the high end but that's OK.. The target voltage is under 27 Volts. Thanks again. \$\endgroup\$ – SDsolar Nov 26 '16 at 16:13
  • \$\begingroup\$ OK, so now I am using 1M/200K with a 10 uF electrolytic. It has settled down a lot. I think I found the sweet spot for the measurements, and from your explanation, I am not going to cause any problems by having 1.2M between Vcc and GND. Thanks again. \$\endgroup\$ – SDsolar Dec 2 '16 at 4:21
0
\$\begingroup\$

The ratio is whatever you need it to be to give the division you want.

The absolute values it depends on your application.

Your ADC input should have an effective resistance of 10+Mohms. You need the resistor in the lower half of your divider to be small in comparison to this otherwise the ADC input impedance is going to have a noticeable impact on the voltage you are measuring. If you aim for at least a factor of 100 smaller then the error will be under 1% and probably unimportant. So that gives an upper limit on the resistor to ground of about 100k.

What if you go the other way, what if you used tiny resistors? The current flow through the divider is going to be large. No danger of the ADC impacting the voltage you are measuring but you could well be pulling so much power that the 27V you are trying to measure is pulled down. Generally you want to pull as little current as possible from the thing you are measuring so that your measurement system doesn't change the thing it's trying to measure. This means as large a resistor as possible.

So as a general rule, assuming a half decent ADC 10k-100k for the lower resistor to the divider and then set the upper value to give the correct ratio. If the thing you are measuring can easily supply a lot of power (e.g. a power supply) then go a little lower.

If you have an electrically noisy environment then lower values will help reduce noise. Adding a capacitor from the ADC input to ground will also reduce noise but will reduce you ability to track rapid changes.

\$\endgroup\$
  • \$\begingroup\$ Thank you, @Andrew. I have been thinking about the capacitor idea. I am measuring solar panels feeding a PWM charge controller, so there is a lot of switching because it often feeds higher voltages than can be used all at once. \$\endgroup\$ – SDsolar Nov 25 '16 at 16:56
  • \$\begingroup\$ This is voltage coming from a set of solar panels into a PWM charge controller, so I don't much care about rapid changes. But in looking in the box-o-stuff I see I have some 2.2F 63V supercaps and some 10uF electrolytics. My initial thought is to use one of each for smoothing and low-pass filtering. Any thoughts on the subject? \$\endgroup\$ – SDsolar Nov 26 '16 at 15:38
  • \$\begingroup\$ OK, so now I am using 1M/200K with a 10 uF electrolytic. It has settled down a lot. I think I found the sweet spot. \$\endgroup\$ – SDsolar Dec 2 '16 at 4:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.