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
- 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.
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
- 10 bits divide the 5 V reference into 2¹⁰ = 1024 quantisation steps, so V ≈ reading × 5 V over 1024.
- V ≈ 410 × 5 V over 1024 = 2050 over 1024 ≈ 2.0 V
Answer: 2 V
Problem 2 of 10
analogRead(A1) gives 922 on a 5 V Arduino Uno. About what voltage is on A1?
Show the working
- V ≈ reading × 5 V over 1024
- V ≈ 922 × 5 V over 1024 = 4610 over 1024 ≈ 4.5 V
Answer: 4.5 V
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
- It divides 5 V into 2¹⁰ = 1024 steps.
- LSB = 5 V over 1024 ≈ 0.00488 V ≈ 4.88 mV. That's the smallest change it can resolve.
Answer: 4.88 mV
Problem 4 of 10
3 V sits on A0 of a 5 V Arduino Uno. What number does analogRead(A0) give?
Show the working
- reading = V × 1024 over 5 V, rounded down to a whole number.
- reading = 3 V × 1024 over 5 V = 614.4, which rounds down to 614
Answer: 614
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
- 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.
- reading = 1.599 V × 1024 over 5 V ≈ 327.4, which rounds down to 327
Answer: 327
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
- First the voltage on A0: V ≈ 640 × 5 V over 1024 = 3.125 V.
- The divider ratio is 1/3, so multiply by 3 to undo it.
- Battery ≈ 3.125 V × 3 ≈ 9.38 V
Answer: 9.38 V
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
- 12 bits make 2¹² = 4096 steps.
- LSB = 3.3 V over 4096 ≈ 0.000806 V ≈ 0.806 mV
Answer: 0.806 mV
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
- With 12 bits and 3.3 V, V ≈ reading × 3.3 V over 4096.
- V ≈ 3000 × 3.3 V over 4096 = 9900 over 4096 ≈ 2.42 V
Answer: 2.42 V
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
- Voltage first: V ≈ 153 × 5 V over 1024 ≈ 0.747 V = 747 mV.
- Subtract the 500 mV offset at 0 °C: 747 − 500 = 247 mV.
- At 10 mV per °C, T = 247 over 10 ≈ 24.7 °C
Answer: 24.7 °C
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
- The LSB size is 5 V over 2ⁿ, so 2ⁿ must be more than 5 V over 0.001 V = 5000.
- 12 bits give 4096 steps of about 1.22 mV: not enough.
- 13 bits give 8192 steps of about 0.61 mV, so 13 bits.
Answer: 13
“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.
“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 neededCheck it with a calculator
The ideas behind it
- How Arduino analogRead worksHow analogRead turns 0–5 V into 0–1023, and how to scale it for analogWrite.
- How to measure a voltage with an ArduinoFrom analogRead's count to volts you can trust: the conversion, a divider for high voltages and the reference.
- How to measure a 12 V battery with a voltage dividerScale 12 V down to 4 V for a meter or a microcontroller, without discharging the battery.
- Voltage divider explainedTwo resistors that split a voltage: the formula, potentiometers, and why a load pulls the output down.
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
- Ohm's law practice problemsFind V, I or R, then the power, with the working for each.
- Units and prefixes practice problemsConvert mA, kΩ, µF, nF, pF, ms and mV, with the working for each.
- LED resistor practice problemsSize the resistor for one LED or a string, round to a standard value, check the power.
- Electrical power practice problemsPower three ways, energy in kWh, battery life and running costs, all worked.
- Series and parallel resistors practice problemsTotals in series and parallel, mixed networks and branch currents, all worked.
- Kirchhoff's laws practice problemsBalance currents at a junction and voltages round a loop, with the working for each.
- Voltage divider practice problemsFind Vout, pick R2 for a target and work out loading, with the working for each.
- Thevenin and Norton equivalent practice problemsReduce a network to V_th in series with R_th, then load it, with the working.
- Capacitor practice problemsCharge, capacitance, series and parallel, and stored energy, with the working.
- RC time constant practice problemsτ = R × C, the 63% rule, charging and discharging, with the working.
- Inductor practice problemsV = L × ΔI ÷ Δt, stored energy and inductors in series and parallel, with the working.
- RL circuit time constant practice problemsτ = L ÷ R, the current's rise and decay, and inductive kickback, with the working.
- AC voltage and transformer practice problemsPeak, RMS, period, AC power and transformer turns ratios, with the working.
- Capacitive and inductive reactance practice problemsCapacitive and inductive reactance, AC current and impedance, with the working.
- Impedance practice problems for RC and RL circuitsSeries RC and RL impedance, phase angle and current, with the working.
- RC filter practice problemsCutoff frequency, choosing R or C, and the output either side of the cutoff, with the working.
- Decibel practice problemsRatios to dB and back, for power and voltage, gains that add and the −3 dB point.
- LC resonance practice problemsf₀ = 1 ÷ (2π√(LC)), tuning for a frequency, and scaling, with the working.
- Diode practice problemsForward voltage, series resistor current, diodes in series, reverse bias and power dissipation.
- Rectifier and ripple practice problemsPeak output, ripple and the smoothing capacitor for half-wave and bridge rectifiers.
- Zener diode practice problemsSize a Zener regulator's resistor, split its current and check the Zener's power.
- Transistor switch practice problemsBase current, base resistor and load current for a BJT switch, then a MOSFET.
- MOSFET switch practice problemsConduction loss from R_DS(on), gate and pull-down currents, flyback diodes and junction temperature.
- Op-amp gain practice problemsInverting and non-inverting gain, the output, the resistor to pick and when it clips.
- Inverting and summing amplifier practice problemsInverting gain, input resistance, summing amps, averaging, a simple DAC and clipping.
- Schmitt trigger and hysteresis practice problemsHysteresis band, both thresholds and the feedback resistor for a comparator.
- Op-amp limits practice problemsGain-bandwidth, slew rate, output swing and input offset, with the working.
- Binary and hex practice problemsBinary to decimal and back, bits needed, the largest n-bit number and hex.
- Logic gates practice problemsGate outputs, truth-table rows, Boolean expressions and fewer gates, with the working.
- Counters and flip-flops practice problemsTop count, flip-flops needed, frequency division, rollover and ripple delay.
- PWM and duty cycle practice problemsDuty cycle, average voltage, on-time, analogWrite 0–255 and power, with the working.