Skip to content

Practice problems

ADC and analog input practice problems

An Arduino can't read a voltage directly: its analog-to-digital converter (ADC) quantises the voltage on a pin into a whole number, a digital code. These ten problems turn analogRead values into volts and back, find the resolution (LSB size), read sensors and batteries through a divider, and move on to 12-bit ADCs. Type your answer to check it, and open the working whenever you want it.

The method

V ≈ reading × 5 V over 1024, reading = V × 1024 over 5 V
  • An Arduino Uno's ADC has 10 bits: 210 = 1024 steps over 0–5 V, read as 0 to 1023
  • Resolution: one LSB is Vref ÷ 1024 = 5 V ÷ 1024 ≈ 4.88 mV, the smallest change it can resolve
  • Going to a reading, round down to a whole number
  • An n-bit ADC has 2n steps: swap in 4096 and its reference voltage Vref for a 12-bit one
  • Through a divider, find the pin's voltage first, then undo the divider

The problems

Type your answer and tap Check. Every one has the working, step by step.

  1. Problem 1 of 10

    An Arduino Uno's analogRead(A0) gives 410. Its ADC is 10-bit with a 5 V reference. About what voltage is on A0?

    Show the working
    1. 10 bits divide the 5 V reference into 2¹⁰ = 1024 quantisation steps, so V ≈ reading × 5 V over 1024.
    2. V ≈ 410 × 5 V over 1024 = 2050 over 1024 ≈ 2.0 V

    Answer: 2 V

  2. Problem 2 of 10

    analogRead(A1) gives 922 on a 5 V Arduino Uno. About what voltage is on A1?

    Show the working
    1. V ≈ reading × 5 V over 1024
    2. V ≈ 922 × 5 V over 1024 = 4610 over 1024 ≈ 4.5 V

    Answer: 4.5 V

  3. Problem 3 of 10

    A 10-bit ADC has a 5 V reference voltage. What is its resolution (the LSB size, one step), in millivolts?

    Show the working
    1. It divides 5 V into 2¹⁰ = 1024 steps.
    2. LSB = 5 V over 1024 ≈ 0.00488 V ≈ 4.88 mV. That's the smallest change it can resolve.

    Answer: 4.88 mV

  4. Problem 4 of 10

    3 V sits on A0 of a 5 V Arduino Uno. What number does analogRead(A0) give?

    Show the working
    1. reading = V × 1024 over 5 V, rounded down to a whole number.
    2. reading = 3 V × 1024 over 5 V = 614.4, which rounds down to 614

    Answer: 614

  5. Problem 5 of 10

    A 10 kΩ resistor runs from 5 V to A0, and a 4.7 kΩ resistor from A0 to ground. What does analogRead(A0) give on an Arduino Uno?

    Show the working
    1. The divider gives V = 5 V × 4.7 kΩ over 10 kΩ + 4.7 kΩ = 5 V × 4.7 over 14.7 ≈ 1.599 V.
    2. reading = 1.599 V × 1024 over 5 V ≈ 327.4, which rounds down to 327

    Answer: 327

  6. Problem 6 of 10

    A battery monitor feeds A0 through a voltage divider with a ratio of 1/3: the pin sees a third of the battery voltage. analogRead(A0) gives 640 on an Arduino Uno. What is the battery voltage?

    Show the working
    1. First the voltage on A0: V ≈ 640 × 5 V over 1024 = 3.125 V.
    2. The divider ratio is 1/3, so multiply by 3 to undo it.
    3. Battery ≈ 3.125 V × 3 ≈ 9.38 V

    Answer: 9.38 V

  7. Problem 7 of 10

    A 12-bit ADC has a 3.3 V reference voltage. What is its LSB size, in millivolts?

    Show the working
    1. 12 bits make 2¹² = 4096 steps.
    2. LSB = 3.3 V over 4096 ≈ 0.000806 V ≈ 0.806 mV

    Answer: 0.806 mV

  8. Problem 8 of 10

    A board with a 12-bit ADC and a 3.3 V reference reads 3000. About what voltage is on the pin?

    Show the working
    1. With 12 bits and 3.3 V, V ≈ reading × 3.3 V over 4096.
    2. V ≈ 3000 × 3.3 V over 4096 = 9900 over 4096 ≈ 2.42 V

    Answer: 2.42 V

  9. Problem 9 of 10

    Stretch: a temperature sensor outputs 500 mV at 0 °C, with a sensitivity of 10 mV/°C. On a 5 V Arduino Uno, analogRead gives 153. What is the temperature?

    Show the working
    1. Voltage first: V ≈ 153 × 5 V over 1024 ≈ 0.747 V = 747 mV.
    2. Subtract the 500 mV offset at 0 °C: 747 − 500 = 247 mV.
    3. At 10 mV per °C, T = 247 over 10 ≈ 24.7 °C

    Answer: 24.7 °C

  10. Problem 10 of 10

    Stretch: with a 5 V reference, what is the fewest bits an ADC needs for an LSB size smaller than 1 mV?

    Show the working
    1. The LSB size is 5 V over 2ⁿ, so 2ⁿ must be more than 5 V over 0.001 V = 5000.
    2. 12 bits give 4096 steps of about 1.22 mV: not enough.
    3. 13 bits give 8192 steps of about 0.61 mV, so 13 bits.

    Answer: 13

Build it in a free lesson

“Analog input” is lesson 6 of 6 in The Core, Electronics World 8. Free with an account. Lessons unlock in order, so you’ll do the 54 before it first.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Analog input” is lesson 6 of 6 in The Core, Electronics World 8. Free with an account. Lessons unlock in order, so you’ll do the 54 before it first.

Or start from the very first lesson, no account needed

Check it with a calculator

The ideas behind it

Questions people ask

Do I divide by 1023 or 1024?

A 10-bit ADC divides its reference voltage into 1024 equal steps, so the exact conversion is V ≈ reading × 5 ÷ 1024. The readings run from 0 to 1023, so dividing by 1023 is also common. The two differ by about 0.1%, at most one step.

How do I measure more than 5 V with an Arduino?

Put a voltage divider in front of the pin so it never sees more than 5 V. Read the pin, convert the reading to volts, then undo the divider. A divider ratio of 1/3 lets you read up to 15 V, and you multiply the pin's voltage by 3.

What does a 12-bit ADC change?

More bits mean finer resolution, not a bigger input range. A 12-bit ADC divides its reference voltage into 4096 steps instead of 1024. With 3.3 V that's about 0.81 mV per step, and readings run from 0 to 4095.

More practice