Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Codeblack

Member Since 14 Jul 2011
Offline Last Active Mar 09 2012 01:08 PM
-----

Topics I've Started

ADC value divide by 1024 or 1023

27 July 2011 - 09:56 PM

Hi all,

I'm using an ADC port to measure voltage (of a solar charged battery). I use the standard 3.3V Aref and the default 0-1023 range. With a voltage divider (5k6 + 30k) I'm able to measure just over 20V.

Logic tells me (as well as some examples I found) I should calculate the actual voltage by dividing by the number of steps (float actualVoltage = (float)adcValue / 1024 * 3.3). Except it doesn't match the voltage I'm measuring with my DVM. If I use 1023 (float actualVoltage = (float)adcValue / 1023 * 3.3) the voltages match perfectly. I first missed the mismatch when measuring the voltage directly at the port, since it's much smaller there. At the solarpanel/battery the difference is more noticeable.

Now, simplifying the problem, connecting the ADC port directly to 3.3V gives me 3.2968 when dividing by 1024 and exactly 3.3000 when dividing by 1023.

Can anyone tell me, what the logic is behind this? Or am I missing the logic here completely? Thanks in advance!

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.