4

I'm using ATMEGA16U4 microcontroller and want to Convert the 0 to 24V analog signal to 0 to 5V for ADC input.

I read this

How to read high voltages on microcontroller?

How to Convert 0 to 10V analog signal to 0 to 2.5V for ADC input?

ADC input impedance on MCUs

and I'm using R1 =4.7K ohm and R2=1.2 Kohm which makes my output impedance R1||R2= 0.95Kohm which satisfies my ADC output impedance of approximately 10 kΩ or less( as mentioned in the datasheet of ATMEGA16U4 datasheet).

Am I right or do I need to change them?

VarshaReDDy
  • 41
  • 1
  • 2
  • See similar question: [ADC: Need to convert 10V-32V(from battery 0-32V) range to 0-5V](http://electronics.stackexchange.com/questions/53436/adc-need-to-convert-10v-32vfrom-battery-0-32v-range-to-0-5v) – Phil Frost Jan 09 '13 at 22:27

2 Answers2

2

Sounds right to me. I calculate that a 24V input will result in a 4.88V output. But since you are asking, I'm assuming this isn't what's actually happening. Is the voltage you are trying to measure provided by a low-impedance source? Otherwise, you will have to include that impedance as part of R1, or buffer the signal with an op-amp or such.

Phil Frost
  • 56,804
  • 17
  • 141
  • 262
  • The voltage I am trying to measure is from a battery source of 24V. – VarshaReDDy Jan 09 '13 at 22:07
  • 2
    If it's a small battery and you don't want to run it down, you might be better off using higher-valued resistors (\$470k\Omega\$, \$210k\Omega\$ for example) and meeting the impedance requirement with a buffer. With the values you have selected, you are consuming about 0.1 watts in your resistors. – Phil Frost Jan 09 '13 at 22:11
  • Also, since it's a safe bet you are measuring battery voltage because you want to know how much capacity is remaining, you may want to instead research power management ICs. There are plenty available that will do a much better job of managing a battery, and they aren't very expensive. – Phil Frost Jan 09 '13 at 22:16
  • If a battery management IC doesn't meet your requirements, you might also consider a zener diode to drop a portion of the battery voltage -- most batteries don't really go from 0-24V, you'd probably be fine with 18-30V mapped to 0-5V. – HikeOnPast Jan 09 '13 at 22:25
1

Sounds right to me, but with a 1K output impedance and a 10K input impedance, you'll still have noticeable attenuation from the unconnected voltage divider, <10%. If this is acceptable for your needs, then nothing else is needed. If it's not, then you need to lower the output impedance of your divider (smaller resistors and higher current), or buffer with an op-amp voltage follower.

Alternatively count the 10K into your design, but if its important stuff you need to know how good the 10K number really is. does it mean 10K, or does it mean 8K-12K?

Scott Seidman
  • 29,274
  • 4
  • 44
  • 109
  • No, you've misunderstood that spec. 10K isn't the input impedance of the ADC, it the *maximum* allowed impedance of the source driving the ADC. The proposed divider exceeds that spec by a factor of 10. – Dave Tweed Jan 09 '13 at 23:51
  • Ohh sorry, then what should I consider as my ADC input impedance. – VarshaReDDy Jan 09 '13 at 23:57
  • I'm quite confused with this. – VarshaReDDy Jan 10 '13 at 00:18
  • @DaveTweed, you look right. The datasheet doesn't seem to reaaly spec Rin, which is odd. When the sheet says "optimized" for 10k or less,though, it looks like its talking about charge time. If I were do8ng something with tight specs, I'd run down Rin – Scott Seidman Jan 10 '13 at 01:02
  • You don't need Rin because in DC it is so huge that it does not really matter. You have constraints on the driving internal resistance for timing purposes instead... They could provide you Rin and Cin and you should have made the calculations to compute the timing, or they just tell you "no more than 10k please". That's easier. Warning: the latter Rin is the R in series with the hold capacitor. – Vladimir Cravero Jan 10 '13 at 07:24
  • Thanks and Can you suggest me about which combination to be used 1)R1=4.7Kohm and R2=1.2Kohm divider or should I use the 2)R1=430ohm and R2=110 ohm divider. – VarshaReDDy Jan 10 '13 at 09:39
  • I second the notion of a resistor divider and op-amp scaler/buffer/follower. If setup correctly, a rail-to-rail amp could output 0-5.00v, while having a very low output impedance and very high input impedance (allowing much larger value divider resistors, saving quiescent power.) – rdtsc Jul 02 '15 at 17:23
  • Of course, measuring battery level this way is only good when the battery is actually loaded. Most batteries read a higher voltage at no-load, since they all have internal resistance. – rdtsc Jul 02 '15 at 17:24