Skip to content
You Start with one site
Amounts in Start with one site
Sensors & Actuators · Concept

ADC and sampling

One idea Beginner 5 min read
Found this useful?

A ruler marked only in whole centimetres reads 4 for a length of 4.2 cm and also for 4.4 cm. It cannot tell them apart. An ADC (analog to digital converter) is that ruler for voltage: it divides a voltage range into equal steps and gives the number of the step that the input falls in.

The sensorTurns level, temperature or pressure into a voltage.Any value in a range
The ADCDivides the range into equal steps and reports which step.A whole number
The costEverything inside one step looks the same.Step = range ÷ number of steps

See it

Predict first

An ADC with only 3 bits measures 0 to 3.3 V. The input is 1.00 V and the ADC gives the number 2. The input rises to 1.20 V. What number does the ADC give now?

See it: a voltage goes in, a step number comes out

Size of one step
Number the ADC gives
Voltage that number stands for

The shaded band is every input voltage that gives the same number. The ADC cannot tell those voltages apart. Each added bit doubles the number of steps and halves the band. At 12 bits the steps are too small to draw, and the staircase looks like a straight line.

The idea

The number of steps is set by the number of bits, the binary digits in the result. Each bit doubles the count: 3 bits give 8 steps, 10 bits give 1,024, 12 bits give 4,096. The top of the range is set by the reference voltage, often the supply of the chip.

step = Vref ÷ 2N

Vref is the reference voltage, N is the number of bits, and 2N is the number of steps

The size of one step is the resolution: the smallest change the ADC can show. The number it gives is the input voltage divided by the step, with the fraction dropped.

The ADC also divides time into steps. It measures at single moments, called samples, and it knows nothing about the input between two of them. The samples must come much faster than the signal changes, at the very least twice in each cycle of the fastest change you care about.

One worked number

The question

A 12 bit ADC has a reference of 3.3 V. What is the size of one step, and what number does it give for a sensor voltage of 1.65 V?

Show the worked solution, 3 steps
  1. Count the steps

    12 bits give 212 = 4,096 steps, numbered 0 to 4,095.

  2. Find the size of one step

    step = 3.3 V ÷ 4,096 = 0.000806 V, which is 0.806 mV.

  3. Divide the input by the step

    1.65 V ÷ 0.000806 V = 2,048, half of the range, as expected for half of 3.3 V. Check it in the figure: set 12 bits and 1.65 V.

The mistake to avoid

More bits do not make a measurement more correct. Bits set how fine the steps are. They do not make the ruler itself right. If the reference is really 3.25 V and the program assumes 3.3 V, every reading is wrong by 1.5%, with 10 bits or with 16. And if the sensor cable carries 20 mV of noise, finer steps only show the noise in more detail.

A second trap is a signal that uses only a small part of the range. A sensor that moves between 0 and 0.33 V on a 3.3 V, 12 bit ADC uses only about 410 of the 4,096 steps. Such a signal is made larger with an amplifier before it reaches the ADC.

Check yourself

Question 1

A 10 bit ADC has a reference of 5 V. What is the size of one step?

Question 2

A temperature reading moves up and down by 20 mV because of noise on a long cable. The 10 bit ADC is replaced with a 16 bit one. What happens to the reading?

Question 3

The temperature of a cold room is sampled once an hour. One afternoon the door is left open for 10 minutes and the room warms, then recovers. What does the record show?

Where you meet it

  • Temperature probesThe probe in a cold room gives a voltage through a voltage divider, and an ADC turns it into the number that is recorded.
  • Pressure and level transmittersThe pressure at a borehole pump or the level in a tank reaches the controller as a voltage, and an ADC reads it.
  • Energy metersA meter samples the supply thousands of times each second, because the voltage and the current change 50 or 60 times a second.
Key points
  • An ADC divides a voltage range into equal steps and reports the number of the step.
  • step = reference voltage ÷ 2N, for N bits. Each added bit halves the step.
  • Voltages inside one step, and events between two samples, cannot be seen.
  • Fine steps are not the same as a correct reading. The reference and the signal must be right first.
Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.