Grade by GradeEssential student suppliesSign in
Applied Design, Skills, and Technologies · Design and Build: Grade 8 Designers, Builders and Coders

Robotics: Sensors, Control and Circuits

BC ADST 8: types of sensors BC ADST 8: control systems BC ADST 8: program flowAbout 45 minutes
Learning goals
  • I can describe types of sensors and how robots use them to respond to their surroundings.
  • I can compare user and autonomous control, and explain what end effectors do.
  • I can follow program flow in a robot program, and read a simple circuit schematic.

Words to know

sensor
A part that detects something about the surroundings, such as light, sound, touch or distance.
autonomous
Able to act on its own, using sensors and a program, without a person steering it.
end effector
The tool at the end of a robot arm that does the job, such as a gripper or suction cup.
program flow
The order in which a program's instructions run, including loops and decisions.
schematic
A diagram of a circuit that uses standard symbols for each component.
resistor
A component that limits how much electric current flows.

Robots near you

A robot is a machine that can sense its surroundings, make decisions with a program and act. Robots are used in many B.C. and Canadian settings:

  • remotely operated vehicles that explore the deep ocean off the B.C. coast,
  • robotic milking systems on some dairy farms,
  • automated sawmills and warehouses that scan, sort and move materials,
  • the Canadarm robotic arms built in Canada for the space shuttle and the International Space Station.

Many people describe what robots do as a loop: sense, think, act. This is a common way to teach robotics.

SENSEsensors readthe worldTHINKprogram decideswhat to doACTmotors and endeffectors movethe robot senses the result and repeats
The sense-think-act loop, a common teaching model for how robots work.
SensorWhat it detectsExample use
Bump (touch)Physical contact; a switch is pressedA robot vacuum backs up when it hits a wall
MotionMovement nearby, often of warm bodiesA security light turns on when someone walks by
SoundLoudness of soundA robot starts when you clap
LightBrightness, or light versus darkA robot follows a black line on a white floor
InfraredInfrared light, used to measure distance or receive remote signalsA robot stops before it reaches an obstacle
Five sensor types given as examples in the B.C. Grade 8 Robotics module.

Who is in control?

  • User control: a person makes the decisions, using a remote control, joystick or app. A deep-sea vehicle steered by a pilot on a ship is user-controlled.
  • Autonomous control: the robot uses its sensors and program to decide by itself. A robot lawn mower that turns at the edge of the grass is autonomous.

Many robots mix both, for example a drone that a person steers but that holds its height by itself.

End effectors

The end effector is the business end of a robot arm. Grippers pick things up, suction cups lift flat objects like boxes or glass, magnets lift steel, and other end effectors weld, paint, drill or sort. Choosing the right end effector is a design decision: a gripper for eggs needs a gentle touch.

when program starts
repeat forever
read distance from infrared sensor
if bump sensor is pressed then
stop motors
drive backward for 1 second
turn right 90 degrees
else if distance < 20 cm then
turn right 45 degrees
else
drive forward
end if
end repeat

Pseudocode for an autonomous robot that avoids obstacles. The loop and the if / else if / else decisions control the program flow.

Worked example

Following the program flow

The robot runs the program above. On three passes through the loop, the sensors read: (1) bump not pressed, distance 50 cm; (2) bump not pressed, distance 15 cm; (3) bump pressed, distance 3 cm. What does the robot do each time?

  1. Pass 1: Is the bump sensor pressed? No. Is 50 < 20? No. So the else runs: drive forward.
  2. Pass 2: Bump pressed? No. Is 15 < 20? Yes. So it turns right 45 degrees.
  3. Pass 3: Bump pressed? Yes. The first branch runs: stop, back up for 1 second, turn right 90 degrees. The other branches are skipped, even though 3 < 20.
  4. After each pass, repeat forever sends the program back to read the sensors again.

Forward, then a 45-degree turn, then stop, back up and a 90-degree turn. The order of the checks matters: the bump check comes first, so it wins.

Circuits and components

Robots are built from electronic components. A schematic shows how they connect using standard symbols.

  • LED (light-emitting diode): lights up when current flows the right way. The longer leg is usually the positive side.
  • Resistor: limits current so parts such as LEDs don't burn out.
  • Diode: lets current flow in one direction only.
  • Capacitor: stores a small amount of electric charge for a short time.
  • Transistor: an electronic switch (or amplifier) that lets a small signal control a bigger current, such as for a motor.

To choose a resistor for an LED, a common rule uses Ohm's law: R = (supply voltage - LED voltage) / current, with current in amperes (20 mA = 0.020 A).

For the circuit below: R = (5 - 2) / 0.020 = 3 / 0.020 = 150 ohms.

+5 VbatteryLED2 V, 20 mAresistor: 150 ohmscurrent
A schematic of a 5 V battery, a 150-ohm resistor and an LED in one loop. The long battery plate is positive, and the LED's triangle points the way conventional current flows.

Build safely

Try circuits on a breadboard first, which needs no soldering. If you solder, do it only with an adult or teacher, wear safety glasses, use fume extraction, keep the hot iron in its stand and wash your hands afterward. Never connect a battery's two ends directly with a wire: that short circuit can make the wire and battery dangerously hot.

Hands-on activity

Plan a line-following robot

  1. On paper, design a robot that follows a dark line using one light sensor. Draw where the sensor goes.
  2. Write pseudocode: if the sensor sees dark, turn slightly left; else turn slightly right, inside a forever loop.
  3. Trace it for 4 sensor readings: dark, light, light, dark.
  4. If you have a robotics kit at school (such as VEX IQ or LEGO robotics) or a free online robot simulator, build and test it with your teacher's guidance. Change one value at a time, such as turn speed.
  5. Write which sensor, control type and end effector (if any) your robot uses.
Word fact

The word robot first appeared in a 1920 play called R.U.R. by Czech writer Karel Čapek. It comes from the Czech word robota, meaning forced labour.

Let's practise

1

Which sensor would help a robot follow a black tape line?

2

Is a robot vacuum that cleans a room by itself user-controlled or autonomous?

3

Name a good end effector for lifting cardboard boxes in a warehouse, and explain.

4

Using the program in this lesson, what does the robot do if the bump sensor is not pressed and the distance is 25 cm?

5

Find the resistor for an LED (2 V, 20 mA) powered by a 9 V battery.

6

What does a transistor do in a robot circuit?

More practice

1

Name the five types of sensors in this lesson.

2

Find the resistor for an LED (2 V, 10 mA) on a 3.3 V supply.

3

Why does the order of the if-checks matter in the obstacle program?

4

Give one example of a robot that uses both user and autonomous control.

5

Why should you solder with fume extraction?

Check your understanding

Quiz

1.

A robot needs to stop before it touches a wall. Which sensor is best?

2.

A pilot steers an underwater vehicle with a joystick. This is...

3.

What is the resistor value for an LED (2 V, 20 mA) on a 6 V supply?

4.

The gripper at the end of a robot arm is called the...

For parents and teachers

How to help at home: Look for robots and sensors around you: automatic doors, motion lights, robot vacuums, self-checkouts. Ask your child to say what each one senses, decides and does. If you build circuits, use a breadboard and supervise any soldering closely.

Common mistakes: Mixing up light and infrared sensors, forgetting that only the first true branch of an if / else if runs, putting an LED in backwards, and forgetting to change milliamps to amperes (20 mA = 0.020 A).