Analogue versus digital input and output signals

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

This Analogue versus digital input and output signals worksheet is part of the QCE Digital Solutions Unit 3 — Interactions Between Users, Data and Digital Systems journey. Print it as a booklet?

Analogue versus digital input and output signals

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A light switch is either ON or OFF. What type of input signal is this?
A Analogue: it varies smoothly over a range
B Digital: it has only two fixed values
2. A temperature sensor outputs a voltage that rises smoothly as a room warms up. What type of signal is this?
A Analogue
B Digital
3. A microprocessor can only work with 1s and 0s. What must a system add to use a smoothly varying sensor signal?
A A digital-to-analogue converter (DAC)
B An analogue-to-digital converter (ADC)
4. Which signal needs no conversion before it reaches a microprocessor?
A A push-button press (on/off)
B A light sensor reading that changes gradually
5. A phone stores a song as digital data. Which converter lets the speaker play it as smooth sound waves?
A Digital-to-analogue converter (DAC)
B Analogue-to-digital converter (ADC)

Match the Pairs

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

Left columnRight column
1temp = 23.7 Adac.write(sound_level)
2button_pressed = 1 BA switch is a digital input, so it can only be 0 or 1. A value like 0.63 suggests a smooth analogue range.
3An analogue sensor's smooth signal must be converted to a digital number before the microprocessor can use it CAn analogue-style reading: a temperature can take any value in a smooth range, not just fixed steps
4A digital output can be turned into a smooth analogue signal for a speaker using a DAC DAn analogue light sensor gives a range of values, not just 1 or 0. Showing only on/off treats it as a digital signal.
5switch_state = 0.63 EA digital signal: it has only two fixed values, 1 (on) or 0 (off)
6light_level = 1 # analogue sensor Fvalue = adc.read()

Definitions

analogue vs digital

Fill in the Blanks

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

1.
state = ____________(switch) if state == 1: light_on()
2.
level = _____________(temp_sensor) print(level)
3.
adc = ___(Pin(34)) value = adc.read()
4.
speaker = ___(Pin(25)) speaker.write(volume)
5.
pressed = switch.value() if pressed == _: light.on()

Spot the Error

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

Question 1
A button = read_pin(2)
B if button == 1:
C print("analogue: pressed")
Question 2
A # temperature sensor is analogue
B raw = read_digital(0)
C temp = raw * 0.1
Question 3
A # sensor voltage to number
B volts = 2.7
C number = dac(volts)
Question 4
A switch = read_adc(4)
B if switch == 1:
C motor_on()
Question 5
A digital_values = [0, 0.7, 1, 0.3]
B for v in digital_values:
C set_pin(7, v)

Answer Key

Analogue versus digital input and output signals
Section A: Quick Questions
Q1
B — Digital: it has only two fixed values
Q2
A — Analogue
Q3
B — An analogue-to-digital converter (ADC)
Q4
A — A push-button press (on/off)
Q5
A — Digital-to-analogue converter (DAC)
Section B: Match the Pairs
Q1
temp = 23.7 → An analogue-style reading: a temperature can take any value in a smooth range, not just fixed steps
Q2
button_pressed = 1 → A digital signal: it has only two fixed values, 1 (on) or 0 (off)
Q3
An analogue sensor's smooth signal must be converted to a digital number before the microprocessor can use it → value = adc.read()
Q4
A digital output can be turned into a smooth analogue signal for a speaker using a DAC → dac.write(sound_level)
Q5
switch_state = 0.63 → A switch is a digital input, so it can only be 0 or 1. A value like 0.63 suggests a smooth analogue range.
Q6
light_level = 1 # analogue sensor → An analogue light sensor gives a range of values, not just 1 or 0. Showing only on/off treats it as a digital signal.
Section C: Definitions
Q1
analogue vs digital — Analogue signals vary smoothly over a range; digital signals have fixed values like on/off (1/0). Systems convert between them, e.g. ADC at a sensor input, DAC at a speaker output.
Section D: Fill in the Blanks
Q1
state = read_digital(switch) if state == 1: light_on()
Q2
level = read_analogue(temp_sensor) print(level)
Q3
adc = ADC(Pin(34)) value = adc.read()
Q4
speaker = DAC(Pin(25)) speaker.write(volume)
Q5
pressed = switch.value() if pressed == 1: light.on()
Section E: Spot the Error
Q1
C — A button is a switch with only two states, pressed or not pressed (1 or 0), so it is a digital input. The message should say digital, not analogue.
Q2
B — A temperature sensor gives a smoothly varying analogue signal, so it must be read through an ADC with read_adc(). A digital read would only return 0 or 1 and lose the detail.
Q3
C — An analogue sensor voltage has to be turned into a digital number so the microprocessor can use it. That is the job of an ADC. A DAC goes the other way, from digital to analogue.
Q4
A — A switch is a digital input with fixed on/off values, so it should be read with a digital read such as read_pin(). It does not need an ADC, which is for analogue signals.
Q5
A — A digital signal only has fixed discrete values such as 0 and 1. Values like 0.7 and 0.3 vary smoothly and belong to an analogue signal. The list should be [0, 1, 1, 0].