📘 CodingMarble Learn

Embedded Systems

An embedded system is a small computer built inside a bigger product to do one job, like a washing machine or a traffic light. It reads sensors (input), runs a program on a microcontroller (process) and drives actuators like LEDs and motors (output). The program repeats in a loop and uses variables, conditions and events. Smart objects send their data to other devices using protocols such as Bluetooth or Wi-Fi.

🎬 Step-by-step story

  1. This tiny computer, a microcontroller, hides inside a machine. That is an embedded system.
  2. Input: a sensor measures the world. This light sensor sends a number from 0 to 1023.
  3. Process: the program checks a rule: "if light < limit, then…". The check repeats again and again in a loop.
  4. Output: an actuator acts. It got dark, so the LED turns on. All this happens faster than a blink.
  5. One board can do many jobs: if it is hot, the fan motor also runs.
  6. Try it: move the light and limit sliders. Predict when the LED turns on, then check.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Is my phone an embedded system?

A phone is a general computer, but it contains many embedded systems: the camera controller, the battery manager, the touch chip.

Why does the sensor give 0 to 1023 and not lux?

The ADC turns voltage into a 10-bit number. We can convert it to real units with a formula if we need to.

Why must the check be inside a loop?

Light changes over time. Without a loop the board would check once and never notice it got dark.

How fast does the LED respond?

A loop can run thousands of times a second, so the change looks instant to us.

Can one microcontroller run two rules?

Yes. The loop checks light and temperature one after another, very fast.

What is an embedded system?

An embedded system is a computer built inside another product to do one fixed job. You do not see it as a computer.

Microcontroller

The brain is a microcontroller: one chip with a processor, memory (to store the program and data) and input/output pins. A normal PC uses a microprocessor, which needs separate memory chips.

Hobby and school boards (such as Arduino-style boards or micro:bit-style boards) put a microcontroller on a board with pins, a USB port and a power supply.

Sensors and actuators

Every embedded system follows input → process → output.

Sensors (input)

Actuators (output)

Programming embedded systems

Most programs have two parts: setup (runs once) and loop (runs forever).

setup: make pin 13 an output
loop:
  light = read sensor
  if light < 300:
      LED on
  else:
      LED off
  wait 100 ms

A flowchart or state diagram helps plan the program before writing code. Test it, then debug.

Smart objects and protocols

A smart object is an embedded system that talks to other devices: the Internet of Things (IoT).

Things to think about: battery life, cost, safety and data privacy.

Key formulas and definitions

Worked examples

1. Name the input, process and output in an automatic street light.

Input: light sensor. Process: microcontroller checks if light is below a limit. Output: lamp switched on through a relay.

2. A 10-bit ADC with 5 V reference reads 2.5 V. What number does it give?

(2.5/5) × 1023 ≈ 511.

3. Write a rule so a fan runs above 30 °C.

if temperature > 30: fan on, else: fan off — inside the loop.

4. Why use an event (interrupt) for a door button instead of checking in the loop?

The board can sleep and wake only when the button is pressed, saving battery and never missing a quick press.

5. A soil sensor gives 0 (wet) to 1023 (dry). Plan a plant-watering system.

Loop: read sensor; if value > 700, switch pump on for 3 s; wait 10 minutes; repeat.

Common mistakes

Practice quiz

1. Which of these is an embedded system?
2. A sensor is a:
3. A microcontroller contains:
4. Which is an actuator?
5. Bluetooth and Wi-Fi are examples of:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is an embedded system with example?

A small computer inside a product for one job, for example a microwave oven controller or an automatic street light.

What is the difference between a sensor and an actuator?

A sensor measures something (input); an actuator does something, like light up or move (output).

What is the difference between a microcontroller and a microprocessor?

A microcontroller has CPU, memory and I/O on one chip for a fixed job; a microprocessor is just the CPU and needs external memory.

Where this is taught

England (GCSE, A level)Year 9Technical knowledge
Japan高校(専門学科)1〜3年Hardware Technology
FrancePremièreCompetences and content

Learn first

Learn next

Related lessons

All Computer Science lessons