Vous êtes sur la page 1sur 2

ME 179L Lab 2

Encoder Test

Assignment
This lab assignment consists of two parts. In the first part, you use an example sketch together with a
motor and improvised encoder. Then, you will apply your new understanding of encoders to build a robot
that uses encoders to keep track of its position.

Part 1: Build and Test an Encoder


1. Create a “Design History File” where you keep your documents including problems and their
resolution, back-up sketches, photos of your design, etc. Also, please give feedback to the Instructor and
TAs on any aspects of the lab that are confusing and/or can be improved.

2. Find the example sketch Encodertest.ino on GauchoSpace. This sketch sets a ‘count goal’ and
displays the resulting encoder count, while running a motor at a fixed speed. Study the sketch and the
code comments.

3. Attach a LEGO pulley to the motor shaft to serve as an encoder wheel and position a break-beam
sensor using LEGO parts such that the optical beam is periodically blocked as the pulley turns. The
connection of the motor and break-beam sensor is described in Encodertest.ino. Also, connect a
microswitch and LCD screen per the Encodertest.ino comments.

4. Run the Encoder Test hardware and software. Then, demonstrate it to a TA.

5. Modify your sketch so that you can run the motor for a set time with 3 different speeds: LOW,
MEDIUM, and FAST. The speeds should be able to be changed on the fly, that is, without uploading a
new sketch each time. This means you will need to have some way to input information to the robot.

6. Run the new sketch at each of the new speeds (at least 5 times each) and record the counts results and
run-times for each. Create a plot showing the average counts per second for each of the 3 speeds.
Demonstrate your sketch to a TA and then turn in your sketch, a table of your data (at least 15 points), and
plot actual speed (RPM calculated using the encoder data) versus command speed (value assigned to
motor speed in the sketch). Find the best fit line through your data and calculate the peak deviation from
the line as a percentage of full scale (peak speed).
Part 2:
1. Modify your Hammerhead robot to include two motors and an encoder for each motor. Write a sketch
that allows you to command the robot to drive forward a certain distance. This distance should be able to
be changed on the fly without uploading a new sketch. Demonstrate your robot’s new abilities to a TA
and submit your sketch (sufficiently commented). For a bonus point, allow the speed and distance to be
configurable.

Note – there is no need to keep the “bump and turn” ability of the Hammerhead. Also note that it is
highly unlikely that this early design will be your final design for the RoboRat. This unit is merely
intended to quickly get you started testing sensor and actuator systems. Remember to keep a “Design
History File”.

Grading:
There are six regular points in this assignment and one bonus point.

Part 1 (demonstration + analysis) is worth 3 points together.

Part 2 is worth 3 points for just a configurable distance robot, but four if the speed and target distance are
both configurable.

Vous aimerez peut-être aussi