Download Laboratory 3 Design of a Custom Light Sensor

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Laboratory 3 Design of a Custom Light Sensor
Group 8
Terry Sanders
Oh-Bok Kwon
Mike Mueller
03/03/2004
PROBLEM DEFINITION
In laboratory 3 the group will construct a custom light sensor out of discrete
electonic parts and an "empty" pre-fabricated circuit board. This circuit board will plug
into the HandyBoard, using its analog ports, and interface with the HandyBoard through
code written by the group. The completed robot will be programmed to perform the
following tasks.
1: After the HandyBoard is turned on, the robot will remain stationary until a new
light source is turned on.
2: This light source will be omni-directional, positioned no more than two feet
away, and will be no greater than 45 degrees off of the forward position of the
robot.
3: The robot will move in the direction of the light source, stopping when it is
within six inches away.
The following are the demonstation requirements and design limitations of the lab.
1: The light source will initially remain off for at least 15 seconds.
2: The custom light sensor constructed by the group will be used to home in on
the light source. However, the group may use other means to identify the distance
from the light source to the robot.
3: A black line, 0.5 inch wide, will be drawn around the light source 6 inches from
it. The robot must be touching, or having passed into the area of the black circle.
Because of the size of the robot, it need not pass entirely within the black circle.
LIGHT
6 INCH CIRCLE
SOURCE
2 FEET
APART
45 DEGREES
OR LESS
ROBOT BUGGY
PARTS AND SOFTWARE
The following is a brief parts list based upon the laboratory requirements
1: (1) HandyBoard
2: (1) Pre-fabricated Printed Circuit Board
3: (Numerous) Lego parts. The group may wish to use/modify the robot created in
the previous lab exercise.
4: (3) Photo-sensors. Using at least one will be required.
5: (1) Operational Amplifier, AD623 or equivalent (optional).
6: (1) Voltage regulator, TLE 2425 or equivalent (optional).
7: (Several) Capacitors of various sizes.
8: (Several) Resistors of various ranges. It will be up to the group to locate
resistors for the laboratory exercise, they will not be provided by the instructors.
The software ran on the Handy Board will be coded by the group using the IC 4
compiler. This compliler uses a version of the 'C' programming language. The students
can download code to the Handy Board through the computers' serial interface.
PROPOSED FLOW CHART
Wait for light
Examine both photo-sensor
values
Turn left or right,
if necessary
NO
Move forward
Within 6 inches
of light?
End
HARDWARE SOLUTIONS
The photosensors were tested with an Ohmmeter to develop a resistive devider.
Resistors of 47 KOhm were selected based upon resistive measurements of the
photosensors at light conditions similar to what the demonstation will be conducted at.
Resistors of 100 KOhm were selected for R5 and R6 to enable sampling the average of
the photosensors. A 100 KOhm resistor and 0.1 micro Farad capacitor were chosen to
form a RC low-pass filter. No potentiometer or gain resistor was used in the circuit.
HARDWARE TROUBLESHOUTING
After soldering the components onto the PCB, its operation was tested. The light
sensor board was plugged into the HandyBoard. The 2.5v reference and 5v source was
measured at the comparitor socket. Approximately 5v and 0v were measured at the
photosensor inputs to the amplifier when the sensors were in complete darkeness, or
exposed to a bright light source. At low light conditions approximately 3v was measured
at each sensor output. The comparitor output was observed to vary when a flashlight was
shown on an individual photosensor.
SOFTWARE DEVELOPMENT
The code written for the lab was based upon experimental results. Print
statements to the HandyBoard screen that showed a digital representation of the
photosensors, average, and comparitor output voltages were created. The HandyTruck
was turned side-to-side and moved throughout the two foot range while the readings were
observed. The low light conditions in the room made observing results difficult. Better
results were obtained when we left the HandyBoard interfaced to the PC. Global
variables representing each of the four voltages were created. Within the IC 4 interface
the values of these global variables were viewed as changes were made to the robot's
position. This process went through several iterations until robust results were observed.
SOURCE CODE
See attachments
TABLE OF OUTPUT FROM A SUCCESSFUL RUN
LEFT SENSOR
RIGHT SENSOR
AVERAGE
COMPARITOR
250
242
232
167
223
150
213
158
167
94
76
0
251
215
202
200
189
176
171
153
140
202
141
0
253
230
218
185
207
164
193
156
155
150
110
0
128
128
128
74
161
102
179
134
156
2
63
0
IMAGE OF ROBOT BUGGY WITH CUSTOM CIRCUIT BOARD
Light Shield
Photosensor
Photosensor
Custom
Circuit
Board