A sensor is an input device that measures something in the world around it. This lesson goes through the fourteen sensors of the syllabus, the data each one captures and where it is used. You then practise choosing the most suitable sensor for a task.
about 25 min1 simulation1 practice question
Lesson 3 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What a sensor is
How does a street light know when it is getting dark? It has a light sensor. A sensor is an input device that measures a physical quantity, such as light, temperature or pressure, and sends the reading to a computer or a microprocessor.
The purpose of a sensor is to let a system monitor the world, or control something in it, without a person taking the readings. A sensor only measures. It never decides and never acts. The microprocessor compares each reading with a stored value and decides what to do. Then it sends a signal to an actuator, which acts.
A loop of four boxes joined by arrows: a sensor sends a reading to a microprocessor, the microprocessor compares it with a stored value and sends a signal to an actuator, the actuator changes the world, and the change is measured again by the sensor.
The picture shows the loop. The sensor sends a reading to the microprocessor. The microprocessor sends a signal to an actuator. The actuator changes the world, and the sensor measures the change.
The fourteen sensors
For each sensor, learn what it measures and one place where it is used.
Acoustic: sound. It hears breaking glass in a burglar alarm, or measures noise near a road.
Accelerometer: acceleration, a change in speed or direction, and tilt. It turns a phone screen round, and detects a crash to fire a car's airbag.
Flow: how fast a liquid or a gas moves through a pipe. It measures water use, or fuel going into an engine.
Gas: the amount of a particular gas, such as carbon monoxide or carbon dioxide. It is used in gas alarms and pollution monitoring.
Humidity: the amount of water vapour in the air. It is used in greenhouses and in museums that protect old paintings.
Infra-red: infra-red radiation, such as the heat given off by a person, or a beam that is broken. It detects intruders and counts people at a door.
Level: how high a liquid or a material is in a container. It warns when a tank is nearly empty or a river is too high.
Light: how bright the light is. It switches on street lights, and adjusts the brightness of a phone screen.
Magnetic field: a magnetic field and changes in it. It is used in the compass of a phone, and to find a car waiting at traffic lights.
Moisture: how much water is in a material such as soil. It tells an automatic watering system when to water.
pH: how acidic or alkaline a liquid or soil is. It monitors a fish tank, a swimming pool or a river.
Pressure: a force pressing on it, or the pressure of a gas or liquid. A pressure pad in a floor detects a footstep. It also measures tyre pressure.
Proximity: how close an object is, without touching it. Car parking sensors use it. A phone turns its screen off when it is held near your ear.
Temperature: how hot or cold something is. It is used in central heating, fridges, ovens and greenhouses.
Choosing the most suitable sensor
An examination often gives a situation and asks for the best sensor. Ask one question: what physical quantity must be measured? Then choose the sensor that measures exactly that.
The soil in a plant pot is dry. That is water in soil, so use a moisture sensor. A humidity sensor measures water vapour in the air, which is the wrong thing.
Water must not overflow a tank. That is the height of the water, so use a level sensor. A flow sensor measures how fast water moves, not how high it is.
A car must stop before it hits a wall. That is distance to an object, so use a proximity sensor.
Some systems need more than one sensor. A greenhouse may use temperature, humidity, light and moisture sensors together.
Practise with new numbers
Try it in Python
The program plays the part of the microprocessor in a greenhouse. It compares each temperature reading with two stored values and prints what should happen.
Common mistakes
Saying the sensor switches the heater on. The sensor only measures. The microprocessor decides and the actuator acts.
Mixing up humidity and moisture. Humidity is water vapour in the air. Moisture is water in a material such as soil.
Mixing up level and flow. Level is how high. Flow is how fast it moves.
Choosing infra-red for distance. To measure how close an object is, choose a proximity sensor.
Remember these
A sensor measures a physical quantity and sends the reading on. It does not decide or act.
Learn the data each of the fourteen sensors captures, with one use.
To choose a sensor, name the quantity that must be measured, then pick the sensor for exactly that.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
What does a humidity sensor measure?
Which sensor would tell a phone that it has been turned on its side?
A swimming pool system must check that the water is not too acidic. Which sensor should it use?
Why is a flow sensor the wrong choice for warning that a water tank is full?
In a burglar alarm, which part decides to sound the siren: the sensor or the microprocessor?
References
Cambridge International, IGCSE Computer Science 0478 syllabus (2026, 2027 and 2028), section 3.2 Input and output devices, outcome 3: sensors, the data they capture and choosing a sensor.
Enroll free in Input Devices, Output Devices and Sensors
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.