Posted on

Previous: Lab 3

Prelab

I decided to connect my motor drivers to Artemis pins A13, A14, A15, and A16, and wire the car like so:

Wiring diagram

We power the motors with a separate battery from the Artemis to reduce the effect of back-EMF on the Artemis. There's no reason to have the varying load of the motors effect the stability of the Artemis' computations. Two smaller battçeries in separate locations also helps with reducing the form factor of the whole car.

Lab Tasks

After soldering my motor drivers, I passed a PWM value of 200, leading to the following duty cycle when supplied with 3.7V from the lab power supply.

I chose to set the supply for 3.7 V because the 1S LiPos we use operate at the same voltage. I set a maximum current draw of 1.5A, well below the limits of the parallel motor driver, for safety.

To initially test the drivers, I wrote functions to move the car forward, backward, and spin it.

This resulted in the following motor output:

With battery leads soldered and batteries attached, I performed the following test without any motor compensation:

This was my initial setup:

Wiring diagram

I found that my motors failed to drive the car forward and backward (with a fully-charged battery) up to a PWM value of around 30. It failed to turn about its own axis up to PWM 90, however, due to the increased slip friction of the wheels. All tests were performed on vinyl tiling.

To calibrate the motor, I simply multiplied the input to the side with greater friction by a constant. It took a bit of tuning, but I landed on a constant coefficient of around 1.4 for the left motor. It's worth noting, though, that the required coefficient dropped significantly as the battery lost charge -- on the last few tests of a battery, the car kept straight with a constant of around 1.2.

I used the following code to narrow down this constant, where the coefficient is passed via BLE.

Collaborations

I worked with Lucca Correia and Trevor Dales extensively, and referenced Daria's and Mavis' site for wiring and local test code snippets.

Next: Lab 5