Lab 4 AEV External Sensors

Advanced Energy Vehicle (AEV)
Lab 04: AEV External Sensors
AEV Project Objective
(Problem Definition)
(System Analysis)
PT 1
PT 2
PT 3
PT 4
Present AEV Design
Learning Objectives
 Become familiar with an external sensor which
provides feedback to the Arduino about the
vehicles position
 Become familiar with troubleshooting techniques
 Program the function calls in controlling the AEV
using an external sensor
Feedback control
 The sensor that will be focus of today’s lab is
the Reflective Sensor which records wheel
rotation information
 The importance of this external sensor is to
provide real-time information to the Arduino for
autonomous vehicle operation
 When a program uses real-time information
from sensors, it is known as feedback control
Image: from Arduino Website
Reflective Sensors
 The sensor will produce a low voltage due to the reflectance
of the aluminum tape and produce a high voltage due to the
dark color of the wheel
1 Mark
 This voltage change is called a
“mark.” For one full wheel revolution,
a sensor will have 4 voltage changes
or 4 marks. Our system uses two
wheel sensors so the combined
sensors will record eight marks per
wheel rotation.
1 Mark
1 Mark
1 Mark
Mounting the Sensor
 The sensors must be mounted to have an unobstructed view
through the holes in the support arm. Use hardware plus tie wraps
to secure them in place. Verify that the holes on the wheel side of
the supporting arm are counter sunk. See your Instructor if holes
are not counter sunk.
 The closer the sensor is to the wheel, the better voltage reading
the sensor will usually have.
Too Far
Verifying the Sensors
 To make sure the sensors are on
 Run the “reflectanceSensorTest();”
following the procedure in the lab
 Make sure to set to set the serial
monitor to 115200 Baud
 This should be done every lab
because sensors have been known to
Connecting the sensors to the
 Take careful consideration
where the reflective sensor is
attached to on the Arduino.
 Read the AEV Lab Manual for
proper orientation and pin
Important Note: Make sure the
connections are installed with the white
wire facing the Arduino mini-USB
Programming with the Sensors
 goToRelativePosition(M);
• One Argument; M = number of marks
• Example: motorSpeed(4,27);
Sets all motors to 27% full power
Continues the last command for
44 wheel marks from the current
 Each wheel has 8 marks and the wheel has a
circumference of 3.902 inches
 Therefore: (44 marks)*(3.902/8) inches = 21.46 inches
Programming with the Sensors
 goToAbsolutePosition(M);
• Example: motorSpeed(2,30);
Continues the last command until the AEV accumulates 500 total
wheel marks from the starting position.
 Each wheel has 8 marks and the wheel has a circumference
of 3.902 inches
 Therefore: (500marks)/(3.902/8) inches = 243.76 inches
traveled from AEV starting position
Difference Between
goToAbsolutePosition and
0 Inches
40 Inches
80 Inches
 We
We want
want to
to go
40 inches40
82 marks)
(aka 82
do we
we want?
goToAbsolutePosition(82); OR
 Note: This sequence assumes that the AEV stops at exactly the 40 inch
distance and does not coast. Repeating the Relative option may result in over-shooting the 80 inch
position since second Relative command will be referenced to the coast point. Repeated use of only
the Relative command may cause errors.
Programming to use the sensors
 The Lab Guidelines document gives
programming instructions for this week’s lab.
 Program your AEV, using the appropriate
program, test on your desktop track, and then
run your AEV on the classroom track.
 Follow AEV classroom track safety procedures!
Wheel count sensor testing
• Since your programming will depend on the
sensors working correctly, it is vital that you
confirm the sensors are working properly at the
beginning of each lab.
• Use the reflectance test program used in this lab
each week to confirm proper operation of the
• There is also a test jig at the front of the Lab which
can be used to test the sensors.
• NOTE that three typical problems and their
solutions are shown on the following slides.
Wheel count sensor problems
Wheel count sensor problems
Wheel count sensor problems

similar documents