AME 3623: Project 2-3
- All components of the project are due by Thursday, February 19th
at 8:00 am
- Groups are the same as for project 1.
- Discussion within groups is fine.
- Discussion across groups may not be about the specifics of the
solution (general programming/circuit issues are fine to
discuss).
At the end of this project, you should be able to:
- through low-level functions, control the speed and direction of DC motors through an H-bridge circuit, and
- use a high-level program to test the functionality of the DC motor control interface.
Component 1: Microcontroller Circuit
The current amplifier board is composed of two full H-Bridge
circuits. We will be using one full H-Bridge to control the lift
fan (allowing us to control rotation speed and direction). We will
split the other H-Bridge into two "Half Bridges": one for each of the
left and right fans. This will allow us to control speed of these two
fans, but not direction.
The detailed documentation for the motor control board can be found on the
Pololu Web site.
The diagrams for the power wiring harness and the amplifier board are shown below.
Add wires to connect the motor control board to the fans and to the batteries:
- Connect GND and VIN directly to the battery (not to your
5V regulated power supply!!!)
- Connect the lift fan to port 2 (OUT 2A and 2B)
- Connect the right fan: red wire to OUT 1A and black wire to GND
- Connect the left fan: red wire to OUT 1B and black wire to GND
Connect the current amplifier board to your Atmel chip (the 15 pin
connector on the left side of the board in the picture below):
- Connect 1PWM and +5V(IN) to your Atmel's +5V power supply
- Connect GND and GND to your Atmel's ground
- Choose one of: timer1, 3, 4 or 5. For the chosen timer, you must have
all three PWM pins available (they are labeled OCXA, OCXB and
OCXC on the Arduino circuit diagram, where X = 1, 3, 4 or 5).
- Connect the following to your Atmel to free digital output pins (but do NOT use B0 ... B3):
- 1INB ("input2"): PWM input for the left fan. Connect to OCXA
- 2PWM ("input3"): PWM input for the lift fan. Connect to OCXB
- 1INA ("input1"): Pulse-Width Modulated (PWM) input for the right
fan. Connect to OCXC
- 2INB/2INA ("input4" and "input5": direction control for the lift fan (0/1:
one direction; 1/0: the other direction).
Power Wiring Harness
Power Amplifier Board
Component 2
Create the function interface that will generate the PWM signals
for each of the three PWM inputs to the motor control board.
Define a new variable type in a new file called "project.h"
typedef enum {
BRAKE,
HOVER
} LiftMotorDirection;
LiftMotorDirection is the new variable type. BRAKE and HOVER
are the two values that LiftMotorDirection variables can take on.
Remember to include "project.h" in your C file.
Implement the following functions:
- int16_t clip(int16_t value, int16_t min_value, int16_t max_value) that returns
- min_value if value is smaller than min_value
- max_value if value is larger than max_value
- value otherwise
-
void set_lift_motor_direction(LiftMotorDirection direction) that sets the
direction bits for the lift fan.
If direction == HOVER, then the lift fan should push air into the chamber, causing the craft to hover (assuming an
appropriate level of thrust).
If direction == BRAKE, then the lift fan should pull air out of the chamber, causing the craft to be pulled to the ground.
- void set_lift_motor_magnitude(int16_t magnitude) that sets
the thrust magnitude for the lift fan. This function must
ensure that magnitude falls within the range of 0... 1023
(which correspond to 0% ... 100% duty cycle). If the value does not,
then it should be clipped to this range.
- void set_side_motor_magnitudes(int16_t magnitude_left, int16_t
magnitude_right) that sets the thrust magnitude for the left
and right fans. This function must
ensure that magnitude_left and magnitude_right fall
within the range of 0... 1023 (which correspond to 0% ... 100%
duty cycle). If either does not, then the offending value
should be clipped to this range.
Note:
- Initialization of the three PWM channels must happen within
your main() function (see the lecture notes on timers).
Component 3
Implement the following in your main() function:
Within your main while(1) loop:
What to Hand In
All components of the project are due by Thursday, February 19th at
8:00 am.
Grading
Personal programming credit:
- Each person must accumulate at least three personal programming
credits over the course of the semester (this project offers
one)
- To receive credit, you must be the primary designer,
implementer and debugger of the component. This does
not mean that your other group members should not be looking
over your shoulder. But: you must do the "driving."
Group grade distribution:
- 35%: Project implementation
- 30%: Demonstration of working project (to either
of the TA or the instructor)
- 35%: Code documentation
Group Grading Rubric
Grades for individuals will be based on the group grade, but weighted
by the assessed contributions of the group members to the non-personal programming items.
andrewhfagg -- gmail.com
Last modified: Thu Mar 26 00:54:36 2015