Skip to the page
Year 10 · Computer Science · Spring 1 · Hardware

Embedded systems, input and output devices, sensors

PracticalPresent ▶

What this lesson covers

3.1 Computer architecture

Cambridge IGCSE Computer Science 0478 · Topic 3: Hardware · Paper 1

3.2 Input and output devices

Cambridge IGCSE Computer Science 0478 · Topic 3: Hardware · Paper 1

You will learn to

  • Describe an embedded system and how it differs from a general-purpose computer.
  • Describe how common input and output devices work, and choose one for a task.
  • State what a sensor measures, and choose the right sensor for a scenario.

Success criteria

  • I can sort ten devices into embedded and general-purpose, with a reason for each.
  • I can choose a sensor for a greenhouse, a car park and a burglar alarm, and say why.
  • I can explain how the temperature logger uses a sensor and a microprocessor.
The syllabus points for these sections
  • Describe the role of the CPU and what a microprocessor is.
  • Name the parts of the von Neumann architecture: ALU, CU, registers and buses.
  • Describe the fetch–decode–execute cycle, step by step.
  • Explain how cores, cache and clock speed affect performance.
  • Explain what an instruction set is.
  • Describe embedded systems and how they differ from general-purpose computers.
  • Describe how each listed input device works and give a use.
  • Compare resistive, capacitive and infra-red touch screens.
  • Describe how each listed output device works, including DLP and LCD projectors.
  • Compare inkjet, laser and 3D printers.
  • State what each of the 14 sensors measures and choose the right sensor for a task.

Key words

Say each word, then read what it means. Every one is in the glossary too.

CPU
The central processing unit, which processes instructions and data by fetching, decoding and executing them.
Microprocessor
A CPU made as an integrated circuit on a single chip.
Von Neumann architecture
A computer design where instructions and data are stored together in the same memory.
ALU
Arithmetic logic unit: does calculations and logical comparisons.
Control unit
Manages the fetch–decode–execute cycle and sends control signals.
Register
A tiny, very fast store inside the CPU that holds one item.
Bus
A set of parallel wires that carries addresses, data or control signals.
Cache
Small, very fast memory in or near the CPU that holds frequently used data and instructions.
Clock speed
The number of cycles the CPU does each second, measured in hertz.
Core
A complete processing unit; a multi-core CPU can process several instructions at once.
Instruction set
The list of all the instructions a particular CPU can carry out.
Embedded system
A computer system inside a larger device that does one dedicated job.
Sensor
An input device that measures a physical property and sends the reading to a computer.
Actuator
An output device that turns an electrical signal into physical movement.
NIC
Network interface card: the hardware that connects a device to a network.
MAC address
A unique 48-bit address given to a NIC at manufacture, written in hex.
IP address
An address given to a device on a network so data can be sent to it.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

3.1 Computer architecture

The CPU and the microprocessor

The CPU (central processing unit) is the part of the computer that processes instructions and data. It carries out the instructions of every program.

It does this by fetching an instruction from memory, decoding it, then executing it. Then it repeats, billions of times a second.

A microprocessor is a CPU built as an integrated circuit on a single chip. An integrated circuit is a whole electronic circuit made on one small piece of silicon.

e.g.Example
The chip inside a laptop, a phone or a games console is a microprocessor. A microprocessor also sits inside a microwave oven, running its timer.

Von Neumann architecture

Most computers follow the von Neumann architecture. Its key idea is the stored program: instructions and data are both stored in the same main memory.

The CPU has a control unit (CU). The CU manages the fetch–decode–execute cycle. It decodes instructions and sends control signals to the other parts.

The CPU has an arithmetic logic unit (ALU). The ALU does calculations (such as add and subtract) and logic operations (such as comparing two numbers).

The CPU also has registers: very small, very fast stores inside the CPU. The CPU is joined to memory by three buses (sets of wires).

?Why?

Keeping instructions and data in one memory means the computer can run any program you load. Change the program in memory and the same hardware does a new job.

There is a diagram for this step in the IGCSE library.

The five registers

A register holds one item at a time: an address, an instruction or a piece of data.

An address is the number of a location in memory, like a locker number in a school corridor.

RegisterFull nameWhat it holds
PCProgram counterThe address of the next instruction to be fetched
MARMemory address registerThe address of the memory location about to be read from or written to
MDRMemory data registerThe data or instruction that has been fetched from memory, or about to be written to memory
CIRCurrent instruction registerThe instruction that is being decoded and executed right now
ACCAccumulatorThe result of calculations done by the ALU
!Watch out

PC and MAR hold addresses. MDR and CIR hold instructions or data. Mixing these up is the most common error in FDE answers.

The three buses

The address bus carries addresses from the CPU (the MAR) to memory. It is one-way (unidirectional), because only the CPU chooses addresses.

The data bus carries data and instructions between the CPU (the MDR) and memory. It is two-way (bidirectional), because data is both read and written.

The control bus carries control signals from the control unit, such as 'read', 'write' and the clock signal. It is two-way, because devices also send signals back.

!Watch out

Exam answers often say 'the address bus carries data'. It carries addresses only. Data and instructions travel on the data bus.

The fetch–decode–execute cycle

Every instruction goes through the same three stages. Learn the fetch stage in order: it is worth most marks.

Fetch: the address in the PC is copied to the MAR, using the address bus. The PC is incremented (1 is added), so it points to the next instruction. The instruction at that address is sent along the data bus to the MDR. It is then copied from the MDR to the CIR.

Decode: the control unit decodes the instruction in the CIR. It works out what the instruction means and what needs to happen.

Execute: the instruction is carried out. The control unit sends signals on the control bus. If there is a calculation, the ALU does it and the result goes in the ACC. Then the cycle starts again.

e.g.Example
PC = 100. The instruction at address 100 is LOAD 105 (put the value at address 105 into the ACC). Fetch: 100 is copied from PC to MAR → PC becomes 101 → LOAD 105 travels from address 100 to the MDR → copied to the CIR. Decode: the CU sees 'load the value at address 105'. Execute: 105 goes into the MAR → the value at 105 (say 7) comes back on the data bus to the MDR → it is copied to the ACC. ACC = 7. Try it in the toy: its tiny program starts at address 0 (LOAD 5, ADD 6, STORE 7, HALT). Press Step and watch each register change. Notice when the PC goes up by 1.
?Why?

The PC is incremented during fetch, so the CPU always knows where the next instruction is, even while it is busy with the current one.

There is something to try for this step in the IGCSE library.

The instruction set

An instruction set is the list of all the instructions (commands) that a particular CPU can understand and carry out.

Each instruction is a binary code, called machine code. Examples are load, add, store, compare and jump.

The CU decodes instructions using this set. Different CPU families have different instruction sets.

e.g.Example
Most laptops use x86 processors. Most phones use ARM processors. A program compiled for one will not run directly on the other, because their instruction sets are different.

Cores, cache and clock speed

Clock speed is the number of fetch–decode–execute cycles the CPU can do per second, measured in hertz (Hz). A 3.5 GHz CPU has 3,500,000,000 clock ticks per second. Higher clock speed means more instructions per second.

Cache is a small amount of very fast memory inside or next to the CPU. It stores instructions and data that are used often, so the CPU does not have to wait for slower RAM. More cache means fewer slow trips to RAM.

A core is a complete processing unit (with its own ALU, CU and registers). A quad-core CPU has four cores, so it can process four instructions at the same time.

?Why?

All three let the CPU get through more instructions in a given time. That is what 'better performance' means.

!Watch out

Doubling the cores does not double the speed. Cores must communicate with each other, and some programs cannot be split into parts. Raising clock speed also makes the CPU hotter, and cache is expensive, so there are limits.

Embedded systems

An embedded system is a small computer system built inside a larger device, to do one dedicated job.

It uses a microprocessor (or a microcontroller) and usually runs one fixed program stored in ROM.

A general-purpose computer, like a laptop, can run many different programs and do many jobs.

Embedded system examplesWhat it controls
Washing machineWater level, temperature, drum speed for each wash programme
Microwave ovenTimer and power level
Central heatingTurns the boiler on and off using a temperature sensor
Car engine managementFuel and air mix, using many sensors
Traffic lightsThe light sequence and timing
?Why?

Embedded systems are small, cheap to mass-produce and use very little power, because they only do one job. The drawbacks: they are hard to update or change, and they can only do the task they were built for.

3.2 Input and output devices

Keyboard, mouse, microphone and digital camera

An input device sends data into a computer. Many work by turning something physical (light, sound, pressure) into an electrical signal, then into binary.

DeviceHow it worksExample use
KeyboardPressing a key completes a circuit. The computer works out which key it was and looks up its character code (e.g. ASCII or Unicode).Typing an essay
Optical mouseAn LED shines light onto the surface. A tiny camera takes thousands of pictures a second. A chip compares them to work out the direction and speed of movement.Moving the pointer on screen
MicrophoneSound waves make a thin diaphragm vibrate. This creates an analogue electrical signal. An ADC turns it into digital data.Voice calls, voice assistants
Digital cameraA lens focuses light onto a sensor made of millions of light-sensitive cells (one per pixel). Each cell turns light into an electrical value, stored as binary.Taking photos, scanning a QR code with a phone
?Why?

An ADC (analogue-to-digital converter) is needed because the real world is analogue (smooth, continuous values) but a computer can only store digital binary values.

Barcode scanners and QR code scanners

A barcode is a pattern of black and white bars that stands for a number. It is a one-dimensional (1D) code: it is read across only.

A barcode scanner shines a laser or red LED light across the bars. White bars reflect lots of light, black bars reflect very little. A sensor turns the pattern of reflections into the number.

A QR code (quick response code) is a two-dimensional (2D) square of black and white blocks. It is read across and down, so it holds much more data, such as a web address.

A QR scanner is usually a camera, for example on a phone. Software finds the three corner squares, reads the blocks and decodes the data.

e.g.Example
At a Mercadona checkout, scanning a barcode gives the product number. The computer looks it up in a database to find the name and price, and updates the stock level. A QR code on a restaurant table opens the menu web page on your phone.

Touch screens: resistive, capacitive and infra-red

Resistive: two flexible layers with a conductive coating, kept apart by a tiny gap. Pressing pushes the layers together and completes a circuit. The voltage at that point tells the position.

Capacitive: a glass layer with a conductive coating holds an electrostatic charge. Your finger conducts electricity, so it changes the charge where you touch. Sensors measure the change and calculate the position.

Infra-red: a grid of invisible infra-red beams runs across the screen from LEDs to sensors on the edges. A touch breaks some beams. The broken beams across and down give the position.

TypeAdvantagesDisadvantages
ResistiveCheap. Works with gloves or any stylus.Less clear image and poor in sunlight. Top layer can scratch or wear. Usually no multi-touch.
CapacitiveVery clear image. Durable glass. Supports multi-touch (pinch to zoom).Only works with a bare finger or a special stylus, not normal gloves.
Infra-redWorks with any object, including gloves. Multi-touch. Clear glass.More expensive. Dirt or an object on the edge can block beams and cause false touches.
e.g.Example
A phone uses capacitive. A cheap self-service kiosk or a satnav may use resistive. A large classroom touch board often uses infra-red.

2D and 3D scanners

A 2D scanner copies a flat document or photo. A bright light moves along under the glass. Light reflected from the page is directed by mirrors and a lens onto a light sensor, which turns it into a digital image.

Software called OCR (optical character recognition) can then turn a scanned page into editable text.

A 3D scanner captures the shape of a solid object. It shines lasers or patterns of light at the object from many angles. It measures distances to thousands of points and builds a digital 3D model.

e.g.Example
2D: a school office scans a signed permission letter to email it. 3D: a hospital scans a patient's leg to design a prosthetic that fits; the model can then go to a 3D printer. Medical CT and MRI scanners also make 3D images.

Screens, speakers and actuators

An output device takes data from the computer and turns it into something people can see, hear or feel, or into movement.

DeviceHow it worksExample use
LCD screenLiquid crystals do not make light. A backlight (usually LEDs) shines through them. Each crystal twists to block or let light through red, green and blue filters.Laptop and monitor screens
LED screenEach pixel is made of tiny red, green and blue LEDs that give out their own light. Mixing their brightness makes each colour.Giant outdoor screens, stadium scoreboards
SpeakerDigital sound goes through a DAC (digital-to-analogue converter) and an amplifier. The current moves a coil and cone back and forth, which vibrates the air.Music, alarms, screen readers
ActuatorA motor, valve, pump or switch that turns an electrical signal into physical movement.Opening a greenhouse window, turning on a heater, moving a robot arm
!Watch out

A sensor is an input; an actuator is an output. In a control system the sensor measures, the microprocessor decides and the actuator acts.

DLP and LCD projectors

A projector shows a computer image on a large screen or wall.

DLP (digital light processing): a chip holds millions of tiny mirrors, one per pixel. Each mirror tilts towards or away from the light thousands of times a second to make light or dark. A spinning colour wheel adds red, green and blue.

LCD projector: a bright light is split into red, green and blue. Each colour passes through its own small LCD panel, which blocks or lets through light for each pixel. A prism joins the three images and a lens projects it.

DLP projectorLCD projector
AdvantagesHigher contrast, deeper blacks. Smaller and lighter. Fewer parts to wear out.Brighter, richer colours. Sharper image. Usually cheaper.
DisadvantagesColours less vivid. Some people see a 'rainbow' flicker. Can be noisy.Lower contrast, greys instead of black. Pixels can be visible. Panels can fade over time.

Inkjet, laser and 3D printers

Inkjet printer: a print head moves across the paper. Tiny nozzles spray droplets of liquid ink, using heat or vibration. The paper moves forward a line at a time.

Laser printer: a laser draws the page as a pattern of static electric charge on a rotating drum. Powdered ink called toner sticks to the charged areas. The toner is rolled onto the paper, then a fuser heats it so it melts and sticks.

3D printer: builds a solid object layer by layer from a digital design. Common methods melt plastic through a hot nozzle, or harden liquid resin with ultraviolet light.

PrinterBest forDrawbacks
InkjetFew copies, high-quality photos; printer is cheap and smallSlow for many pages; ink cartridges are expensive; wet ink can smudge
LaserMany pages quickly, e.g. a school office; sharp text; low cost per pagePrinter costs more; toner is dearer to replace; can release ozone and fine dust
3DPrototypes, custom parts, prosthetic limbs, modelsSlow; limited materials; can be expensive

What a sensor is

A sensor is an input device that measures a physical property, such as temperature or light, and sends the reading to a computer.

Most sensors give an analogue signal. An ADC converts it to digital so the microprocessor can use it.

A sensor only measures. It does not decide anything or switch anything on. The microprocessor compares the reading with a stored value and decides.

e.g.Example
Greenhouse: the temperature sensor reads 31 °C. The microprocessor compares this with the set value of 25 °C. It is too hot, so it sends a signal to an actuator that opens a window.

The 14 sensors

Learn what each sensor measures, then one example use. In the exam, pick the sensor that measures exactly what the scenario needs.

SensorWhat it measuresExample use
AcousticSound levelsBurglar alarm hearing breaking glass; noise monitoring near Barajas airport
AccelerometerAcceleration, movement and tiltPhone screen rotating; car airbag; step counter
FlowRate of flow of a liquid or gasWater pipes; fuel in an engine; breathing machine in hospital
GasPresence or amount of a gas (e.g. carbon monoxide, CO2, oxygen)Carbon monoxide alarm at home; CO2 level in a greenhouse
HumidityAmount of water vapour in the airGreenhouse; museum or server room climate control
Infra-redInfra-red radiation (heat), or a broken infra-red beamBurglar alarm detecting a warm body; automatic doors
LevelHow full a container is (level of a liquid or solid)Fuel tank gauge; river flood warning; washing machine water level
LightBrightness of lightStreet lights turning on at dusk; phone screen auto-brightness
Magnetic fieldStrength and direction of a magnetic fieldPhone compass app; door and window alarm with a magnet
MoistureAmount of water in a material, e.g. soilAutomatic watering of crops or school garden
pHHow acidic or alkaline a liquid or soil isSwimming pool chemicals; checking a river for pollution
PressureForce or pressure on the sensor (including air or liquid pressure)Pressure mat in a burglar alarm; tyre pressure; weather stations
ProximityHow close an object is, without touching itPhone screen turning off at your ear; car parking sensors
TemperatureHow hot or cold something isCentral heating; greenhouse; fridge; oven
e.g.Example
Try it in the toy: read each scenario and pick the sensor. For a plant that must not dry out, choose moisture, not humidity: moisture is water in the soil, humidity is water in the air.
!Watch out

Moisture and humidity are a classic trap. Also, a light sensor does not detect people; to detect a person, use infra-red, pressure or proximity.

There is something to try for this step in the IGCSE library.

Study it

Open the study page and go one step at a time.

Build it

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.