Session 2: Turning Corners: Geometry in Motion
Session Architect: Muhammad Bilal
Duration: 50-60 minutes
Equipment Required:
- M3D Robotics kit
- Laptops with Arduino IDE pre-installed
- USB/OTG cables to connect the robot to the laptop
- Rulers, protractors, and paper to draw shapes (square, triangle, zig-zag paths)
Learning Objectives:
- Understand how to program the robot to make precise turns using the concept of angles.
- Learn how to use the go.spinAngle() command to make the robot rotate to specific angles.
- Apply basic geometry concepts (angles, turns) to make the robot follow different paths.
- Experiment with movement patterns like squares, triangles, and zig-zag paths using accurate turns.
1. Introduction to Angles and Turning (10 minutes)
Activity:
Start with an interactive physical activity to get students to understand angles and turning through their own body movements.
Objective:
Help students connect the concept of turning to specific angles in a fun, engaging way, making it relatable to their physical movements.
Instructions:
- Start with a Physical Activity:
Gather the class in an open space and ask a few students to stand in front of the class.
“When you’re standing still and want to turn, you can turn just a little, halfway around, or all the way around. But, between standing straight and turning completely left or right, there are lots of directions where you can stop.”
- Turn Left, Right, and in Between:
Ask the students to first stand straight and then make a simple turn to the right:
“Let’s start by turning right at a 90-degree angle. That’s like facing the wall next to you.”
Then ask them to turn left at 90 degrees.
“Now, turn left by 90 degrees—now you’re facing the other wall.”
Demonstrate how they could stop anywhere in between:
“But you don’t have to turn exactly 90 degrees. You could stop halfway, like at 45 degrees.”
- Introduce the Concept of Angles:
Bring the concept of angles into the discussion:
“The amount you turn is called an angle. If you turn just a little, it’s a small angle like 45 degrees. If you turn all the way to face the opposite direction, that’s 180 degrees.”
Have students try out different angles by giving them directions:
“Turn halfway to the right—that’s 45 degrees. Now turn halfway to the left—that’s also 45 degrees, but in the opposite direction.”
- Relating to the Robot:
Once the students have tried turning to different angles, explain how the robot also uses angles to know how much to turn:
“Just like you turned to different angles, our robot needs to know exactly how much to turn. We tell it to turn by specifying the angle—90 degrees for a right turn, 180 degrees for a U-turn, or 45 degrees for a small adjustment.”
- Introduce the go.spinAngle() Command:
Explain how the go.spinAngle() command works:
“In our code, we use the command go.spinAngle() to tell the robot how much to turn. If we want it to turn 90 degrees, we write go.spinAngle(90);, and if we want it to turn left, we use a negative angle like go.spinAngle(-90);.”
2. Coding Precise Turns (15 minutes)
Activity:
Students will learn how to program the robot to turn at different angles using the go.spinAngle() command. They will practice making the robot turn specific angles, such as 90 degrees or 180 degrees.
Instructions:
-
Example Code for Precise Turns:
- Start by showing a simple example of how to code the robot to make a 90-degree turn:
void setup() { go.begin(); // Initialize the robot } void loop() { go.forward(50); // Move forward at 50% speed delay(1000); // Wait for 1 second go.spinAngle(90); // Turn right 90 degrees delay(1000); // Wait for 1 second go.forward(50); // Continue moving forward } -
Explaining the Code:
Walk students through the code:
“In this example, the robot moves forward, stops, turns 90 degrees, and then continues moving forward. The angle tells the robot how far to turn.”
- Experiment with Different Angles:
Ask students to experiment by changing the angle values in their code. For example, try turning 45 degrees or making a half-turn of 180 degrees.
3. Drawing Paths with Precise Turns (20 minutes)
Activity:
Students will apply their understanding of angles by programming the robot to follow different paths (square, triangle, or zig-zag) using the go.spinAngle() command in combination with basic movement commands.
Instructions:
- Drawing Shapes and Paths:
- Hand out protractors, rulers, and paper for students to draw simple shapes on the floor or table, like squares or triangles.
- Explain how each turn corresponds to an angle:
“To make the robot follow a square path, it needs to make four 90-degree turns. For a triangle, it needs to make three 120-degree turns.”
-
Programming the Robot to Follow the Path:
- Guide students through writing the code to make the robot follow the shapes they’ve drawn. For example, to make the robot move in a square:
void setup() { go.begin(); // Initialize the robot } void loop() { go.forward(50); // Move forward delay(2000); // Wait for 2 seconds go.spinAngle(90); // Turn 90 degrees } }
- Help them understand that since the instructions are a part of void loop() {}, they will be executed again and again.
For these challenges, you may have the path drawn on a sheet of paper so that students can visualize if the robot is tracing the desired path in a better way.
Challenge 1: Navigate a Square Path
Objective:
Program the robot to move in a perfect square path by using 90-degree turns.
Instructions:
- Students should code the robot to move forward for a set distance and then make a 90-degree turn.
Example Code:
void setup() {
go.begin(); // Initialize the robot
}
void loop() {
go.forward(50); // Move forward
delay(2000); // Wait for 2 seconds
go.spinAngle(90); // Turn 90 degrees
}
}
Challenge 2: Create a Triangle Path
Objective:
Program the robot to move in a triangle by using 120-degree turns.
Instructions:
- The robot should move forward, turn 120 degrees to make the triangle.
Example Code:
void setup() {
go.begin(); // Initialize the robot
}
void loop() {
go.forward(50); // Move forward
delay(2000); // Wait for 2 seconds
go.spinAngle(120); // Turn 120 degrees
}
}
Challenge 3: Zig-Zag Path
Objective:
Program the robot to move in a zig-zag pattern, alternating between left and right turns.
Instructions:
- Students should code the robot to move forward, turn right by 45 degrees, move forward again, and then turn left by 45 degrees.
- They should repeat this pattern to create a zig-zag movement.
Example Code:
void setup() {
go.begin(); // Initialize the robot
}
void loop() {
go.forward(50); // Move forward
delay(1500); // Wait for 1.5 seconds
go.spinAngle(45); // Turn 45 degrees right
go.forward(50); // Move forward
delay(1500); // Wait for 1.5 seconds
go.spinAngle(-45); // Turn 45 degrees left
}
Challenge 4: Hexagon Path
Objective:
Program the robot to move in a hexagon pattern by using 60-degree turns.
Instructions:
- The robot should move forward and turn 60 degrees.
Example Code:
void setup() {
go.begin(); // Initialize the robot
}
void loop() {
go.forward(50); // Move forward
delay(2000); // Wait for 2 seconds
go.spinAngle(60); // Turn 60 degrees
}
}
Teacher’s Role:
- Encourage students to experiment with the angles and movement commands to create different paths.
- Guide them in understanding the relationship between the angle they specify in the code and the actual movement of the robot.
- Help them troubleshoot issues if their robot does not follow the path as expected.
- Promote creativity by suggesting different movement challenges beyond the examples provided.
4. Reflection and Wrap-Up (5-10 minutes)
Activity:
End the session with a discussion about how programming the robot to make precise turns can help with more complex tasks in the future.
Instructions:
- Ask students to share which shapes or paths they were able to program their robot to follow and what challenges they encountered while trying to get precise turns.
- Encourage them to reflect on how the robot’s turning behavior changed when they adjusted the angle.
Teacher’s Role:
- Lead the discussion on how understanding angles and turns can be helpful for more advanced tasks, such as navigating mazes or obstacle courses.
- Reinforce the idea that learning to control angles and movement will allow them to program more complex behaviors in future sessions.
Learning Outcome:
By the end of the session, students will have a solid understanding of how to use angles to control the robot’s turning behavior. They will have experimented with making precise turns using the go.spinAngle() command and applied their learning to make the robot follow different paths.