# 4/22/2015 1 MAKING YOUR ROBOTS SEE Building and Testing Photosensitive eyes.

## Presentation on theme: "4/22/2015 1 MAKING YOUR ROBOTS SEE Building and Testing Photosensitive eyes."— Presentation transcript:

4/22/2015 1 MAKING YOUR ROBOTS SEE Building and Testing Photosensitive eyes

4/22/2015 Building Photosensitive Eyes  Parts 1. Two Photo-Resistors 2. Two 0.1µF Capacitors 3. Two 220Ω Resistors

4/22/2015 Circuit Building

4/22/2015 Concepts  Resistors Reduces the flow of current  Photo-resistor Resistance value varies with change in lighting condition Resistance is less in the presence of more light and more in the absence of less light  Capacitor Stores energy Controls the reaction of the photo-sensor

4/22/2015 Programming to Measure Resistance  RC Time Time it take the lower plate of the capacitor to discharge from 5 to 1.4 V. BASIC Stamp I/O pin’s threshold voltage = 1.4v. voltage depends on R × C, the RC time constant, Tau. When voltage > 1.4 V, register input = 1, when voltage < 1.4 V, register input = 0. Resistor and Capacitor are constant. Photo-resistor value changes based on light, so the voltage changes. rctime command measures how long it takes for the voltage to fall from 5 to 1.4 V. RC time varies according to the formula:

4/22/2015 RC Time Measurements

4/22/2015 Controlling your Robot Based on RC time  Deadband A threshold that indicates different lighting (or color) conditions seen by the resistors Allows you tell the robot what direction to turn  Following a Black Stripe If deadband criteria is not met, just go forward If deadband criteria is met, then check to see what direction to go Example: If RC time for left wheel is greater than RC time for right wheel Which wheel sees a darker color? What should the robot do?

4/22/2015 Controlling your Robot Based on RC time  Avoiding a Black Stripe If deadband criteria is not met, just go forward If deadband criteria is met, then check to see what direction to go Example: If RC time for left wheel is greater than RC time for right wheel Which wheel sees a darker color? What should the robot do?