ACTIVITIES


Interactive C Code for Range Sensor
Testing the Range Sensor

Avioding Obstacles COMING SOON

IC Sensor Test (Grant, NASA Ames) COMING SOON

 

CYBER LAB SENSOR ACTIVITIES

Photodiode

Infrared 

Touch

Encoder

The range sensor can only be used in analog ports 16-22. This sensor measures the distance to the object in front of it. Its maximum range is approximately 30 inches. Closer than 6 inches the values returned will be incorrect. The larger the value the closer the object (until about 6 inches when the returned values starts to decrease again). Typical values for this sensor are 10 for 30 inches and 130 for six inches.

 

 

 

 

 

 

Figure 1. Range proximity sensor (ET head) for the HandyBoard


Figure 2. Range finder showing emission and detection system.

ACTIVITY #1: INTERACTIVE C CODE FOR THE RANGE SENSOR (ET)

BACK TO TOP

This activity will introduce you to a sample Interactive C code used to test the range sensor (ET head). In past activities, we learned that the photodiode and IR reflectance sensor attach to HandyBoard analog ports 2-6. They also can be tested using the same sample code. The range sensor is an analog sensor as well, but must be attached to analog ports 16-23. Thus, the IC code is different that the other analog sensors. Click here for a quick Interactive C (IC) and Not Quite C (NQC) tutorial

Materials Needed: HandyBoard setup

Procedure: Loading Code

1. Connect your HandyBoard to the computer and prepare to download the range sensor
code
2. Copy the code below or cut and paste it into the IC text editor
3. Compare and contrast the range sensor code with the photodiode/IR reflectance code. What are some of the differences?
4. Save and download this file; turn off and then turn on you HB. The HB screen should be reading "Press START to test A/D 16-23"

 void main() {
printf("Press START to test A/D 16-23 ins\n");
start_press();

while (!stop_button()) {
int i;
for (i= 23; i >=16; i--)
printf("%d ", analog(i));
printf("\n");
msleep(100L);
if (stop_button()) {
beep();
break;
}
}
}

ACTIVITY #2: TESTING THE RANGE SENSOR (ET)

BACK TO TOP

This is a very simple activity to test the range sensor's capabilities of finding an object and displaying what the sensor sees on the HandyBoard LCD screen. It is also a method for calibrating the sensor when trying to determine the distance of a given object. Once the object is assigned a numerical value, it can be incorporated into a computer program that will allow a robot to perform a specific task. Objectives: In this activity, you will learn how to attach the range sensor into the appropriate HandyBoard analog ports, learn how to take readings at several distances, plot readings, and analyze data.

Materials: HandyBoard setup, one range sensor, 8 black 6.3 cm (2.5 in) LEGO brick pieces, one 45 cm or greater metric ruler

Procedure:

1) Attach the range sensor to port number 16.
2) Press the start button on the HandyBoard.
3) The HandyBoard LCD screen will display 8 blocks of numbers (example 227, 191, 186, 184, 190, 187, 187, 5). Again, these numbers are arranged according to individual port.
4) Build a wall with the LEGO pieces
5) Lay the metric ruler down and place the wall at 0 cm.
6) Using the range sensor, take readings at 15 cm, 20 cm, 25 cm, 30 cm, 35 cm, 40 cm, 45 cm from the LEGO wall. Graph your readings. Question: Do you see a steady increase or decrease in values?
7) Now, start at 20 cm and slowly move your range sensor toward the LEGO wall until the numbers start going back down. Question: How many centimeters away from the LEGO wall is the sensor when the numerical readings start descend in value? When the numbers start going down as you get closer to the wall, the readings you see will be incorrect.



Back to the Top

Back to the Cyber Lab Home Page

Back to the Main Activity Page

Please send any questions or comments to curriculum@kipr.org

 photodiode

 infrared

 range

 touch

 encoder


Go to The Botball Home Page