Training Camp 3: Reacting to Lines
Write programs using the Colour Sensor to make the Driving Base autonomous.
- 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 Colour 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 Colour 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 optimise this code to create an even better line-follower program.
- Give feedback on each student's performance.
- In order to simplify the process, you can use the assessment rubrics that have been provided.
Ignite a Discussion
Use these ideas to engage your students in a discussion about competition fields and the lines that are often seen on 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 coloured line
Have your students watch this video to see what they're about to do.
A Simple Driving Base with the Colour Sensor
Use the simple Driving Base model with the Colour Sensor. Remember to use the cable clips.
Using the Colour Sensor
The Colour Sensor can be used in 2 different modes to solve this challenge (i.e. colour mode or Reflected Light Intensity mode).
The Colour Sensor’s Reflected Light Intensity Mode will give maximum precision. Following a line is an alternating detection of 2 colours 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 of whether the driving base is driving on a flat surface or on a slope.
When turning on the two motors in the Power Mode of the Movement Blocks, the Hub will immediately send the desired power (voltage) to the motors.
In the case of a line-follower program, the Driving Base motors must perform small and fast movements (most likely below 10 degrees, to oscillate the Driving Base between the white and black spaces). In these situations, programming using Power Mode is recommended because it's more reactive, resulting in a more accurate line follower.
You'll find this block in the ‘More Movement Blocks’ extension.
Simplify this lesson by:
- Explaining the Reflected Light Intensity mode of the Colour Sensor
▷ Find out more about the Colour 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, colours and shapes.
Teacher Observation Checklist
Create a scale that suits your needs, for example:
- Partially accomplished
- Fully accomplished
Use the following success criteria to evaluate your students' progress:
- Students can program their Driving Base to react to lines using the Colour Sensor.
- Students can use an "IF ELSE" statement in their program to make a simple line-follower.
- Students can optimise their line-following program to be more accurate.
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.
Encourage your students to provide feedback to one another by:
- Having one student score the performance of another using the coloured 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.
To incorporate the development of language arts skills:
- 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.
To incorporate the development of maths skills:
- Ask your students to use these terms to explain how a line-follower program works when using the Reflected Light Intensity of the Colour Sensor:
▷ Threshold value
▷ Mean value
▷ Greater than, less than
Note: This will make for a longer lesson.
The students who enjoyed this lesson might be interested in exploring these career pathways:
- Information Technology (IT Applications)
- Manufacturing and Engineering (Machine Technology)
- Manufacturing and Engineering (Pre-Engineering)
- Program their Driving Base to stop at a black line
- Program their Driving Base to follow a black line
Design, modify and follow simple algorithms involving sequences of steps, branching, and iteration (repetition)
Implement digital solutions as simple visual programs involving branching, iteration (repetition), and user input
Implement and modify programs with user interfaces involving branching, iteration and functions in a general-purpose programming language
Download, view or share as an online HTML page or a printable PDF.