# lechw2-motor-meas

## Lecture Assignment 2: Measurement Motor Performance Without Added Inertia or Friction

Motor Wiring Guidline

1. Mount the motor onto a T-Slot Aluminium Extrusion using the motor mount. Do not attach anything to the motor shaft.

2. Carefully connect using the color diagram at the bottom of the page:

• The motor power to the 12VCD power supply.

• The encoder power and ground to an Arduino 5VDC and Ground.

• The encoder A and B output to two separate Digital I/O pins on the Arduino.

• If you connect the electronics incorrectly you may burn out the Arduino or Motor Encoder. If that happens you can purchase new ones from Pololu and Amazon.

3. Write a simple Arduino program that will:

• Read in a loop when one of the encoder pins switches from high to low.

• When the flip happens increment a encoder count variable and send through the serial port at baud 115200 the:

• Elapsed time between pin flips in microseconds.

• The encoder count.

• When the program is running, connect the power to the motor so you can capture the encoder counts as the motor comes up to speed.

• For this assignment there is no need to measure both encoder output pins, the direction of movement, or use interrupts. We will get to this later.

• To get started you can look in the Arduino program at: File => Examples => 01.Basics => DigitalReadSerial. You will use commands:

4. Import the data collected in step 3 into Matlab

• Calculate the velocity by taking the derivative of the position trajectory. This can be done in a loop or with the Matlab diff command.

• Plot the measured position vs time, and the velocity vs. time. Plot in units of degrees and milliseconds with properly labeled axes and title.

• On the same plots add the theoretical position and velocity from the simulation in Lec HW 1.

5. Discuss the results

• What does the initial slope of the velocity curve represent? How does the simulation and experimental slopes match up? Discuss possible reasons for any differences and why one slope may be larger than the other.

• What does the final value of the velocity curve represent? How does the simulation and experimental velocities match up? Discuss possible reasons for any differences and why one final velocity may be larger than the other.

• Discuss the noise in the plots. Is there more noise in the position or velocity plot, and why?

• Are there any unusual phenomena in the data, and what might be the reasons for this?

Motor and Encoder Wiring Copied from the bottom of https://www.pololu.com/product/3260