Skip to main content

Introduction

We need to patrol the planet to keep it safe, but don't have time to do it ourselves. Learn how to get your robot to steer itself automatically!

    • Autonomous robots are very important in advanced factories!

    • Watch the video to see some of Amazon's autonomous transport robots moving products around the warehouse.

    • Think how many people would be required to do the job of the robots!

  1. We're going to make our own autonomous robot to patrol the outside of the planet. Assemble your robot like the picture!
    • We're going to make our own autonomous robot to patrol the outside of the planet.

    • Assemble your robot like the picture!

    • You will need the line sensor module for this lesson. For best results, mount your line sensor in the position shown.

    • Connect the left sensor to P1, and the right sensor to P0.

  2. How does the line sensor work? Let's write a test program to find out. Build the test program in the picture. Can you guess what it will do? Program your robot and place it on the activity mat, with the sensor right on the edge of the planet. This is very important - the calibrate line sensors block spins the robot before starting the program, to calibrate the sensor on the surface.
    • How does the line sensor work? Let's write a test program to find out.

    • Build the test program in the picture. Can you guess what it will do?

    • Program your robot and place it on the activity mat, with the sensor right on the edge of the planet. This is very important - the calibrate line sensors block spins the robot before starting the program, to calibrate the sensor on the surface.

    • Whenever you use the line sensor module, you must always have a calibrate block at the start of your program.

    • Once the calibration has finished, try moving the robot by hand on and off the planet - the motors should spin when it is on the planet!

  3. Turn the robot over and look at the bottom of the line sensor. You should see 3 LEDs.
    • Turn the robot over and look at the bottom of the line sensor. You should see 3 LEDs.

    • The centre LED is an infrared emitter - just like on your TV remote control! It shines infrared light downwards all the time.

    • The two outer LEDs are infrared receivers - they can sense infrared light.

    • When the robot is on a black surface, infrared light is not reflected and so the receivers give a 0 signal.

    • On a white surface, the light is reflected and so the receivers give a 1 signal.

    • Using the signal from the sensors (1 or 0), we can detect what colour surface to robot is on!

  4. Let's use the line sensor to stop the robot from driving off the planet.
    • Let's use the line sensor to stop the robot from driving off the planet.

    • Don't forget - the sensor is 1 on white backgrounds, and 0 on black backgrounds.

    • Using the structure in the picture, make the robot:

    • Drive forward

    • Stop IF it drives off the planet (when the background is black)

  5. Now we have everything we need to drive around the edge of the planet automatically!
    • Now we have everything we need to drive around the edge of the planet automatically!

    • To do this, your program needs to:

    • Drive forwards

    • Check the sensor

    • If the sensor is 0, we are about to drive off the planet! Turn slightly towards the middle of the planet and then go forwards again.

    • Your robot should drive around the edge of the planet, without getting lost.

    • Try and make your robot drive around the planet as smoothly as you can, by adjusting the turning time.

  6. Currently, the robot tries to stay on the white and avoid the black.
    • Currently, the robot tries to stay on the white and avoid the black.

    • Can you change the code so the robot orbits the planet by staying on the black, and turning away from the white?

    • Hint: instead of normally going forwards, you will need to normally be turning towards the centre of the planet.

Finish Line

Tech Camp

Member since: 10/03/2012

119 Guides authored

Team

Tech Camp Staff Member of Tech Camp Staff

6 Members

140 Guides authored