Training Camp 3: Reacting to Lines
Write programs using the Color Sensor to make the Driving Base autonomous.
Lesson Plan
1. Prepare
- Read through the student material in the LEGO® Education SPIKE™ App.
- You'll need a thick black line on a white or light surface for this lesson:
▷ Draw a black line on a sheet of white paper
▷ Use electrical tape on a light surface
▷ Print out the "line ideas" PDF
▷ Use a spare black axle element from the LEGO SPIKE Core Set
2. Engage (5 Min.)
- Use the ideas in the Ignite a Discussion section below to engage your students in a discussion related to this lesson.
- Use the video to explain the lesson.
3. Explore (20 Min.)
- Have your students work in pairs to build the Driving Base with Color Sensor.
- Ask them to play the first programming stack to get their Practice Driving Base to move forward and stop perpendicular to a black line.
- Have them try the second programming stack and describe what happens.
4. Explain (5 Min.)
- Facilitate a discussion about how the Color Sensor detects the black line.
5. Elaborate (15 Min.)
- Have your students work through the next program to get their Driving Base to follow a black line.
- Ask them to optimize this code to create an even better line-follower program.
6. Evaluate
- Give feedback on each student's performance.
- You can use the assessment rubrics provided to simplify the process.
Ignite a Discussion
Use these ideas to engage your students in a discussion about competition fields and the lines that are often part of them.
- Ask your students how they could use these lines to help make their Driving Base program more effective.
- Explain the different types of lines and intersections:
▷ Thin lines
▷ Right angles
▷ T-junction lines
▷ Non-continuous lines
▷ Black lines cut by a colored line
Have your students watch this video to see what they're about to do.
Building Tips
A Simple Driving Base with the Color Sensor
Use the simple Driving Base model with the Color Sensor. Remember to use the cable clips.
Using the Color Sensor
The Color Sensor can be used in 2 different modes to solve this challenge (i.e., color mode or Reflected Light Intensity mode).
The Reflected Light Intensity mode of the Color Sensor will give maximum precision. Following a line is an alternating detection of 2 colors or 2 reflected light intensities. Spend some time with your students exploring the ways in which the sensor reports values. For example:
Using the Motors in Power Mode
When turning on a motor using the regulated speed mode, the Hub will gradually send power (voltage) to the motors to get to the desired speed and keep it constant, regardless if the driving base is driving on a flat surface or on a slope.
When turning on a motor in power mode, the Hub will immediately send the desired power (voltage) to the motors.
In the case of a line follower, as the driving base needs to perform small and fast movements (most likely bellow 10 degrees oscillating between the white and the black space), programming using Power Mode is more reactive, resulting in a more accurate line follower.
You will find this block in the "Motre Motor" extension.
Coding Tips
Main Program
Possible Solution
Other Programs
Differentiation
Simplify this lesson by:
- Explaining the Reflected Light Intensity mode of the Color Sensor
▷ Find out more about the Color Sensor in the help section of the SPIKE App.
Take this lesson to the next level by:
- Challenging your students to modify their programs to follow lines of different sizes, colors, and shapes.
Assessment Opportunities
Teacher Observation Checklist
Create a scale that matches your needs, for example:
- Partially accomplished
- Fully accomplished
- Overachieved
Use the following success criteria to evaluate your students' progress:
- Students can program their Driving Base to react to lines using the Color Sensor.
- Students can use an "IF ELSE" statement in their program to make a simple line-follower.
- Students can optimize their line-following program to be more accurate.
Self-Assessment
Have each student choose the brick that they feel best represents their performance.
- Blue: We've made our Driving Base stop at a perpendicular.
- Yellow: We've programmed our Driving Base to follow a line.
- Violet: We've modified our line-following program to move our Driving Base faster and more effectively.
Peer-Assessment
Encourage your students to provide feedback to others by:
- Having one student score the performance of another using the colored brick scale above.
- Asking them to present constructive feedback to each other so that they can improve their group's performance during the next lesson.
Language Arts Extension
To integrate language arts skills development:
- Present a program called differentiated line follower (see coding tips section) and have your students try to decode how the program works.
- Ask your students to evaluate the performance of this program compared to their previous line-follower programs.
Note: This will make for a longer lesson.
Math Extension
To incorporate math skills development:
- Ask your students to use these terms to explain how a line-follower program works when using the Reflected Light Intensity of the Color Sensor:
▷ Threshold value
▷ Mean value
▷ Greater than, less than
▷ Range
▷ Percentage
Note: This will make for a longer lesson.
Career Links
Students who enjoyed this lesson might be interested in exploring these careers pathways:
- Information Technology (IT Applications)
- Manufacturing and Engineering (Machine Technology)
- Manufacturing and Engineering (Pre-Engineering)
Teacher Support
Students will:
- Program their Driving Base to stop at a black line
- Program their Driving Base to follow a black line
NGSS
MS-ETS1-4
Develop a model to generate data for iterative testing and modification of a proposed object, tool, or process such that an optimal design can be achieved.
CSTA
2-AP-12 6-8
Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
CCSS.ELA-LITERACY.SL.6.4
Present claims and findings, sequencing ideas logically and using pertinent descriptions, facts, and details to accentuate main ideas or themes; use appropriate eye contact, adequate volume, and clear pronunciation.
CCSS.MATH.CONTENT.6.NS.C.7.A
Interpret statements of inequality as statements about the relative position of two numbers on a number line diagram. For example, interpret -3 > -7 as a statement that -3 is located to the right of -7 on a number line oriented from left to right.