[RL85] Grade 8 - Session 5

Session: Automated Sorting Challenge – Sensitive or Not?

Duration: 60 minutes


Learning Objectives:

  • Implement Conditional Logic: Use conditional statements to categorize items based on multiple factors (sensitivity and weight).
  • Understand and Operate Motor Attachments: Use the motor and dumper attachments to move and sort items.
  • Refine Navigation and Line Following: Program the robot to follow a line path and adjust directions for specific sections.
  • Dynamic Decision-Making Based on User Input: Utilize Web BLE to prompt users for item details that impact the robot’s sorting behavior.
  • Problem-Solving and Collaboration: Design a sorting system with team collaboration and test it in real time.

Equipment Required:

  • M3D Robotics kit with line and distance sensors
  • Motor attachments for moving objects: dumper, forklift
  • Laptops with Arduino IDE and Web BLE setup
  • USB/OTG cables for robot-laptop connections
  • Colored tape for marking sorting sections
  • Small objects (e.g., blocks, labeled by weight and sensitivity)
  • Art supplies for decorating sorting sections and items
  • Projector for live code demonstration

1. Introduction to Sorting Criteria and Setup (5 minutes)

Activity:
The teacher introduces the session by explaining that students will create an automated sorting system in which their robot will handle items with different properties. The robot will:

  • Determine if an item is sensitive or non-sensitive (handling fragile items separately).
  • Check if the item is heavy or light.
  • Sort items into four sections based on these properties.

Discussion Questions:

“Why might we want to handle sensitive items differently from non-sensitive ones?”
“What are some examples of sensitive items in real life, and how do you think they should be handled differently from non-sensitive items?”


2. Motor Attachments Overview (5 minutes)

Activity:
The teacher introduces the motor and attachments, showing how they can be used for sorting tasks. Explain how each motor type works:

  • Motor Attachments: Showcase the dumper and forklift attachments.
    • Demonstrate using the commands:
      • HingeA.open() or HingeA.close(): fully raises or lowers the dumper.
      • HingeA.setAngle(): sets the dumper to a specific angle. Emphasize that the code might use HingeA or HingeB depending on the connected motor.
  • Demo Activity: Show the dumper raising and lowering to release an object and allow students a brief trial to set the angle.

Teacher’s Role:
Guide students in understanding how these attachments could be useful in real-world warehouse sorting.


3. Designing Sorting Arena and Preparing Items (15 minutes)

Activity:
Students work in groups to set up a sorting arena with marked sections for:

  • Heavy Sensitive
  • Light Sensitive
  • Heavy Non-Sensitive
  • Light Non-Sensitive

Materials Needed:

  • Black tape to mark the four sections
  • Labeled objects with weight and sensitivity characteristics
  • Art supplies to decorate sections and items

Teacher’s Role:
Assist students in setting up the arena, ensuring clear labeling of each section.

4. Coding Sorting Logic with Web BLE Inputs (20 minutes)

Activity:
Students program the robot to take two user inputs via Web BLE:

  1. Sensitivity (whether the item is sensitive or non-sensitive).
  2. Weight (whether the item is heavy or light).

Based on these inputs, the robot will navigate to the correct section using the dumper attachment.

Coding Steps:

  1. Getting User Input for Sensitivity and Weight:

    • Prompt the user with Web BLE: “Is the item sensitive or non-sensitive?”
    • Then prompt for weight: “Is the item heavy or light?”
  2. Determining Sorting Section Based on Inputs:

    • If sensitive and heavy: turn left to navigate to the “Heavy Sensitive” section.
    • If sensitive and light: go straight to the “Light Sensitive” section.
    • If non-sensitive and heavy: turn right to “Heavy Non-Sensitive.”
    • If non-sensitive and light: turn around to “Light Non-Sensitive.”

Example Code:

#include <M3DGo.h>

void setup() {
    go.begin();
}

void loop() {
    if (line.onTheLine()) {
        go.forward(50);
    }

    String Object = remote.askString("Has the item been placed?");
    if (Object == "Yes") {

        String sensitivity = remote.askString("Is the item Sensitive or Non-Sensitive?");
        String weight = remote.askString("Is the item Heavy or Light?");
        
        if (sensitivity == "Sensitive" && weight == "Heavy") {
            display.text("Heavy Sensitive");
            go.turnLeft();
            go.forward(50);
            if (range.get_cm() < 5) {
                HingeA.open(); 
            }
        }
        else if (sensitivity == "Sensitive" && weight == "Light") {
            display.text("Light Sensitive");
            go.forward(50);
            if (range.get_cm() < 5) {
                HingeA.open();
            }
        }
        else if (sensitivity == "Non-Sensitive" && weight == "Heavy") {
            display.text("Heavy Non-Sensitive");
            go.turnRight();
            go.forward(50);
            if (range.get_cm() < 5) {
                HingeA.open();
            }
        }
        else if (sensitivity == "Non-Sensitive" && weight == "Light") {
            display.text("Light Non-Sensitive");
            go.spinClockwise(180);
            go.forward(50);
            if (range.get_cm() < 5) {
                HingeA.open();
            }
        }
    }
}

Teacher’s Role:
Guide students through the code and help them understand how the conditions direct the sorting location.

Discussion Questions:

“How might the robot handle different types of objects better with these conditions?”
“In real-life warehouses, why is it important to know both the weight and sensitivity of an item?”


5. Testing and Debugging (10 minutes)

Activity:
Students test their code by placing labeled items and observing whether the robot correctly identifies and sorts them.

Teacher’s Role:
Support students in debugging, providing guidance for logic issues, and encourage them to adjust variables to improve performance.


6. Wrap-Up and Reflection (5 minutes)

Reflection Questions:

“What challenges did you encounter when sorting items based on sensitivity and weight?”

“How could you improve your robot’s sorting ability in a real-world warehouse?”

“Can you think of any other scenarios where combining two conditions might be helpful?”


Learning Outcome:

Students will understand how to use conditions to make decisions based on multiple factors, practice input-based decision-making, and apply robotics in a warehouse setting. They will create a functional sorting system that reacts dynamically to object characteristics, reinforcing logic and problem-solving skills in robotics.