Sensors, monitoring and control
IGCSE Computer Science · Automated and Emerging Technologies
What a sensor does
A sensor is an input device that measures a physical quantity in the environment and turns it into an electrical signal.
| temperature | heating systems, ovens, greenhouses |
| moisture / humidity | greenhouses, soil watering, damp detection |
| light | street lamps, automatic headlights, screen brightness |
| infrared | burglar alarms, automatic doors, motion detection |
| pressure | burglar alarms in floors, car tyre monitoring |
| acoustic / sound | intruder detection, monitoring machinery for faults |
| gas | carbon monoxide alarms, air quality |
| pH | soil acidity, water treatment, chemical processes |
| magnetic field | detecting whether a door or window is closed |
Why an analogue-to-digital converter is always needed
The physical world is continuous: temperature does not jump from $20$ to $21$ degrees, it slides through every value in between. So a sensor produces a continuously varying (analogue) signal.
A microprocessor can only work with discrete binary values. So between every sensor and the microprocessor there must be an analogue-to-digital converter (ADC).
Where an output device is analogue — a motor, a valve — the reverse is needed: a digital-to-analogue converter (DAC) before the actuator.
Leaving the converter out of a system diagram is a marked error, and it is the most common one in this topic.
Monitoring systems and control systems
Both read sensors, and both use a microprocessor to compare the reading against stored values. The difference is what happens next.
| monitoring system | control system | |
| what it does with the result | reports or warns a human | changes the process itself |
| does it alter the process? | never | yes |
| output | a display, a log, an alarm | a signal to an actuator |
| example | a patient monitor showing heart rate and sounding an alarm | a central heating system switching the boiler on |
The test: ask whether the system changes anything by itself. A patient monitor sounds an alarm — but a nurse decides what to do. That is monitoring. A thermostat turns the boiler on with no human involved. That is control.
The loop a control system runs
- the sensor takes a reading continuously;
- the reading is converted to digital by the ADC;
- the microprocessor compares it with the stored value;
- if action is needed, it sends a signal to an actuator — a motor, valve, heater or pump;
- the actuator changes the process;
- the loop repeats, so the new reading reflects the change.
Step 6 is what makes it a feedback loop: the effect of the action is measured again, so the system keeps itself at the target value without a human.
Worked example: greenhouse — monitoring or control
A greenhouse needs to keep its temperature and humidity stable. (a) State the sensors needed. (b) Describe the loop the control system runs, stating clearly the role of the analogue-to-digital converter. (c) How would the system differ if it were only a monitoring system?
Solution
(a) The sensors needed.
- temperature sensor — measures the air temperature in the greenhouse;
- humidity sensor — measures the amount of water vapour in the air.
(A light sensor could be added to control shades or supplementary lighting.)
(b) The control system's loop.
Step 1. The sensors measure continuously, not just once in a while.
Step 2 — the role of the converter. The sensor produces an analogue signal, that is, a continuously varying signal, because in reality temperature does not jump from one value to another but slides through every value in between.
The microprocessor only understands discrete binary values. So the analogue-to-digital converter sits in between to change that continuous signal into numbers the microprocessor can read.
Without it, the microprocessor receives nothing at all.
Step 3. The microprocessor compares the value read with the stored value — for example a target temperature of $24\,^\circ\text{C}$.
Step 4. If it is too cold, it sends a signal to an actuator to switch on the heater. If it is too hot, it opens the ventilation window. If it is too dry, it switches on the misting system.
Step 5. The actuator changes the actual process.
Step 6 — the key point. The loop repeats. The next measurement already reflects the change just caused, so the system knows when to stop.
This is a feedback loop, and it is why the system can hold stable conditions by itself without a human.
(c) If it were only a monitoring system.
The first four steps are identical: still sensors, still the converter, still the microprocessor comparing with a threshold.
The difference lies in the output. A monitoring system has no actuator. Instead it displays the readings on a screen, records them in a log, or sounds an alarm when a threshold is exceeded.
Then the gardener has to go and switch on the heating or open the ventilation window themselves.
In other words, a monitoring system never changes the process by itself — it only provides information for a human to decide.
Worked example: choosing the right sensor for each job
State the most suitable sensor for each situation and explain: (a) a street light that comes on automatically at dusk; (b) an alarm when someone enters a room at night; (c) a warning for toxic gas in a kitchen that uses gas; (d) checking whether a window is closed.
Solution
(a) Street light that comes on automatically at dusk → LIGHT SENSOR.
The physical quantity to be measured here is the ambient brightness, and a light sensor measures exactly that.
The microprocessor compares the light level read with a stored threshold; when the light level falls below the threshold, it switches the light on.
Why not use a timer: the time of sunset changes with the seasons, and it may get dark early when it is very cloudy. A sensor responds to real conditions, whereas a clock does not.
(b) Alarm when someone enters a room → INFRARED SENSOR.
The human body gives off heat in the form of infrared radiation. An infrared sensor detects the change in that radiation when a person moves across the area it observes.
The advantage is that it works in complete darkness, exactly the condition needed for a burglar alarm at night.
(It could be replaced by a pressure sensor fitted under the floor, which detects the weight of a person stepping on it — but it only covers the area where the sensor pad is.)
(c) Toxic gas warning in a kitchen that uses gas → GAS SENSOR.
The specific danger is carbon monoxide, produced when gas burns incompletely. This gas is colourless and odourless, so people cannot detect it at all.
That is exactly why a sensor must be used: it measures the gas concentration and sounds the alarm when it exceeds the safe level.
This is a case where a sensor is not merely convenient but life-saving.
(d) Checking whether a window is closed → MAGNETIC FIELD SENSOR.
How it is fitted: a magnet is attached to the window sash and a magnetic field sensor to the frame.
When the window is closed, the magnet sits right next to the sensor so the magnetic field is strong. When the window is open, the magnet moves away and the magnetic field weakens or disappears.
The microprocessor only needs to read those two states to know whether the window is closed or open.