---
title: Code aMAZEing to the Rescue
description: Develop a route to bring a safety line to trapped people in a building by programming an autonomous moving robot to navigate through the building.
image: https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/image8.jpg
---

[![Sparkfun](https://www.sparkfuneducation.com/img/logo.png)](https://www.sparkfuneducation.com/index.html)

- [SparkFun Webstore](https://www.sparkfuneducation.com)
- [Higher Ed](https://sparkfuneducation.com/higher-ed/index.html)
- [Contact Us](https://www.sparkfuneducation.com/contact-us.html)
- [Follow Us](https://twitter.com/SparkFunEDU)

- [Home](https://www.sparkfuneducation.com)
- [Blog](https://blog.sparkfuneducation.com)
- [Curriculum](https://www.sparkfuneducation.com/curriculum.html)
- [PD/Events](https://www.sparkfuneducation.com/professional-dev.html)
- [KITS/Materials](https://www.sparkfuneducation.com/materials.html)
- [Educator Stories](https://www.sparkfuneducation.com/educator-stories.html)
- [Activities](https://activities.sparkfuneducation.com)

![STEAM Classroom Download](https://activities.sparkfuneducation.com/hs-fs/hubfs/EDU/Activities/jeff-classroom-backgroun.jpg?width=1440&name=jeff-classroom-backgroun.jpg "STEAM Classroom Download")

![steam-activities-2](https://activities.sparkfuneducation.com/hs-fs/hubfs/EDU/Activities/steam-activities-2.png?width=600&name=steam-activities-2.png "steam-activities-2")

Bringing maker education and computational thinking to the classroom.

## Latest Activities

Search this site on Google

S

[Michael Jones](https://activities.sparkfuneducation.com/author/michael-jones)

Dec 13, 2019

## [How Turbid is Your Pond? Using Comput...](https://activities.sparkfuneducation.com/how-polluted-is-your-pond-using-computer-systems-to-monitor-the-environment)

[Arduino](https://activities.sparkfuneducation.com/topic/arduino)

<https://activities.sparkfuneducation.com/how-polluted-is-your-pond-using-computer-systems-to-monitor-the-environment>

[![Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/hs-fs/hubfs/agc_headshot.jpg?width=20&name=agc_headshot.jpg) Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/author/alexandra-gendreau-chakarov)

Oct 15, 2019

## [Monitor My Plant](https://activities.sparkfuneducation.com/monitor-my-plant)

[micro:bit](https://activities.sparkfuneducation.com/topic/microbit)

<https://activities.sparkfuneducation.com/monitor-my-plant>

[![Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/hs-fs/hubfs/agc_headshot.jpg?width=20&name=agc_headshot.jpg) Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/author/alexandra-gendreau-chakarov)

Oct 14, 2019

## [Classroom Noise Monitor with micro:bi...](https://activities.sparkfuneducation.com/classroom-noise-monitor)

[micro:bit](https://activities.sparkfuneducation.com/topic/microbit)

<https://activities.sparkfuneducation.com/classroom-noise-monitor>

[![Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/hs-fs/hubfs/agc_headshot.jpg?width=20&name=agc_headshot.jpg) Alexandra Gendreau Chakarov](https://activities.sparkfuneducation.com/author/alexandra-gendreau-chakarov)

Oct 14, 2019

## [micro:bit Light and Music Show](https://activities.sparkfuneducation.com/light-and-music-show)

[micro:bit](https://activities.sparkfuneducation.com/topic/microbit)

<https://activities.sparkfuneducation.com/light-and-music-show>

## Featured Stories

- [micro:bit](https://activities.sparkfuneducation.com/topic/microbit)
- [Arduino](https://activities.sparkfuneducation.com/topic/arduino)

![](https://cdn2.hubspot.net/hubfs/459002/Author_Blog.png)

 By

[Suzanne Banas](https://activities.sparkfuneducation.com/author/suzanne-banas)

 August 06, 2019

<https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Factivities.sparkfuneducation.com%2Fcode-amazeing-to-the-rescue> <https://www.twitter.com/share?url=https%3A%2F%2Factivities.sparkfuneducation.com%2Fcode-amazeing-to-the-rescue> <http://www.linkedin.com/shareArticle?mini=true&url=https://activities.sparkfuneducation.com/code-amazeing-to-the-rescue>

## [Code aMAZEing to the Rescue](https://activities.sparkfuneducation.com/code-amazeing-to-the-rescue)

  [Arduino](https://activities.sparkfuneducation.com/topic/arduino)

 **Activity Name:**

Code aMAZEing to the Rescue

**Grade Level:**

Grade 8 (Could work for grades 7 to 11)

**Time Required:**

110 minutes

 

**Prerequisite:**

Each student needs to be familiar with the basics of drive forward & turning. It may be helpful to review experiments two and three in the [SparkFun Inventor's Kit for RedBot Experiment Guide](https://learn.sparkfun.com/tutorials/experiment-guide-for-redbot-with-shadow-chassis?_ga=2.16745525.2000185260.1565112230-1325725952.1470332287) with students prior to introducing this lesson.

 

**Expendable Cost:**

- Masking or blue/green removable tape

 

**Group Size:**

 2-3 students. (One robot and one computer per group)

 

**Subject area:**

algebra, computer science, geometry, measurement, physical science, physics, problem-solving, reasoning & proof, science & technology

 

**Summary:**

In this lesson, using code from previous experiments (drive forward and turning), students will use the code to develop a sequence of coded movements to have their robots autonomously move through a maze (or pathway). Students will also use measurements and conversions of units of time into distance traveled to create the coded pathway. The whole lesson theme is developing a route to bring a safety line to trapped people in a building through an autonomous moving robot .

 **Keywords:**

code, vectors, drive forward, turning, maze, pathways, problem-solving, robotics

 

**Educational Standards:**

*NGSS*

- HS-ETS1-4

 

**Learning Objectives:**

- Use the code(s) (Drive Forward/Turning). Students will use these code(s) to develop a sequence of coded movements to have their robots autonomously move through a maze (or pathway). 
    - Students will use a scale model, take measurements, and convert to real or larger scale
    - Students will also convert units of time into distance traveled
    - Students will use a sale model, and measure the degree of turn
    - Students will use the mathematical measurements, convert to codes, and develop a sequence of movements for the robot to follow
    - Students will understand how automation works and use algorithmic thinking to develop a sequence of steps to create and test their automated solutions
- By having the students asking questions and defining problems, it will build experiences which will progress to formulating, refining, and evaluating their design problems using models and simulations.
- Students will be using mathematical and computational thinking skills which will build on their experiences and progresses in their development of the coded sequence.
- Students will be using computational simulations.

**Materials List:**

- SparkFun Inventor's Kit for RedBot
- Computer with Arduino CC software loaded
- Connector cable
- Meter stick and ruler
- Protractor
- Stop watch/timer
- Pre-set to scale maze/pathway for each group (See [Appendix B](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf))
- Paper or tape to outline maze/pathway on the floor
- Print outs of the [Appendices](https://activities.sparkfuneducation.com/hubfs/Code%20aMAZEing%20-%20Appendix.pdf)for each group - includes Drive Forward code, maze diagrams and tracking chart

**Introduction / Motivation:**

Today we have been tasked with how to send a robot through a damaged building. *(show an image of a collapse building- see below for example)* There are people trapped at some point within the building. A robot needs to carry a line that will have light and communications in it to the trapped people. Since you can't see, you can’t manually control the robot. You will have to allow the robot to autonomously maneuver to these people. As the Robotic Engineer(s), your team will have to code your robot to the designated area to reach the trapped people. We have been provided the plans for the building. *(Show the plans for the building- in [Appendix B](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf))*.

 

Using the plans, your team will have to measure and record the pathway/route your team plans on traversing. Your team will have to know each distance and the angles to turn. Remember, the plans are a small scale version of the actual building. Your team will have to convert your data to match. You all have learned the basics of coding these robots – So what do you think you can do to get this cable to these people? *(Answer- code the robot to maneuver through the hallways – code the robot to follow a very specific path and turns)* What information do you need to know to get the robot to autonomously get to these people? *(the actual measurements; length of each part of a hallway, the turns, degree of turn, direction of turn, etc)*

 

Here is our building and where the people are trapped. *(Place scenario 1 on the interactive whiteboard board- smaller scale)* I am giving each group their own floor plan with the scale. Make sure you take accurate measurements and degrees of turns. You will write the code for the robot to autonomously travel to the trapped people. Time is of the essence.

 

![collapsed room](https://activities.sparkfuneducation.com/hs-fs/hubfs/EDU/Activities/2019/Code%20aMAZEing/image2.jpg?width=600&name=image2.jpg)

 

**Procedure:**

*Before the Activity*

- Tape a to-scale path to be placed on the floor (you could use paper to outline the pathway or tape)
- Gather materials and make copies of the building plan
- Have image of collapsed building posted
- Question that needs to be addressed someplace: you have coded the robot to drive forward using time – what is the distance of that time?
- Ensure that the students have used and practiced using the Drive Forward and Turning code experiments. See [Appendix A ](https://activities.sparkfuneducation.com/hubfs/Code%20aMAZEing%20-%20Appendix.pdf)

 

![RedBot path](https://activities.sparkfuneducation.com/hs-fs/hubfs/EDU/Activities/2019/Code%20aMAZEing/image8.jpg?width=600&name=image8.jpg)

*With the Students*

1. Divide the class into pairs and provide handouts of [Appendix C](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf) to each group.
2. Review background information.
3. Each Robotic Engineering Team needs to:
4. Once you know how far your robot travels in a specific time frame and how to turn corners you can now begin the adventure.
5. Review the building plans/map/maze and decide what route you plan to take to get to the trapped people.
6. On the plans/map/maze measure out the distances and turn angles you will need. Remember the paper map is one scale and the map on the floor is another scale. See [Appendix B](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf).
7. On your team’s scale drawing, draw the desired pathway/route.
8. Measure the distances and turn angles and turn directions from that scale drawing.
9. Record these measurements (data) on the [chart in Appendix C](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf).
10. Do conversion calculations on the chart.
11. Write your code based on your mapped-out route.
12. Test the route and revise the code.
13. Whole class trials/competition to see how everyone does.

![maze through room](https://activities.sparkfuneducation.com/hs-fs/hubfs/EDU/Activities/2019/Code%20aMAZEing/image12.png?width=600&name=image12.png)

| Route (Steps Command) | Scale Drawing Measurements | Measurements Needed for Actual Drawing | Distance Converted to Time | Code Language |
| --- | --- | --- | --- | --- |
| 1. Go forward | 9cm | 180cm | 1.7 sec |   |
| 2. Turn right | 90' |   |   |   |
| 3. Go forward | 5cm | 100cm | 0.4 sec |   |
| 4. Turn left | 90' |   |   |   |
| 5. Go forward | 3cm | 60cm | 0.5 sec |   |
| 6. Turn left | 90' |   |   |   |
| 7. Go forward | 4cm | 80cm | 0.72 sec |   |
| 8. Turn right | 90' |   |   |   |
| 9. Go forward | 5cm | 100cm | 0.9 sec |   |

\* Scale is 1cm to 20cm. *Distance traveled in 2 secs = 110cm or 1 sec= 55cm*

 

 **Troubleshooting Tips:**

- My RedBot is not driving straight! It drives in a curve! This is a pretty common thing for the RedBot, and for all robots with independent drive wheels. There are lots of reasons for it, but it's something that simply must be dealt with.
- If your RedBot isn't turning 90 degrees, there are two things you can adjust.

*Going Further:*

1. Develop more complex building plans (some provided, see [Appendix B](https://activities.sparkfuneducation.com/hubfs/EDU/Activities/2019/Code%20aMAZEing/Code%20aMAZEing%20-%20Appendix.pdf))
2. Chose different areas to get to, this increases distances, number of turns, etc
3. More turns and pathways, angles that are not 90 degrees.

![](https://static.hubspot.com/final/img/content/email-template-images/placeholder_200x200.png)

### Subscribe Email

### Popular Activities

<https://activities.sparkfuneducation.com/keep-out-make-an-electronic-safe-with-remote-alarm>

[Keep Out! Make an Electronic Safe with Remote Alarm](https://activities.sparkfuneducation.com/keep-out-make-an-electronic-safe-with-remote-alarm) Aug 13, 2019

<https://activities.sparkfuneducation.com/classroom-noise-monitor>

[Classroom Noise Monitor with micro:bit](https://activities.sparkfuneducation.com/classroom-noise-monitor) Oct 14, 2019

<https://activities.sparkfuneducation.com/heart-rate-monitor>

[Heart Rate Monitor](https://activities.sparkfuneducation.com/heart-rate-monitor) Oct 10, 2019

### Popular Tags

[micro:bit](https://activities.sparkfuneducation.com/topic/microbit) [Arduino](https://activities.sparkfuneducation.com/topic/arduino)

[Tweets by @SparkFunEDU](https://twitter.com/SparkFunEDU)

[Previous Post](https://activities.sparkfuneducation.com/wont-you-take-me-to...coding-town)

##### [Won’t you take me to...Coding Town!](https://activities.sparkfuneducation.com/wont-you-take-me-to...coding-town)

[Next Post](https://activities.sparkfuneducation.com/keep-out-make-an-electronic-safe-with-remote-alarm)

##### [Keep Out! Make an Electronic Safe with Remote Alarm](https://activities.sparkfuneducation.com/keep-out-make-an-electronic-safe-with-remote-alarm)

[![SparkFun Education](https://www.sparkfuneducation.com/img/logo.png)](http://www.sparkfuneducation.com/index.html)

#### Other Resources

- [Contact Us](http://www.sparkfuneducation.com/contact-us.html)
- [About SparkFun](http://www.sparkfun.com)
- [FAQs](https://www.sparkfun.com/static/faq)

- [Customer Service](https://www.sparkfun.com/support)
- [Shipping](https://www.sparkfun.com/support)
- [Terms and Conditions](https://www.sparkfun.com/terms)

#### Sign Up for Newsletter

© Copyright 2016. All Rights Reserved.