Session 10: Go Bot Sorting Showdown
Duration: 50-60 minutes
Objective:
In this final session, students will engage in a friendly competition where their Go Bots perform automated deliveries with sorting functionality. Each team will tune their previously coded delivery program to collect marbles from a collection point, sort them at the designated sorting area based on color, and return for another delivery. The goal is to complete as many successful deliveries as possible within a set time limit.
Equipment Required:
- M3D Robotics kit (M3D Go) for each team, equipped with a distance sensor and line sensor
- Laptops with Arduino IDE and Web BLE setup
- Colored marbles (blue, green, red)
- Black tape for marking paths and designated points
- Projector for live score display and event instructions
- Stopwatch or timer for timing each round
Learning Objectives:
- Apply coding, sensor control, and conditionals to perform automated sorting tasks
- Refine navigation skills, incorporating user input to customize robot actions
- Practice efficient code tuning to enhance robot speed, accuracy, and functionality
- Develop teamwork and strategic thinking through competitive problem-solving
Session Outline
1. Event Overview and Preparation (5 minutes)
Activity:
Begin with an overview of the competition format, rules, and objectives. Emphasize that each team’s goal is to make the most successful deliveries, accurately identifying and sorting marbles based on user input.
Instructions:
- Introduce the collection and sorting points and explain how the robot needs to identify marble colors and deliver them to the correct sorting area.
- Outline how points are scored: 1 point for each correct delivery, and a penalty for incorrect sorting.
Teacher’s Role:
Ensure students understand the rules, scoring, and setup, encouraging them to strategize and collaborate effectively.
2. Code Tuning and Practice (15 minutes)
Activity:
Students will have time to adjust and test their code, adding the sorting functionality based on user input. They can fine-tune robot movements, adjust timing, and test accuracy to ensure smooth and fast deliveries.
Example Code:
#include <M3DGo.h>
int colorInput = 0; // Variable to store user input for marble color
void setup() {
go.begin();
}
void loop() {
// Stage 1: Move to drop off point
if (line.onTheLine()) {
go.forward(50); // Move forward if on the line
display.text("Following Line");
} else if (line.getLeft() > line.getRight()) { // Left sensor detects more white
go.spinClockwise(30); // Turn right
display.text("Adjusting Right");
} else { // Right sensor detects more white
go.spinCounterclockwise(30); // Turn left
display.text("Adjusting Left");
}
go.delay(500);
}
// Stage 2: Sorting
if (line.notOnLine()) {
go.stop();
colorInput = remote.askNumber("Marble color? 1-Blue, 2-Green, 3-Red"); // Ask for color
// Sort based on color input
if (colorInput == 1) { // Blue marble
go.forward(50);
go.delay(1000);
} else if (colorInput == 2) { // Green marble
go.spinLeft(90);
go.forward(50);
go.delay(1000);
go.stop();
} else if (colorInput == 3) { // Red marble
go.spinRight(90);
go.forward(50);
go.delay(1000);
}
remote.notify("Delivery complete"); // Notify delivery success
go.delay(500);
go.backward(50); // Return to collection point
go.delay(1000);
}
}
Student would also have to code the robot to return based on which marble it dropped whether it should just go back or it has to turn using if statment.
Teacher’s Role:
Assist students with code adjustments, emphasizing efficient looping, clear conditional statements, and correct input handling. Ensure they are comfortable with the remote Web BLE client to gather inputs.
3. The Sorting Challenge (20 minutes)
Activity:
Each team will attempt to deliver and sort as many marbles as possible in the given time limit, keeping score based on the successful deliveries.
Instructions:
- Teams will start their robots at the collection point and feed marbles as they return for a new delivery.
- Each robot will navigate from the collection point to the sorting area, taking user input to determine where to place each marble.
- Teachers or helpers can monitor correct sorting to ensure fair play and adjust scores accordingly.
Teacher’s Role:
Facilitate the event, keeping time and ensuring fair scoring. Encourage students to adjust strategy and code if they encounter challenges.
4. Reflection and Wrap-Up (5 minutes)
Discussion Points:
- You may ask:
“What were the biggest challenges you faced during the competition?”
“How did user input influence your robot’s sorting actions?”
“What strategies helped you improve your robot’s speed or accuracy?”
Teacher’s Role:
Wrap up the session by highlighting the teamwork, coding skills, and problem-solving approaches that each team used, celebrating the achievements of all students.
Learning Outcome:
By the end of this session, students will have demonstrated their ability to combine multiple programming skills, including navigation, user input, and sorting logic, to create a functional and efficient delivery robot in a competitive setting.