AME 3623: Project 2:
Analog to Digital Conversion and Sensor Interfaces
- All components of the project are due by Thursday, March 15th
at 5:00pm.
- 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).
Project Objectives
At the end of this project, you should be able to:
- read analog information through the Atmel Analog-to-Digital
converter,
- using a sensor model, interpret analog voltages in terms of
sensed quantities, and
- convey information about sensors using a set of LEDs and using serial output.
Project Components
All components are required to receive full credit for the project.
Part 1: Microcontroller Circuit
Add new components to your circuit:
- Connect a second switch to a digital input of your Mega2560
- Add the gyro module to the board. Provide this module with
power (+5V) and ground inputs (note that 3 pins on the gyro
need to be grounded). Connect the analog output
to one of the analog inputs on the mega2560.
- Connect the two analog distance sensors to two analog inputs on the meg2560. Each
require power (+5V) and ground inputs.
Part 2: Rate Gyro
Note: this part will count for one personal programming credit
Add to your main program:
Implement the following functions to support your main() function
(these are requirements):
- int16_t get_gyro_rate(void) will read
the analog port attached to the gyro sensor and return the
value in 10ths of a degree per second. Note that a return
value of zero should correspond to
no rotation, positive values should correspond to counter
clock-wise rotations, and negative values should correspond to
clock-wise rotations.
The gyro will respond with a max of 3.3V, which corresponds to 300
degrees/sec, and a minimum of 0V, which corresponds to -300 degrees/sec
(right handed coordinate frame). The gyro responds linearly to velocities.
- void display_rotation_rate(int16_t rate) will change
the state of the ten LEDs (and no others) to reflect the current
rotation rate.
Part 3: Distance Sensors
Note: this part will count for one personal programming credit
Implement the following functions:
- uint16_t get_ir_distance(uint8_t index) will read
the analog port attached to the left distance sensor (if index
== 0) or the right distance sensor (if index == 1)
and return the value in mm. The distance sensors are
Sharp GP2Y0A21YK sensors
- void display_distance(uint16_t dist) and
will change the state of the ten LEDs to reflect the current distance.
Part 4: Hovercraft Layout
Mount the following to your Frisbee:
- Batteries
- Forward thrust fans
- Breadboard
- Distance sensors. These should be mounted so that if
the hovercraft is against a wall, there is at least 6cm between
the sensor and the wall.
Let us know if you need any additional components for mounting.
References
Hints
- Serial port 0 on the Mega2560 is connected to the USB
connector that you plug into your laptop. You can use hyperterm to receive/send serial data
from/to the Mega2560 (via fprintf, fputc, fputs and fgetc).
You may use this serial interface to receive information from
your program and to respond to commands from your laptop. To configure hyperterm, you will need to
select the port (findable from the hardware section of your
control panel) and serial bit (or baud) rate. In this case, it
is 38400.
What to Hand In
All components of the project are due by Thursday, March 15th at 5:00pm.
Grading
Group grade distribution:
- 35%: Project implementation
- 30%: Demonstration/presentation of working project (to either
of the TA or the instructor)
- 35%: Code documentation and group report
Grades for individuals will be based on the group grade, but weighted
by the assessed contributions of the group members.
fagg [[at]] cs.ou.edu
Last modified: Wed Mar 21 16:08:38 2012