Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the Light Sensor A LEGO light sensor utilizes a LED and a phototransistor to read the reflection of light off a surface. Light sensors are useful.

Similar presentations


Presentation on theme: "Using the Light Sensor A LEGO light sensor utilizes a LED and a phototransistor to read the reflection of light off a surface. Light sensors are useful."— Presentation transcript:

1 Using the Light Sensor A LEGO light sensor utilizes a LED and a phototransistor to read the reflection of light off a surface. Light sensors are useful in building robots that will follow a flashlight or a black line on a piece of paper. Note: Ambient light does affect sensor readings.

2 Configuring the Light Sensor Just like the touch sensor, we have to use a command to tell the RCX what kind of sensor we are using, and where that sensor is connected. #define EYE SENSOR_2 ….. task main() { SetSensor(EYE, SENSOR_LIGHT); ….

3 Sensor Location and Output Level source receptor

4 Sensor Location and Output Level x output

5 Linebot I Design Intent (Goal): The robot is to track a black line on a white background. Concept Two light sensors are mounted on the front of the linebot. When the robot is centered over the line, the sensors will indicate a higher light level (from the reflecting white surface). If the robot moves to the right, sensor RIGHT_EYE will increase in value (until it reaches a saturation level) while sensor LEFT_EYE will decrease. left right RIGHT_EYE LEFT_EYE

6 Control Strategy W RIGHT_EYE x L LEFT_EYE h

7 Control Strategy W RIGHT_EYE x L LEFT_EYE X W/2-W/2

8 Control Strategy W RIGHT_EYE x L LEFT_EYE Choose a threshold between the max and min values of the light sensor. When the RIGHT_EYE detects a value lower than this threshold, steer right. When the LEFT_EYE detects a value lower than this threshold, steer left. X W/2-W/2 High value Low value Threshold value

9 Control Strategy: Parameters –Symmetry of the light sensors: do you need two threshold values? –The effect of the distance of the sensor from the surface? –How do the values of W and L affect the operation? –How does the speed of the robot affect the operation? –Will the robot always be steering right or left, or is there an operating zone in which no correction is applied?

10 Implementation –Preprossor directives: Use #define to define key values like the threshold values for each of the sensors –task main() sets up the sensors and begins the motion. –task controller detects the values of the sensors and initiates steering to right or left.


Download ppt "Using the Light Sensor A LEGO light sensor utilizes a LED and a phototransistor to read the reflection of light off a surface. Light sensors are useful."

Similar presentations


Ads by Google