What a sensor is

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

What a sensor is

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement describes a sensor correctly?
A An input device that measures a physical quantity and sends readings to a computer
B An output device that displays results to the user
2. Which of these is a physical quantity that a sensor can measure?
A Temperature
B Password
3. Where do sensor readings go after they are measured?
A To a computer or microprocessor
B Straight to the keyboard
4. True or false: A sensor is an input device.
A False
B True
5. How do sensors usually take readings?
A Only when a person presses a key
B Continuously, again and again

Match the Pairs

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

Left columnRight column
1sensor AThe computer takes a reading of a physical quantity (heat) that a sensor has measured and stores it in a variable.
2temperature = read_sensor() BA sensor is an input device, not an output device. It measures the environment and sends readings in to the computer.
3A sensor is an input device, so its readings go into the computer for processing. CAn input device that measures a physical quantity, such as heat or light, from the environment and sends the readings to a computer or microprocessor.
4Sensors take continuous readings so a system can monitor and control without a person. DA light sensor measures light, not sound. Sound is measured by an acoustic sensor.
5A sensor is an output device that shows data to the user. EINPUT reading FROM sensor
6A light sensor measures the sound level in a room. FWHILE TRUE reading ← sensor value ENDWHILE

Definitions

sensor

Fill in the Blanks

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

1.
_____ TRUE DO temp ← READ(tempSensor) ENDWHILE
2.
WHILE TRUE DO light ← ____(lightSensor) ENDWHILE
3.
IF temp _ 30 THEN OUTPUT "Fan on" ENDIF
4.
reading ← READ(tempSensor) OUTPUT _______
5.
IF temp < 18 THEN heater ← __ ENDIF

Spot the Error

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

Question 1
A WHILE TRUE
B reading ← tempActuator()
C OUTPUT reading
D ENDWHILE
Question 2
A WHILE TRUE
B temp ← tempSensor()
C IF temp > 30 THEN
D fan ← OFF
E ENDIF
F ENDWHILE
Question 3
A // Sensors are output devices
B temp ← tempSensor()
C OUTPUT temp
Question 4
A DECLARE temp : REAL
B temp ← lightSensor()
C OUTPUT temp
Question 5
A reading ← pressureSensor()
B // sent to the microprocessor
C IF alarm > 100 THEN
D alarm ← ON
E ENDIF

Answer Key

What a sensor is
Section A: Quick Questions
Q1
A — An input device that measures a physical quantity and sends readings to a computer
Q2
A — Temperature
Q3
A — To a computer or microprocessor
Q4
B — True
Q5
B — Continuously, again and again
Section B: Match the Pairs
Q1
sensor → An input device that measures a physical quantity, such as heat or light, from the environment and sends the readings to a computer or microprocessor.
Q2
temperature = read_sensor() → The computer takes a reading of a physical quantity (heat) that a sensor has measured and stores it in a variable.
Q3
A sensor is an input device, so its readings go into the computer for processing. → INPUT reading FROM sensor
Q4
Sensors take continuous readings so a system can monitor and control without a person. → WHILE TRUE reading ← sensor value ENDWHILE
Q5
A sensor is an output device that shows data to the user. → A sensor is an input device, not an output device. It measures the environment and sends readings in to the computer.
Q6
A light sensor measures the sound level in a room. → A light sensor measures light, not sound. Sound is measured by an acoustic sensor.
Section C: Definitions
Q1
sensor — An input device that measures a physical quantity, such as heat or light, from the environment and sends the readings to a computer or microprocessor.
Section D: Fill in the Blanks
Q1
WHILE TRUE DO temp ← READ(tempSensor) ENDWHILE
Q2
WHILE TRUE DO light ← READ(lightSensor) ENDWHILE
Q3
IF temp > 30 THEN OUTPUT "Fan on" ENDIF
Q4
reading ← READ(tempSensor) OUTPUT reading
Q5
IF temp < 18 THEN heater ← ON ENDIF
Section E: Spot the Error
Q1
B — A temperature reading must come from a sensor, which is an input device. An actuator is an output device that carries out an action. It should be tempSensor().
Q2
D — When the sensor reading shows it is too hot (above 30), the system should switch the fan ON to cool the room. It should be fan ← ON.
Q3
A — A sensor sends data into the computer, so it is an input device, not an output device. The comment should say input devices.
Q4
B — The variable temp stores heat, so it needs a temperature sensor. A light sensor measures light, not heat. It should be tempSensor().
Q5
C — The microprocessor must check the sensor reading, not the alarm. The condition should test reading: IF reading > 100 THEN.