3
\$\begingroup\$

I know what an Arduino's ADC generates a number with 10 bits of resolution (0 to 1023). How is this number generated? Is there a minimum and maximum voltage it will assign 0 and 1023 to, respectively?

I'm taking input from an amplified electret microphone.
Also, when I give the Arduino input, the value is not 0 when I'm not making noise in the mic. Sometimes is around 500, sometimes around 300, it changes. What could be the reason for this?

asked Jul 9, 2011 at 8:38
\$\endgroup\$
2
  • 2
    \$\begingroup\$ I suggest you read the chapter on the ADC in the datasheet of the controller of your Arduino. \$\endgroup\$ Commented Jul 9, 2011 at 11:59
  • \$\begingroup\$ Got it thanks! Its 0 to 5 volts (corresponding to 0 to 1023) for anyone who was wondering as well. \$\endgroup\$ Commented Jul 10, 2011 at 1:28

1 Answer 1

5
\$\begingroup\$

Most microcontroller ADCs have a pin for the positive ADC reference voltage, and some will also have one for the negative reference. Those that don't will use ground as the lower reference. Then the ADC's reading is \$\dfrac{V_{IN} - V_{REF-}}{V_{REF+} - V_{REF-}} \times Maximum\ reading\$. If Maximum Reading is 1023, then \$V_{IN} = V_{REF-}\$ will give you 0, and \$V_{IN} = V_{REF+}\$ will result in a 1023 reading.

As for the unexpected values you see, check this answer.

answered Jul 9, 2011 at 8:45
\$\endgroup\$
2
  • \$\begingroup\$ Whether the AREF pin is used depends on how the ADC is configured. ATmega controllers can also use the analog power supply AVCC or an internal bandgap reference of 1.1V. \$\endgroup\$ Commented Jul 9, 2011 at 11:57
  • \$\begingroup\$ Thanks steven, this explains how it works, and I found the answer in the arduino reference site \$\endgroup\$ Commented Jul 10, 2011 at 1:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.