Analogue sensor data and analogue-to-digital conversion

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Analogue sensor data and analogue-to-digital conversion

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A temperature sensor measures a room warming up gradually. What type of data does it capture?
A Analogue data, which varies continuously
B Digital data, which is already in binary
2. Which device must change a sensor's reading before a computer can process it?
A Digital-to-analogue converter (DAC)
B Analogue-to-digital converter (ADC)
3. A computer works with data in which form?
A Digital values (binary numbers)
B Continuously varying analogue signals
4. A light sensor sends its reading to a microprocessor. Where does the ADC sit in this process?
A Between the sensor and the microprocessor
B After the microprocessor has processed the data
5. Which statement about analogue data is correct?
A It can only take fixed steps such as 0 or 1
B It can take any value within a range, such as 20.1, 20.15 or 20.2

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1ADC ASensors capture analogue data, not digital data. An ADC is needed to convert the readings into digital values before the computer can use them.
2DAC Bsensor -> ADC -> microprocessor
3Analogue data varies continuously, so a temperature sensor can output any value in a range such as 21.3, 21.4 or 21.45 Ctemperature = 21.37
4The sensor's reading must be converted by the ADC before the microprocessor can process it DThe ADC is placed after the microprocessor. It must come before processing, because the computer can only process digital data and the sensor gives analogue data.
5sensor -> microprocessor -> ADC EAnalogue-to-digital converter: changes the continuously varying readings from a sensor into digital values the computer can process
6A light sensor sends digital values straight to the computer, so no ADC is needed FDigital-to-analogue converter: changes digital values from the computer into an analogue signal, for example to drive a speaker or motor

Definitions

ADC (analogue-to-digital converter)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
digital ← ___(temperature)
2.
digital ← ADC(ReadSensor()) __ digital > 200 THEN OUTPUT "Too hot"
3.
signal ← ___(digital_value)
4.
_____ monitoring = TRUE digital ← ADC(ReadSensor()) ENDWHILE
5.
analogue ← ReadSensor() digital ← ADC(________)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A REPEAT
B raw ← READ_SENSOR()
C digital ← ADC(raw)
D PROCESS(raw)
E UNTIL SwitchOff = TRUE
Question 2
A REPEAT
B raw ← READ_SENSOR()
C digital ← DAC(raw)
D WAIT 10 SECONDS
E UNTIL done = TRUE
Question 3
A digital ← 128
B signal ← ADC(digital)
C OUTPUT signal TO SPEAKER
Question 4
A reading ← READ_SENSOR()
B // ADC gives binary values
C // ADC gives binary values
Question 5
A WHILE monitoring = FALSE
B raw ← READ_SENSOR()
C digital ← ADC(raw)
D WAIT 1 SECOND
E ENDWHILE

Answer Key

Analogue sensor data and analogue-to-digital conversion
Section A: Quick Questions
Q1
A — Analogue data, which varies continuously
Q2
B — Analogue-to-digital converter (ADC)
Q3
A — Digital values (binary numbers)
Q4
A — Between the sensor and the microprocessor
Q5
B — It can take any value within a range, such as 20.1, 20.15 or 20.2
Section B: Match the Pairs
Q1
ADC → Analogue-to-digital converter: changes the continuously varying readings from a sensor into digital values the computer can process
Q2
DAC → Digital-to-analogue converter: changes digital values from the computer into an analogue signal, for example to drive a speaker or motor
Q3
Analogue data varies continuously, so a temperature sensor can output any value in a range such as 21.3, 21.4 or 21.45 → temperature = 21.37
Q4
The sensor's reading must be converted by the ADC before the microprocessor can process it → sensor -> ADC -> microprocessor
Q5
sensor -> microprocessor -> ADC → The ADC is placed after the microprocessor. It must come before processing, because the computer can only process digital data and the sensor gives analogue data.
Q6
A light sensor sends digital values straight to the computer, so no ADC is needed → Sensors capture analogue data, not digital data. An ADC is needed to convert the readings into digital values before the computer can use them.
Section C: Definitions
Q1
ADC (analogue-to-digital converter) — Turns the continuously varying analogue readings from a sensor into digital values (binary numbers) so a computer can process them.
Section D: Fill in the Blanks
Q1
digital ← ADC(temperature)
Q2
digital ← ADC(ReadSensor()) IF digital > 200 THEN OUTPUT "Too hot"
Q3
signal ← DAC(digital_value)
Q4
WHILE monitoring = TRUE digital ← ADC(ReadSensor()) ENDWHILE
Q5
analogue ← ReadSensor() digital ← ADC(analogue)
Section E: Spot the Error
Q1
D — The raw sensor reading is analogue, and a computer cannot process it directly. The ADC output must be processed instead: PROCESS(digital).
Q2
C — A DAC turns digital values into analogue. Sensor readings are analogue, so they need an ADC: digital ← ADC(raw).
Q3
B — A speaker needs an analogue signal, so the digital value must go through a DAC (digital-to-analogue converter), not an ADC: DAC(digital).
Q4
C — This line is fine as a comment, so the error is elsewhere in the program.
Q5
A — The loop must run while monitoring is TRUE, so readings are taken at regular intervals. With FALSE it never runs while monitoring is on.