Resolution with AVcc
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
Resolution with AVcc
To improve resolution of my IR range sensor by a factor of 2, I want to reduce the AVcc reference-voltage from 5V to 2.5V. I have plenty of resistors and diodes. I plan to use diodes in series and leverage their constant voltage drop. The constant drop only works if the through-power is constant. I'm assuming the reference-voltage pin (AVcc) does not draw significant power regardless of the project circuit. Is this true? Or am I better off with a resistor voltage divider? Appreciate your comments.
Re: Resolution with AVcc
The forward voltage of a diode varies (slightly) with current and temperature. A better option may be to use a voltage reference, e.g. Digi-Key p/n MCP1525-I/TO-ND, a 2.5V reference. Depending on the range of voltages you need to measure, it may be convenient to use a 2.048V reference. With that reference, each increment of ADC value would equal exactly 2mV.liam.zbasic wrote:I plan to use diodes in series and leverage their constant voltage drop.
Another option is to use the internal 2.56V reference. If you choose this option, keep in mind that it is not exact. The datasheet indicates the range is 2.4V to 2.8V so you would need to measure it and use a calibration constant.
The analog reference is actually Aref (pin 32 on a ZX-40), not AVcc. The datasheet indicates that it has a typical input resistance of 32K ohms.liam.zbasic wrote:I'm assuming the reference-voltage pin (AVcc) does not draw significant power regardless of the project circuit.
Note that AVcc should be kept at 5V even if you use a lower Aref voltage.
- Don Kinzer
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
Thanks for that tip Don. Didn't know voltage-reference devices exist.
My sensor varies from 0 to 2.5V. Realistically however, my project will only produce values from say 2.0 to 2.5V. Question... if I set the Aref to 2.5V and set the GetADC() offset to 2.0V, will GetADC yield 10-bit resolution between 2.0-to-2.5V, or will it only yield 205 counts (less than 8-bit)?
My sensor varies from 0 to 2.5V. Realistically however, my project will only produce values from say 2.0 to 2.5V. Question... if I set the Aref to 2.5V and set the GetADC() offset to 2.0V, will GetADC yield 10-bit resolution between 2.0-to-2.5V, or will it only yield 205 counts (less than 8-bit)?
The ADC in a mega-based device always yields a 10-bit result with zero representing zero volts and &H400 (10 bits plus 1) representing the reference voltage. With a 2.5V reference, the ADC resolution is 2.5V/1024 counts = 2.44mV/count. Consequently, the expected range of values with an input varying from 2.0 to 2.5V will be 819 to 1023.liam.zbasic wrote:f I set the Aref to 2.5V and set the GetADC() offset to 2.0V, will GetADC yield 10-bit resolution between 2.0-to-2.5V, or will it only yield 205 counts (less than 8-bit)?
The newly added offset parameter for GetADC is applied to the result produced by the ADC before the value is returned. It is intended to be used to adjust the ADC result so that zero is returned with zero volts applied. The offset voltage of the ADC varies from device to device and may vary with temperature. You can determine the offset voltage of your ADC by grounding an analog input and invoking GetADC() for that pin. If a non-zero value is returned, the negative of that value can be passed to subsequent invocations of GetADC() to null out the offset. If you're going to use this feature, it is probably best to take a number of readings of the grounded input and average them to arrive at a useful offset value.
- Don Kinzer
Two methods to increase sensor signal resolution are offset amplification, and signal processing. The first requires additional hardware - usually, at minimum, an opamp and surrounding passive components - while the latter requires time. The first works best if the signal is noise-free, while the latter requires some noise to dither the LSb.liam.zbasic wrote:... Realistically however, my project will only produce values from say 2.0 to 2.5V...
The simplest method, assuming a signal with at least 0.5bit of white noise, is averaging. Using averaging to improve resolution is an attempt to extract signal below the noise level or to interpolate data inside one bit. Averaging takes time so the signal bandwidth (how quickly the device can respond to a change) is reduced. To statistically double the resolution, i.e. to add one bit of resolution, four samples are required (the square of the resolution improvement), so the process slows by a factor of four and the bandwidth of the signal is quartered; a two-bit improvement (four times resolution) requires 16 samples and is correspondingly slowed. Resolution improvements become rapidly more costly in time - and the result becomes increasingly untrustworthy as the qualities of the noise become more dominant. More sophisticated signal filtering methods are available, too, but they are not trivial.
An opamp can be used to both subtract an offset and add gain to redistribute the signal dynamic range over the available ADC range. In your case, you can subtract 2VDC from the analog signal and multiply the maximum-signal difference (0.5VDC) by 5.0/0.5= 10.0 (the gain) to feed a 5v-reference ADC. The best result you can achieve with a 10-bit ADC with a 5v reference and a 2.0-2.5v signal range, then, is a 10x resolution improvement, a little more than three bits. That would be the equivalent of a 100-sample average if the noise were white. Signal noise is also increased by the gain, though, so a noisy signal might not be improved. Simple DC opamp circuits can suffer from instabilities, like temperature sensitivity, that limit the accuracy of the solution so a proper design could be involved.
You might find that some combination of hardware offset/gain and averaging will produce the best result, but if you need more resolution than a few additional bits, an external ADC is probably required.
Tom