Analog and digital: smooth worlds, stepped machines
A thermometer's red line can sit anywhere. A digital thermometer shows 21.5 or 21.6, never in between. What did it throw away?
About 25 min · 3 goals · Checked by automated tests; not yet reviewed by an educator
1.Why should I care?
The real world is smooth: temperatures, colours and distances can take any value. Computers can only store whole steps. Every sensor in every machine has to cross that border, and engineers decide how fine the steps should be.
- ◇ Explain the difference between an analog quantity and a digital value.
- ◇ Describe how a sensor reading is turned into numbers in steps.
- ◇ Use a threshold to turn a reading into a yes/no decision.
2.Predict
A sorting machine's colour sensor gives a 'redness' score from 0 to 100. The machine has to decide 'red' or 'not red'. What is the simplest way?
Guess first. Being wrong here is how the surprise works.
3.Discover
In the sorting machine Build, look at each part's sensor readings (numbers that could be anything) and the thresholds in the brief. Sort the six parts by hand. Which step turns a smooth reading into a yes/no answer?
Can't use the interactive? Read a description instead
In the sorting machine Build, each part on the conveyor has readings: a redness score, a length and a metal-detector value. The brief gives thresholds, for example redness above 65 counts as red. Comparing each reading with its threshold turns it into a yes or no, and the three answers together choose a bin.
4.Understand
Analog: any value
An analog quantity can take any value in a range: the temperature might be 21.4 °C, 21.43 °C or 21.4372 °C. A clock with sweeping hands, a dimmer switch and the height of water in a bath are analog.
Digital: fixed steps
A digital value can only be one of a fixed list of steps. A digital thermometer that shows one decimal place has steps of 0.1 °C: 21.4, 21.5, 21.6. Turning an analog signal into steps is called analog-to-digital conversion. Smaller steps are more precise but need more storage.
The simplest step: a threshold
The roughest possible conversion has just two steps: yes or no, 1 or 0. Pick a threshold: above it is 1, otherwise 0. A night light turns on below a brightness threshold; a sorting machine calls a part 'red' above a redness threshold. Readings close to the line are where mistakes happen, so engineers test them carefully.
Explain it another way
Analog is a ramp; digital is a staircase. You can stand anywhere on a ramp, but only on a step of a staircase. The smaller the steps, the more the staircase feels like a ramp.
An ADC samples a continuous voltage and quantises it to one of 2ⁿ levels, where n is its number of bits. A comparator is a 1-bit ADC: its output is 1 when the input exceeds a reference (the threshold).
With a range R split into N equal steps, step size = R ÷ N. A thermometer covering 0–50 °C in 500 steps has steps of 50 ÷ 500 = 0.1 °C. A reading of 21.43 °C is stored as the step 214 (21.4 °C).
Phone cameras convert light at each pixel into one of 256 or more brightness steps. Car rain sensors use a threshold on reflected light to decide when to start the wipers.
Worked example 1
A light sensor reads 0 (dark) to 1,000 (bright). The night light rule is: ON if the reading is below 200. Readings are 150, 200 and 640. What does the light do each time?
150 is below 200: ON. 200 is not below 200: OFF. 640: OFF. The boundary value 200 is exactly where you must decide which side it falls.
Common mix-ups
- Digital is always more accurate than analog.
✓ Digital values are rounded to steps, so some detail is thrown away. They are easier to store, copy and process without errors.
5.Practice
Practice, not a test. Wrong answers get a hint and another try.
Practice 1
Which of these is analog?
Practice 2
A sensor measures distances from 0 to 2 m in 200 equal steps. How big is each step, in centimetres?
Practice 3 · a fresh version every time
A smart fan follows this rule: IF someone is home AND the temperature is above 25 °C, THEN fan on (1), ELSE fan off (0). Someone is home and it is 25 °C. What does the fan do (1 or 0)?
Practice 4
Where is a threshold-based sorting machine most likely to make mistakes?
6.Apply it
Design a threshold rule for an automatic plant-watering machine using a soil-moisture sensor that reads 0 (bone dry) to 100 (soaking). Pick a threshold, say what happens just above and just below it, and explain one problem if the threshold is too high.
7.Reflect
Concepts: Analog-to-digital conversion · Thresholding and simple classification