AME 3623: Project 3
- All components of the project are due by Thursday, March 3rd
at 8:55 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. When adding the power amplifier board to your
breadboard, place it on the edge as far away as possible from the
microcontroller board. In subsequent projects, you will be adding
multiple components to the breadboard, so keep the rest of the breadboard as clear
as possible.
Add wires to connect the motor control board to the fans and to the batteries (6 screw terminal connectors on the right side of the
board picture below):
- Connect GND and VIN directly to the power harness (not to your
5V power supply provided by the Arduino board!!!). Make sure
you do this without the batteries plugged in.
- Connect the lift fan to port 2 (OUT 2A and 2B)
- Connect the right fan: red wire to OUT 1A and black wire to power harness GND
- Connect the left fan: red wire to OUT 1B and black wire to power harness 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 (via a 10K-ohm pull-up resistor) 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):
- 1INA ("input1"): Pulse-Width Modulated (PWM) input for the right
fan. Connect to OCXA
- 1INB ("input2"): PWM input for the left fan. Connect to OCXB
- 2PWM ("input3"): PWM input for the lift fan. Connect to OCXC
- 2INB/2INA ("input4" and "input5": connect to two free digital output pins. These are used for
direction control for the lift fan (0/1: one direction; 1/0: the other direction; 0/0 or 1/1: dynamic braking).
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 {
STOP,
HOVER
} MotorDirection;
MotorDirection is the new variable type. STOP and HOVER
are the two values that MotorDirection variables can take on.
Remember to include "project.h" in your C file.
Implement the following functions:
-
void set_lift_motor_direction(MotorDirection 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 == STOP, 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 fit within the range,
then it should be clipped to this range. Remember that you have already implemented a useful function in the prior project.
- void set_lateral_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
- Code: Check your documented code into your
group subversion tree for project 3.
This is due by Thursday, March 3rd at 8:55 am.
- Demonstration/Code Review: All group
members must be present. This must be completed by Friday, March 4th.
- Personal report: fill out the CATME survey. This will
be due shortly after the deadline. These personal reports are used
to provide feedback to you and your group members. Individual grades will not be assigned if the
survey is not filled out.
Grading
-
Personal programming credit: this project offers one programming credit.
-
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: Wed Mar 2 23:34:58 2016