Study Guide

Sensors

What a sensor is and why computer systems use them; what each of fourteen sensors measures (temperature, humidity, pressure, light, gas, moisture, pH, level, flow, accelerometer, infra-red, proximity, magnetic field and acoustic); how a computer turns a reading into an action; and how to choose the most suitable sensor for a job.

Lesson 3.5 Computer Systems

For: Cambridge IGCSE Computer Science learners

Stage: Think

Looking after a greenhouse at the weekend

A school has a greenhouse (a made-up one) where pupils grow tomatoes. Tomatoes grow well when the air is warm but not too hot, the soil is damp, and there is enough light. Nobody is at school at weekends, so the school wants a computer to look after the greenhouse.

Think it through

What would the computer need to know about the greenhouse in order to look after it, and how could it find these things out when nobody is there?

Show what happens

It would need to know about the air temperature, how damp the soil is, and how much light there is. It can only find these out if something measures them and sends the measurement to the computer.

A sensor is an input device that measures a physical property of its surroundings, such as temperature or light, and sends the measurement to a computer as data. The computer cannot see, feel or smell, so sensors are how it learns about the physical world.

Computer systems use sensors to collect data automatically, all day and night, without anyone being present; to measure accurately and consistently; and to measure in places that are dangerous or hard to reach. The computer can then record the readings, display them, or use them to decide what to do.

Many sensors produce a signal that varies smoothly, called an analogue signal, which is converted to digital data by an analogue-to-digital converter (ADC) before the computer can process it.

Check your understanding

Which statement describes a sensor?
Show the answer

Answer: B. An input device that measures a property such as temperature and sends the reading to the computer.

A sensor measures; the computer decides.

Stage: Predict

From a reading to an action

The greenhouse computer has one temperature sensor. The tomatoes should not get hotter than 28 °C (an invented limit, for this example). A motor, which is an actuator, can open a vent in the roof.

Think it through

The sensor reports 31 °C. What should the computer do? How will it know when to stop?

Show what happens

It should compare 31 with the limit of 28, find it is too high, and make the motor open the vent. It can only know when to stop if the sensor keeps measuring, so that it sees the temperature fall and can close the vent again.

One round of the greenhouse’s control loop

The values are invented. Real systems work in the same order, round and round, many times each minute.

  1. Temperature sensor

    Step 1 of 5: Measure

    The sensor measures the air temperature and sends a signal to the computer.

  2. Analogue-to-digital converter

    Step 2 of 5: Convert

    The signal is converted into digital data, say 31 °C, so that the computer can process it.

  3. Processor

    Step 3 of 5: Compare and decide

    The program compares 31 °C with the stored limit of 28 °C. It is above the limit, so the vent must open.

  4. Actuator (a motor)

    Step 4 of 5: Act

    The computer sends a signal to the motor, which opens the vent. This is an output.

  5. Temperature sensor

    Step 5 of 5: Measure again

    The sensor keeps measuring. When the reading falls below the limit, the computer closes the vent, and the loop carries on.

A system that only records or displays the readings is monitoring; one that also uses them to make something happen, as the greenhouse does, is controlling.

Check your understanding

After the vent has opened, why does the sensor keep measuring?
Show the answer

Answer: C. So the computer can see when the temperature has fallen and decide when to close the vent.

Control is a loop: each action changes what the sensor measures next.

Stage: Discover

Sensors for the air

Think it through

A school weather station and a carbon monoxide alarm both measure the air. Suggest four different things about the air that a sensor could measure.

Show what happens

Examples are how hot it is, how damp it feels, how bright it is, how hard the air presses, and whether a gas such as carbon monoxide is present. Each of these is a sensor in the list below.

SensorWhat it measuresWhere it is used
TemperatureHow hot or cold something isOvens, central heating, greenhouses, fridges
HumidityThe amount of water vapour in the airGreenhouses, air conditioning, weather stations
PressureThe force pressing on an area, such as the air pressure or a weight on a padWeather stations, tyre-pressure warnings, burglar-alarm pressure pads
LightHow bright the light isStreet lights that come on at dusk, phone screens that adjust their brightness
GasWhether a particular gas is present, and how muchCarbon monoxide alarms, gas leak detectors
Which sensor does each system need? Type one word: temperature, humidity, pressure, light or gas.
SystemSensor
Street lamps that come on at dusk
A greenhouse fan that starts when the air is too hot
A bedroom alarm that warns of carbon monoxide
A car that warns the driver when a tyre is low
Air conditioning that keeps a museum from becoming too damp

    Show the completed table
    SystemSensor
    Street lamps that come on at dusklight
    A greenhouse fan that starts when the air is too hottemperature
    A bedroom alarm that warns of carbon monoxidegas
    A car that warns the driver when a tyre is lowpressure
    Air conditioning that keeps a museum from becoming too damphumidity

    Stage: Think

    Sensors for water and soil

    Think it through

    A computer looks after a school fish tank and a vegetable bed. What might it need to know about the water, and about the soil?

    Show what happens

    It might need to know how high the water is in the tank, how fast water is flowing through the filter, how acidic or alkaline the water is, and how wet the soil is. These are the four sensors below.

    SensorWhat it measuresWhere it is used
    MoistureThe amount of water in soil or another materialAutomatic watering of plants, checking the soil in a field
    pHHow acidic or alkaline a liquid or soil is, on a scale from 0 to 14 (7 is neutral)Fish tanks, swimming pools, water treatment, testing soil
    LevelHow high a liquid, or a solid such as grain, reaches in a containerWater tanks, fuel gauges, washing machines
    FlowHow fast a liquid or gas moves past a pointWater meters, central heating pipes, irrigation

    Do not confuse: Humidity and moisture

    Where?Humidity
    The amount of water vapour in the air.How damp the air in a greenhouse is.
    Where?Moisture
    The amount of water in soil or another solid material.How wet the soil in a plant pot is.

    Do not confuse: Level and flow

    How much?Level
    How high a liquid or solid reaches inside a container, at this moment.The water in a tank is 40 cm deep.
    How fast?Flow
    How fast a liquid or gas moves past a point.The water through a pipe is 12 litres a minute.

    Check your understanding

    A computer must switch off a pump before a water tank overflows. Which sensor tells it that the tank is nearly full?
    Show the answer

    Answer: D. A level sensor, because it measures how high the water reaches.

    Level tells how high; flow tells how fast.

    Apply it

    A school wants a computer to water a vegetable bed automatically when the soil is dry. Sam suggests a humidity sensor. What is the problem with that suggestion?
    Show the answer

    Answer: B. A humidity sensor measures water vapour in the air, not how wet the soil is; a moisture sensor would.

    For soil, use a moisture sensor.

    Stage: Discover

    Sensors for movement, nearness and sound

    Think it through

    A phone turns its picture sideways when you turn it, and switches its screen off when you hold it to your ear. What might it be sensing in each case?

    Show what happens

    Turning the phone changes its tilt and movement, and holding it to your ear puts something very close to it. Different sensors measure each of these.

    SensorWhat it measuresWhere it is used
    AccelerometerAcceleration: changes in speed or direction, and the tilt or vibration of a devicePhones that turn their picture sideways, step counters, car airbags
    ProximityWhether an object is close, without touching itParking sensors, phones that switch the screen off at your ear, automatic taps
    Infra-redInfra-red radiation, such as the heat given off by people and animals, or a beam of infra-red light that is brokenBurglar alarms, automatic doors
    Magnetic fieldThe presence or strength of a magnetic fieldDoor and window alarms with a magnet on the door, compasses in phones
    AcousticSound, such as how loud it isNoise monitors, burglar alarms that listen for breaking glass

    Check your understanding

    A burglar alarm in a room must notice a person by the heat their body gives off. Which sensor does this?
    Show the answer

    Answer: A. An infra-red sensor.

    Infra-red sensors detect heat from bodies, or broken beams of infra-red light.

    Stage: Apply

    Choosing the most suitable sensor

    A computer is to switch on a garden light when it gets dark, but not when the light is only dim at midday under a cloud.

    1. Say what the computer must know. It must know how bright it is outside, because the decision depends on brightness.
    2. Find the sensors that measure that property. The property is brightness of light, which is what a light sensor measures. A temperature sensor would measure how warm it is, and cold does not mean dark.
    3. Check it is the most suitable. Another sensor might be possible, such as an acoustic sensor listening for the birds that stop singing at dusk, but it would be unreliable. The light sensor measures the property directly.
    4. Name the sensor and give the reason. A light sensor, because the decision depends on how bright it is, and a light sensor measures exactly that.

    The same four steps work for any context: what must be known, which sensor measures it directly, whether it is the best, and then the answer with the reason.

    Which is the most suitable sensor for each job? Type one of: accelerometer, acoustic, flow, level, magnetic field, moisture, pH, proximity.
    JobSensor
    A fitness band that counts a wearer’s steps
    A computer that checks whether a swimming pool’s water has become too acidic
    A robot vacuum cleaner that must stop before it touches a table leg
    A factory computer that records how much water passes along a pipe each minute
    A glass-break alarm that listens for the sound of a window smashing
    A museum alarm that sounds if a case lid is lifted away from a magnet fixed in the frame

      Show the completed table
      JobSensor
      A fitness band that counts a wearer’s stepsaccelerometer
      A computer that checks whether a swimming pool’s water has become too acidicpH
      A robot vacuum cleaner that must stop before it touches a table legproximity
      A factory computer that records how much water passes along a pipe each minuteflow
      A glass-break alarm that listens for the sound of a window smashingacoustic
      A museum alarm that sounds if a case lid is lifted away from a magnet fixed in the framemagnetic field

      Apply it

      A car’s computer has to tell the driver how much fuel is in the tank. Which sensor is the most suitable?
      Show the answer

      Answer: D. A level sensor, because it measures how high the fuel is in the tank.

      A level sensor measures how much a tank holds.

      Apply it

      Ayesha says: “A shop’s door alarm needs an infra-red sensor, because a door opening is a movement.” Which reply is the most accurate?
      Show the answer

      Answer: A. Not necessarily: a magnet on the door and a magnetic field sensor in the frame also show it opening.

      The most suitable sensor measures the thing that actually changes.

      Stage: Consolidate

      Show what you know

      Think it through

      A school wants a computer to look after its fish tank. Choose three different sensors from this lesson that it could use. For each, say what it measures and what the computer could do with the reading.

      Show a model answer

      For example: “A temperature sensor measures the water’s warmth, and the computer could switch a heater on or off. A level sensor measures how high the water is, and the computer could open a valve to top it up. A pH sensor measures how acidic the water is, and the computer could warn a teacher if it is unsafe for the fish.” A good answer names what each sensor measures and links it to an action or a warning.

      Apply it

      A computer controls a ventilation fan in a classroom. Which description of how the system works is correct?
      Show the answer

      Answer: C. A temperature sensor sends readings to the computer, which compares them with a limit and signals the fan.

      Sensor, then computer, then actuator, in a loop.

      • A sensor is an input device that measures a physical property and sends the reading to a computer as data. Systems use sensors to collect data automatically, accurately, and in places people cannot easily go.
      • A computer compares readings with stored limits and may control an actuator. It keeps measuring, so that control is a loop.
      • Air: temperature (how hot), humidity (water vapour in the air), pressure (force on an area), light (brightness), gas (a particular gas).
      • Water and soil: moisture (water in soil or another material), pH (acidity), level (how high), flow (how fast).
      • Movement and presence: accelerometer (acceleration, tilt), proximity (something near), infra-red (heat or a broken infra-red beam), magnetic field (a magnet), acoustic (sound).
      • To choose a sensor: say what the computer must know, find the sensor that measures that property directly, and give the reason.

      Sources and scope

      • What this lesson is. The fifth lesson of the Computer Systems module, written for this site. It teaches Cambridge IGCSE Computer Science (0478) point 3.2.3 (2026 to 2028, version 6): the purpose of sensors, the data each of the fourteen listed sensors captures, and choosing a sensor for a context. Its curriculum links are provisional and imply no endorsement by any examination board. It has not been approved by the site owner.
      • Original material. The school greenhouse, the fish tank, the vegetable bed, the shop door, Sam’s and Ayesha’s remarks and every temperature limit are fictional and were written for this lesson.
      • Simplified on purpose. Real sensors work in many ways, which this lesson does not teach (it states what each measures, not its electronics). Real control systems also use more than a single limit, for example to stop a vent opening and closing repeatedly. A proximity sensor and an infra-red sensor can sometimes both detect the same event, so in a real design the choice depends on the details; the contexts in this lesson are chosen so that one sensor is the most suitable.