Week 26 · Unit 11: Artificial Intelligence · 3 lessons
3
Choosing a sensor
Computing 5: Unit 11, pp. 145–158
GoalChoose the right sensor for a job and use its readings in a rule.
New words
sensor · a device that measures something and turns it into datareading · one measured value from a sensorrule · an if … then statement that uses a readingforecast · a prediction about what will happen, such as the weather tomorrow
Explanation
A sensor measures something in the world and turns it into data that a computer can use. Each sensor measures one kind of thing. A light sensor measures brightness, a temperature sensor measures heat and a motion sensor notices movement. A sound sensor, a moisture sensor and a camera measure sound, wetness and pictures. We pick the sensor that fits the job. A program then compares each reading with a rule. A weather station uses many sensors, and a central computer uses all the readings to make a forecast. A forecast is a prediction, so it can be wrong.
Worked examples
Job
Sensor
Like our …
switch on a lamp at dusk
light sensor
eyes
warn when a freezer is too warm
temperature sensor
skin
wake a guard dog toy when a clap is heard
sound sensor
ears
water a plant when the soil is dry
moisture sensor
fingers in the soil
The job tells us which sensor to choose. Our own senses do similar work.
Time
8:00
12:00
16:00
18:00
20:00
Reading
80
95
60
30
8
Lamp
off
off
off
off
on
A light sensor reads brightness from 0 (dark) to 100 (bright). The rule is: if the reading is less than 20, switch the lamp on. The lamp is on only at 20:00, when the reading is 8.
Job
Wrong sensor
Right sensor
check that soil is dry
sound sensor
moisture sensor
notice a visitor at the gate
temperature sensor
motion sensor
measure how bright a room is
moisture sensor
light sensor
The wrong sensor gives useless data. A sound sensor cannot tell us if soil is dry.
Class activity
Sensor match (4 or more players, cards). Make 8 job cards, such as ‘switch on a lamp when it is dark’, and 8 sensor cards, such as ‘light sensor’. Shuffle each pile. Players take turns to draw a job card and mime it, and the others hold up the sensor that fits. Then add a rule card for each match, such as ‘if the reading is below 20, switch on’. Which jobs were hard to mime?
Practice
1
Which sensor fits each job? (a) notice when a cat walks through a pet flap, (b) warn when a greenhouse gets too hot, (c) tell when the library gets too noisy, (d) take a picture of a bird at a feeder.
Job
Sensor
a: notice a cat at the pet flap
?
b: warn when a greenhouse is too hot
?
c: tell when the library is too noisy
?
d: take a picture of a bird at a feeder
?
(a) motion sensor, (b) temperature sensor, (c) sound sensor, (d) camera (an image sensor).
2
The rule is: if the temperature reading is more than 30, switch the fan on. The readings are shown. At which times is the fan on?
Time
9:00
11:00
13:00
15:00
17:00
Reading
24
28
31
33
29
The fan is on at 13:00 (31) and at 15:00 (33). The other readings are 30 or less.
3
Why can a weather forecast be wrong even when it uses many sensors?
A forecast is a prediction about the future, and the weather can change. The sensors only measure some places, so some things are missed.
4
Give one job for a sound sensor. Who should be asked before it is put in a classroom, and why?
A job could be counting how loud the class is. The teacher, the school and the pupils should be asked, because a sound sensor can record private talk.