TactivergeLite

Lite / Intelligent Robotic Systems / Week 19

Range, resolution and the bits behind them

A 10-bit and a 16-bit sensor both measure 0–5 V. One sees changes 64 times smaller. Does that make it 64 times more accurate?

About 35 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

Every robot spec sheet lists range and resolution first, because they decide what a sensor can possibly see. Pick the range too small and the reading sticks at its limit exactly when it matters; pick too few bits and small changes vanish between steps. Engineers check both before they write a line of code.

Predict

An 8-bit converter spans 0–5 V. Roughly how small a change in voltage can it notice?

  1. About 5 mV
  2. About 20 mV
  3. About 0.6 V
Guess first, then reveal

8 bits give 2⁸ = 256 codes, so each step is 5 V ÷ 256 ≈ 19.5 mV. Any change smaller than that can be invisible: the code simply does not move.

Discover

Start at 4 bits and slide the true input slowly: the reading jumps in steps. Raise the bits and watch the staircase shrink. Then push the input past the top of the range, and finally add bow. Which problems do extra bits fix, and which don't they touch?

What the interactive shows (text version)

The diagram plots the reported voltage against the true input as a staircase. With 4 bits the steps are 0.31 V tall on a 5 V range; with 12 bits they are 1.2 mV and the staircase looks like a straight line. Inputs above the top of the range all read the maximum code (saturation). Adding bow curves the staircase away from the straight line by up to bow × range ÷ 4, an error extra bits cannot remove.

You can also open the interactive on the full site when you have a faster connection.

Understand

Range: what it can see at all

The range is the span of inputs a sensor reports faithfully, for example 0–5 V or 2–400 cm. Outside it the output saturates: it sticks at the end value. A saturated reading is the most dangerous kind, because it looks like a normal number. Choose a range that covers the largest value you could meet, with some margin.

Resolution: the smallest step

A converter with n bits has 2ⁿ codes. Spread over the range, each step is range ÷ 2ⁿ wide (some datasheets divide by 2ⁿ − 1; the difference is tiny for large n). A 12-bit converter on 0–3.3 V has steps of 3.3 ÷ 4096 ≈ 0.81 mV. Every reading carries an extra uncertainty of up to one step, called quantisation error.

Resolution is not accuracy

Resolution says how finely the sensor divides the range. Accuracy says how close the reported value is to the truth. A sensor with a gain error, an offset or a bow in its response can report confidently in tiny steps and still be wrong by a lot. Extra bits help only when quantisation is the biggest error.

Reading a spec line

'Range 0–40 °C, resolution 0.01 °C, accuracy ±0.5 °C' tells you the readings move in hundredths but can be half a degree off. For a greenhouse that is fine; for a medical thermometer it is not. Always ask which number limits your task.

Explain it another way

Intuitive

A ruler marked only in centimetres can't tell 3.2 cm from 3.4 cm: that is resolution. A ruler printed slightly stretched gives tidy millimetre marks that are all a bit wrong: that is accuracy.

Technical

An ideal n-bit ADC with full-scale range FSR maps an input to code ⌊V·2ⁿ/FSR⌋, clipped to 0…2ⁿ − 1. One LSB = FSR/2ⁿ; quantisation error is uniform over one LSB, with standard deviation LSB/√12 when the signal is busy enough.

Mathematical

Bits needed for a step no bigger than Δ over range R: 2ⁿ ≥ R/Δ, so n = ⌈log₂(R/Δ)⌉. For R = 5 V and Δ = 1 mV: log₂(5000) ≈ 12.3, so 13 bits.

Applied

Microcontrollers commonly have 10- or 12-bit ADCs. Designers often scale a small sensor signal with an amplifier so it fills the converter's range: a 0–0.5 V signal on a 0–5 V converter wastes over 90% of the codes.

Worked example 1

A 10-bit ADC spans 0–3.3 V. What is one step, and what code does 1.00 V give?

Step = 3.3 ÷ 1024 ≈ 3.22 mV. Code = ⌊1.00 ÷ 0.003223⌋ = ⌊310.3⌋ = 310, which means 310 × 3.22 mV ≈ 0.999 V.

Worked example 2

A load cell's amplifier outputs 0–2 V and you want 0.1 mV steps. How many bits?

2 V ÷ 0.1 mV = 20,000 steps. 2¹⁴ = 16,384 is too few; 2¹⁵ = 32,768 is enough. You need 15 bits, so in practice a 16-bit converter.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

Practice 1. A distance sensor's range is 2–80 cm. A wall is 120 cm away. What will it most likely report?

mV

Practice 4. A sensor has a ±2% gain error. Upgrading its converter from 10 to 16 bits will…

codes

Apply it

Pick a sensor for a line-following robot's distance check (obstacles from 5 cm to 1.5 m, needed to the nearest centimetre). Write the range and resolution you need, the bits required if the sensor outputs 0–3.3 V linearly, and one thing the spec must also tell you about accuracy.

Reflect

Describe a situation where a sensor's resolution is excellent but its readings are still useless for the task.

Write your answer on paper or in your own notes. Lite never stores what you write.

← Error across the workspace: running and reporting the studyAccurate, precise, both or neither →