Day 3 - Section 2 - Line sensing and tracking

Site: ΕΛ/ΛΑΚ Moodle
Course: Robotics - 3D Printing - Internet of Things
Book: Day 3 - Section 2 - Line sensing and tracking
Printed by: Guest user
Date: Friday, 3 May 2024, 5:29 PM

Description

After the completion of this section the students will be able to:

  • drive their robot until it meets a black line
  • create the code to make the robot drive inside a border
  • program their robot to follow a black line

Chapter 7.1 - Drive until a black line

Write the following program to have the Edison robot drive on a white surface (reflective) until a black line (non-reflective) is crossed.


To use the linetracking sensor in a program you must first turn the sensor on. This also activates the red LED.

Use the black line on Activity sheet 8.1 or draw a black line on a piece of white paper. You can also use black electrical tape on a white desk. Drive the robot towards the black line and he will stop.

On Activity sheet 8.1 there are also three coloured lines. These are red, blue and green. Drive Edison towards each of the lines and see if he stops.


Chapter 7.2 - Drive inside a border

Write the following program to have the Edison robot drive within a border.

Use Activity sheet 8.2 as a border or create your own using a large piece of paper and a thick black marker.

You can also use black electrical tape on a white desk to create a large border.

If you create a large border try adding lots of robots to see what happens.

Also, experiment with different speeds.


Chapter 7.3 - Follow a line

Write the following program to have the Edison robot follow a black line.

This program uses the ‘IF’ icon to allow the robot to decide what to do. If the line tracking sensor is on a reflective surface (white), then drive forward right at speed 4. If the line tracking sensor is not on a reflective surface, then drive forward left at speed 4. When the robot is on white it drives off white, when the robot is on black it drives off black. As it does this it moves forward and tracks the edge of the line.

Place the robot inside the track on Worksheet 8.2 and watch the robot track the line.