The answersDownload the PDF
Worksheet

F9.8 Embedded systems: inside BugBot

Logic and computer systems · GCSE · OCR J277 1.1.3, AQA 8525 3.4.5, Edexcel 1CP2 3.1.3 · about 15 min

BugBotLab
NameClassDate

What this lesson is about

What makes a system embedded, the robot's three boards, and the sense-decide-act loop.

Questions 5 marks in all

  1. [1 mark]What is an embedded system?

    1. AA computer built into a larger device to control it
    2. BA computer connected to the internet
    3. CA program stored in ROM
    4. DA laptop used in a factory
  2. [1 mark]Which is an embedded system?

    1. AThe controller in a microwave oven
    2. BA desktop PC
    3. CA laptop
    4. DA web server
  3. [1 mark]Which is typical of an embedded system?

    1. AIt does one dedicated job with limited memory
    2. BIt runs many different apps chosen by the user
    3. CIt has a large screen and keyboard
    4. DIt needs the most powerful processor available
  4. [1 mark]Put the steps of the control loop in order.

    Number the lines 1 to 3 to put them in the right order.

    1. Decide: work out what to do
    2. Act: set the outputs
    3. Sense: read the inputs
  5. [1 mark]What does this program print?

    gap = 15
    if gap < 20:
        action = "stop"
    else:
        action = "drive"
    print(action)

The task: a sense-decide-act loop

There is a wall ahead. Write a sense-decide-act loop that drives the robot forward slowly. Each time round: sense the distance; decide; act. While the gap is 20 cm or more, keep driving with a green LED. When it is under 20 cm, stop, turn the LED red, play a tone, and end the loop. Do not hit the wall.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/f9-8-embedded-systems-inside-bugbot/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Add an amber LED when the gap is between 20 and 40 cm, and slow down there.
  2. Add a check of battery() that stops everything below 20%.
  3. List the inputs, processing and outputs of a microwave oven as an embedded system.