ADC and sampling
On this page
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.
See it
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?
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.
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
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
- Count the steps
12 bits give 212 = 4,096 steps, numbered 0 to 4,095.
- Find the size of one step
step = 3.3 V ÷ 4,096 = 0.000806 V, which is 0.806 mV.
- 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
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
A 10 bit ADC has a reference of 5 V. What is the size of one step?
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?
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.
- 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.
Discussion
No comments yet. Questions, results from your own build, a better way to explain it: all welcome.
My notes on this page
Kept on this device only. Nothing is sent anywhere.
Tip: select words in the lesson, or tap a figure or an equation, to put a note right there.
Notes on earlier wording
The lesson has changed and these words are no longer in it. Your notes are kept, with the words you chose.