This is a quick demo to introduce students to the Lego Mindstorm EV3 and the concept of programming. In this lesson, students will make observations about how a robot moves and reacts to different stimuli in order to reverse engineer the “mystery program”. The robot is programmed into a simple set of two loops, one continuous and one that is triggered by an object in the way of the ultrasonic sensor.
Programs often run in a series of loops (patterns)
Cause and effect (input/output) are important parts of robot programs
Flow charts are an effective way to diagram a program
- Lego Mindstorm EV3 robot – default assembly. Follow the instructions found here to build https://education.lego.com/en-us/support/mindstorms-ev3/building-instructions#robot (color sensor forward, cuboid, driving base, gyro sensor, medium motor driving base, touch sensor driving base, ultrasonic sensor driving base. Note: EV3’s borrowed from the Resource Center will already be built in the default assembly and will be pre-downloaded with Mystery Program)
- Mystery Program worksheet
- Mystery Program open roberta program
- Robot Quick Start Guide
Daly Ralson Resource Center:
Lego Mindstorm EV3 robot (E779, E780, E781, E782, E783, E784, E785)
Groups of 3-4 students
20 min total
5 min – Intro
10 min – investigation
5 min – Discussion/share out
Prerequisites for students
Students have had some practice making observations and taking careful notes. It is also helpful if they have assembled the robot themselves before observing the mystery program, but this is not necessary if you’d like to use preassembled robots.
Learning goals/objectives for students
The students will be able to describe the mystery program using the worksheet provided. The students will observe that input from sensors can change the behavior of the robot (cause and effect). The students will learn that programming can be structured in a series of loops.
Content background for instructor
The program was designed to run in two “loops” or cycles. The program selects the loop by checking the ultrasonic sensor (sensor #4, the sensor located at the base between the two wheels, which almost looks like two eyes). If no object is sensed in front of the ultrasonic sensor, the robot will drive forward and blink a red light. If there is an object sensed within 15 cm of the ultrasonic sensor, the robot will beep twice, roll backwards, and turn to the right. The ultrasonic sensor works similar to bat or dolphin sonar. It generates sound waves and reads their echoes to detect and measure distance from objects. Each time it completes a loop (first or second loop) it checks the ultrasonic sensor again. The second loop (after the double beep) acts as a way for the robot to avoid obstacles in its path by turning.
Download the mystery program on all EV3 robots before class begins. The robots take a few minutes to turn on, so if very little introduction is planned, turn on the robots before class begins as well. If the robots were borrowed from the Resource Center, they should already have the mystery program loaded and ready to go.
Tell the students they will act as reverse engineers. A mystery program has been downloaded on to their robot. They should run this mystery program, make careful observations, and predict how the mystery program might be structured.
Help the students navigate to the programs file on the EV3 robot by pressing one of the side directional buttons. Select mystery program and execute.
The students should be instructed to set their robot on the ground to avoid it running off the table. Have them observe the robot and follow the instructions on the mystery program worksheet. There is one hint on the worksheet: when the robot senses something it will “beep twice” and change its behavior.
After filling out the answers on the front of the worksheet students should work on the back of the worksheet which has the flow chart and spaces to enter the steps of the robot behavior.
Checking for student understanding
Walk around the room and determine whether students are distinguishing between the first loop (drive forward and flash red) and the second loop (beep twice, reverse and turn right). Also ask if they have found which sensor seems to be responding to a stimulus (ultrasonic sensor) and what that stimulus is (presence of an obstacle).
If students are having trouble a great way to observe the program is to pick the robot up and observe it while being held off the ground. Flip the robot upside-down to observe its wheels.
After all groups appear to have finished, complete the worksheet for the class using a large group share-out. It’s helpful here to either have the flow chart drawn on the board or the worksheet projected.
After students have learned how to program using Open Roberta, it is helpful to show them the mystery program in Open Roberta. They can then look at the program and compare it to the worksheet. Is the flow chart similar to the actual mystery program? How accurate is the flow chart? What did it miss?
We’ve also noticed that students will use a version of the mystery program in other programming challenges to help their robots avoid obstacles or reposition themselves if they go off course.
Reverse engineering a program is similar to how scientists observe biological specimens. DNA is a complicated program that is not easy to read. By observing an organism, and making careful observations of its behavior in response to stimuli, biologists and cellular engineers can also “reverse engineer” the DNA code that may be responsible for controlling a cell’s behavior.
HS-ETS1-2 Engineering Design
(To reverse engineer the mystery program, students are encouraged to break down this problem into smaller, more manageable problems, using scaffolding provided in the worksheet.)
Disciplinary Core Ideas
ETS1.C Optimizing the Design Solution
ETS2.A Interdependence of Science, Engineering, and Technology
(Science and engineering are linked and use similar tools to answer complex questions. For example, scientists use a form of reverse engineering to figure out how a cell in “programmed” to respond to certain stimuli, similar to reverse engineering a mystery program in a robot.)
Science and Engineering Practices
Practice 2. Developing and Using Models
Practice 4. Analyzing and Interpreting Data
Practice 5. Using Mathematics and Computational Thinking
Practice 6. Constructing Explanations and Designing Solutions
Cause and Effect
Systems and System Models
Stability and Change