TactivergeLite

Lite / Discovering How the World Works / Week 14

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 · Reviewed by the founders' mentors · Full interactive version

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.

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?

  1. Ask a human every time
  2. Pick a threshold, e.g. above 65 means red
  3. Average all the parts it has ever seen
Guess first, then reveal

Pick a threshold. Above the line: red (1). Not above: not red (0). The smooth score becomes one bit. Choosing *where* to put the line is a real engineering decision.

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?

What the interactive shows (text version)

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.

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

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

Intuitive

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.

Technical

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).

Mathematical

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).

Applied

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

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. Which of these is analog?

cm

Practice 4. Where is a threshold-based sorting machine most likely to make mistakes?

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.

Reflect

Name one thing in your life that is analog and one that is digital. What would be lost if the analog one became digital?

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

← Four quadrants: below zero and behind the robotBits: how much can two lights say? →