Lighten Up!

 

What if Roverbot was moving from an area covered with a dark carpet onto an area covered with a light carpet, and you wanted it to stop when it reached the light carpet? Previously, you got Roverbot to stop when it reached a wall by using a touch sensor. It is clear that touch sensor input will not help the RCX tell when it crosses over from a dark carpet to a light one, but a light sensor will. 

 

In this activity you will learn how to use a light sensor to get information about the amount of light reflected from a surface.

What you will need:

Your Roverbot

The Robotics Invention™ Kit

Constructopedia, pages 34-35

Reflection stands

A flashlight

A black marker

An index card or sturdy white paper

A disk to save your work

A copy of the Technical Guide

Building Bin

What to do:     

                                                                                                             

1.       Remove the bumper from your Roverbot, if you haven’t done so already. 

2.       Attach a light sensor to input port #1.

3.       Attach the sensor to the two yellow studs on top of the RCX in front of input port 3. Make sure the red light is pointing forward, away from the RCX.

 

Tech Guide

In order to use the View button to check light information that is being read by the sensor, you must first download a program that uses a light sensor, and run it at least once. 

Prepare your RCX to display light information in the display window.

 

  1. Recreate the following program. Note that each Sensor Watcher is connected to a different input port, 1, 2, or 3 as shown by the numbers on the lower right hand side of each watcher.


© The LEGO Group

  1. Download it onto program slot # 5.
  2. Run it.

Now you are ready to take some light readings using the light sensor.  Press the View button until you see an arrow pointing to input port 1.

Hold the RCX so that the light sensor points to midair (somewhere between the ceiling and the floor).  Look at the display window. You will see a number next to the person icon. This is the light value the sensor is detecting.  Write it in the space below on the left.

Room light reading: ______________       Direct light reading: ____________

 

Now, point a flashlight directly at the front of the sensor. (The back of the sensor is the end that has the wire coming out of it.)  Note the value the sensor is detecting, and write it on the line above on the right.

The value the light sensor reports is always a number between 0 and 100.  Zero is very, very dark (no light) and 100 is the brightest light. You won’t get a zero reading even when you cover the sensor with your finger because its own light is reflected off your skin.

 

Take light sensor measurements:

  1. Using masking tape, mark a line about 6 inches long on your working area.
  2. Mark a second line running parallel to the first, about 1 inch apart.        
  3. Place the front of the RCX along line #1.                                                      
  4. Follow your teacher’s directions about how to attach your materials to a stand.  Start with the black paper.  Place the stand with the black paper on line #2, so that the black paper faces the light sensor and is about ½ inch from the sensor.
  5. Turn the RCX on and set it to program 5.
  6. Press the view button until you see a small arrow pointing at input port 1.
  7. Note the number displayed in the display window. Write it in the Room Light Reflection column in the chart below.
  8. Replace the black paper with the gray paper, and take another reading. Write the number in the chart.
  9. Do the same for the white paper and MylarTM sheet.

 

 

 

2

 

1

 

 

_____

 

_____

 

Materials Room Light Reflection Flashlight Reflection
Black paper    
Gray paper    
White paper    
Silver Mylar ("mirror")    

 

Repeat the experiment with all four surfaces, only this time, point a flashlight at the surface as follows:

 

  1. Place the black paper stand on line 2.  Hold a flashlight against the top of the light sensor. Point the flashlight so that its spotlight covers the red light seen on the black surface (This red light comes from the light sensor). If needed, move your hand a bit to aim the flashlight directly at the red area.
  2. Record the data in the Flashlight Reflection column in the chart above.
  1. Follow the same procedure for the gray, white, and MylarTM sheets.  Record your observations in the Flashlight Reflection column above.

 

Make your robot respond to light information

 

Problem: There is a piece of white paper on a dark floor. Make Roverbot move about and then stop when it reaches the white paper.

Build a light sensor attachment: To get light information from the floor, the light sensor has to point downward. Build a light sensor attachment by following the directions on pages 34-35 of the Constructopedia.

Programming Hints: Here are some blocks that can be used to make the program respond to light information that it gets through the light sensor. Think about how you want to solve this problem, and decide which one will work best for your solution plan.

         Until light (red)                      Yes or No light (purple)       Sensor Watcher light (blue)

  Tech Guide                                   Tech Guide                           Tech Guide


© The LEGO Group

What is the question in this block?

What is the question in this block?

What is the question in this block?

 

Back to your problem: Write a program to make Roverbot stop when it gets to the white paper on the floor.

 

When you’ve solved this problem, try one of the RCXtras problems below!

 

RCXtras

  1. Connect two light sensors to two long connector wires. Write a program that will let you use the light sensors as remote controls to “take Roverbot for a walk.”

Hint: Color one half of a small index card black. Leave the other half white. Use it to change the input the program is receiving. This is easier to do if two people monitor the light sensor, each responsible for one sensor.

 

  1. Make Roverbot move on the table and stop at the edge. (Robot life-saving suggestion: when you try out your program, be prepared to catch your robot. Remember that programs rarely work on the first trial.)

  2. Make Roverbot follow the track that comes on the poster in your kit.

 

Thinking about it

 

Here are some programs. Can you tell what Roverbot will be doing when running each of the programs?


© The LEGO Group

What will Roverbot do?

What will Roverbot do?

Here are two programs, ZigZag and Follower. ZigZag tells Roverbot to move in a zigzag fashion. What do you think Follower is telling it to do?

 

ZigZag                                                      Follower                                                    

 
© The LEGO Group

 

Do you think Follower can make Roverbot zigzag (without changing the program!)?

 

1.       Recreate the program.

2.       Download it.

3.       Run it.

 

{Hint: You can’t change the program, but you can change the robot’s surroundings.}