O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.
A DMC 2023
Sensors
Sensors are input devices which read or measure physical properties from their surroundings.
Examples include:
Sensor Description Applications
Temperature • Measures temperature of • control of a central heating
the surroundings by system
sending signals • control/monitor a chemical
• These signals will change process
as the temperature • control/monitor
changes temperature in a
greenhouse
Moisture • Measures water levels • control/monitor moisture
levels in soil in a
greenhouse
• monitor the moisture
levels in a food processing
factory
Humidity • Measures the amount of • monitor humidity levels in
water vapour a building
• monitor humidity levels in
a factory manufacturing
microchips
• monitor/control humidity
levels in the air in a
greenhouse
Light • Uses photoelectric cells • switching street lights on
that produce an output or off depending on light
depending on the levels
brightness of the light • switching on car headlights
automatically when it gets
dark
Infrared • Uses an invisible beam of • turning on car windscreen
(active) infrared radiation picked wipers automatically when
up by a detector it detects rain on the
• If the beam is broken, then windscreen
there will be a change in • security alarm system
the amount of infrared (intruder breaks the
radiation reaching the infrared beam)
detector (sensor)
Infrared • Measures the heat • security alarm system
(passive) radiation given off by an (detects body heat)
object • monitors the temperature
inside an industrial freezer
or chiller unit
Pressure • It is a transducer and • weighing of lorries at a
generates different electric weighing station
currents depending on the • measure the gas pressure
pressure applied in a nuclear reactor
Page 1 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
Acoustic/sound • These are basically • pick up the noise of
microphones that convert footsteps in a security
detected sound into system
electric signals/pulses • detect the sound of liquids
dripping at a faulty pipe
joint
Gas • Detects the gas being • monitor pollution levels in
monitored and produce the air at an airport
outputs that vary with the • monitor oxygen and
oxygen or carbon dioxide carbon dioxide levels in a
levels present greenhouse
• monitor oxygen levels in a
car exhaust
pH • Measures acidity through • monitor/control acidity
changes in voltages in, for levels in the soil in a
example, soil greenhouse
• control acidity levels in a
chemical process
Magnetic field • Measures changes in • detect magnetic field
magnetic fields changes (for example, in
mobile phones and CD
players)
• used in anti-lock braking
systems in cars
Accelerometer • Measures acceleration and • used in cars to measure
motion of an application rapid deceleration and
apply air bags in a crash
• used by mobile phones to
change between portrait
and landscape mode
Proximity • Detects the presence of a • detect when a face is close
nearby object to a mobile phone screen
and switches off screen
when held to the ear
Flow (rate) • Measures the flow rate of • used in respiratory devices
a moving liquid or gas and and inhalers in hospitals
produce an output based • measure gas flows in pipes
on the amount of liquid or (for example, natural gas)
gas passing over the sensor
Level • Uses ultrasonics to detect • monitor levels in a petrol
changing liquid levels or tank in a car
capacitance/ conductivity • in a pharmaceutical
to measure static levels of process where powder
liquid levels in tablet production
need to be monitored
• leak detection in
refrigerant (air
conditioning)
Page 2 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
Sensors are used in both monitoring and control applications.
Examples of monitoring
• Monitoring of a patient in a hospital for vital signs such as heart rate, temperature, etc.
• Monitoring of intruders in a burglar alarm system
• Checking the temperature levels in a car engine
• Monitoring pollution levels in a river.
Examples of control
• Turning street lights on at night and turning them off again during daylight
• Controlling the temperature in a central heating/air conditioning system
• Chemical process control (for example, maintaining temperature and pH of process)
• Operating anti-lock brakes on a car when necessary
• Controlling the environment in a green house.
Page 3 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
Monitoring applications
✓ Security systems
The security monitoring system will carry out the following actions:
• the system is activated by keying in a password on a keypad
• the infrared sensor will pick up the movement of an intruder in the building
• the acoustic sensor will pick up sounds such as footsteps or breaking glass
• the pressure sensor will pick up the weight of an intruder coming through a door or through
a window
• the sensor data is passed through an ADC if it is in an analogue form ...
• ... to produce digital data
• the computer/microprocessor will sample the digital data coming from these sensors at a
given frequency (e.g. every 5 seconds) ...
• ... the data is compared with the stored values by the computer/microprocessor
• if any of the incoming data values are outside the acceptable range, then the computer
sends a signal ...
• ... to a siren to sound the alarm, or
• ... to a light to start flashing
• a DAC is used if the devices need analogue values to operate them
• the alarm continues to sound/lights continue to flash until the system is reset with a
password.
✓ Monitoring of patients in a hospital
• A number of sensors are attached to the patient ...
• ... these measure vital signs such as: temperature, heart rate, breathing rate, etc.
• these sensors are all attached to a computer system
• the sensors constantly send data back to the computer system
• the computer samples the data at frequent intervals
• the range of acceptable values for each parameter is keyed into the computer
• the computer compares the values from the sensors with those values keyed in
• if anything is out of the acceptable range, a signal is sent by the computer ...
• ... to sound an alarm
• if data from the sensors is within range, the values are shown in either
• graphical form on a screen and/or a digital read out
• monitoring continues until the sensors are disconnected from the patient.
Page 4 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
Control applications
✓ Control of street lighting
• the light sensor sends data to the ADC interface
• this changes the data into digital form and sends it to the microprocessor
• the microprocessor samples the data every minute (or at some other frequency rate)
• if the data from the sensor < value stored in memory …
• ... a signal is sent from the microprocessor to the street lamp ...
• ... and the lamp is switched on
• the lamp stays switched on for 30 minutes before the
• sensor readings are sampled again (this prevents the lamp flickering off and on during
brief heavy cloud cover, for example)
• if the data from the sensor >= value stored in memory …
• … a signal is sent from the microprocessor to the street lamp ...
• … and the lamp is switched off
• the lamp stays switched off for 30 minutes before sensor readings are sampled again
(this prevents the lamp flickering off and on during heavy cloud cover for example).
✓ Anti-lock braking systems (on cars)
• when one of the car wheels rotates too slowly (i.e. it is locking up), a magnetic field sensor
sends data to a microprocessor
• the microprocessor checks the rotation speed of the other three wheels
• if they are different (i.e. rotating faster), the microprocessor sends a signal to the braking
system …
• … and the braking pressure to the affected wheel is reduced …
• … the wheel’s rotational speed is then increased to match the other wheels
• the checking of the rotational speed using these magnetic field sensors is done several times
a second …
• … and the braking pressure to all the wheels can be constantly changing to prevent any of
the wheels locking up under heavy braking ...
• … this is felt as a ‘judder’ on the brake pedal as the braking system is constantly switched off
and on to equalise the rotational speed of all four wheels
• if one of the wheels is rotating too quickly, braking pressure is increased to that wheel until
it matches the other three.
Page 5 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
✓ Central heating systems
• the required temperature is keyed in and this is stored in the microprocessor memory (this is
called the pre-set value)
• the temperature sensor is constantly sending data readings to the microprocessor
• the sensor data is first sent to an ADC to convert the analogue data into digital data
• the digital data is sent to the microprocessor
• the microprocessor compares this data with the pre-set value
• if the temperature reading >= pre-set value then no action is taken
• if the temperature reading < pre-set value, then a signal is sent …
• … to an actuator (via a DAC) to open the gas valve to the heater
• … to an actuator (via a DAC) to turn on the water pump
• the process continues until the central heating is switched off.
✓ Chemical process control
• temperature and pH sensors read data from the chemical process
• this data is converted to digital using an ADC and is then sent to the computer
• the computer compares the incoming data with pre-set values stored in memory
• … if the temperature < pre-set °C, a signal is sent to switch on the heater
• … if the temperature >= pre-set °C, a signal is sent to switch off the heaters
• … if the pH > pre-set value, then a signal is sent to open a valve and acid is added
• … if the pH <= pre-set value, then a signal is sent to close this valve
• the computer signals will be changed into analogue signals using a DAC so that it can control
the heaters and valves
• this continues as long as the computer system is activated.
Page 6 of 7
O Level Computer Science P1 Hardware – Input Devices (Sensors) ©N.A DMC 2023
✓ Greenhouse environment control
e.g. controlling humidity
• humidity sensor sends a signal to an ADC, which then sends a digital signal to the computer.
• The processor compares the input with stored (pre-set) values
• … and decides what action needs to be taken
• If humidity is > pre-set value, the computer sends a signal to a DAC to operate the motors to
open windows thus reducing the humidity.
• If it is < pre-set value, the computer sends a signal to open valves to spray water into the air
• If the reading = pre-set value, then no action is taken
• The control process continues as long as the system is switched on.
Reference: Cambridge IGCSE and O Level Computer Science (D. Watson & H. Williams)
Page 7 of 7