Upload
eugene-bradford
View
215
Download
0
Embed Size (px)
Citation preview
Autonomous Helicopter
James Lyden EE 496Harris Okazaki
Project Overview
The goal of this project is to create a helicopter capable of
flying itself. The helicopter should be able to take off, fly to a predetermined location, and land without user input (during
flight). The target will be specified pre-flight by a user,
through a computer interface.
Hardware Modules Onboard Controls
Master Microcontroller
Slave Microcontroller
Sensors
Accelerometer
Gyroscope
Communications
Bluetooth Transceivers onboard and on PC
PID Correction System
PC
Block Diagram
User: input flight plan
3 AxisAccel
Gyro
Servos
PC w/BT:calculates
control signals
Master μCBT
transceiver
Slave μC
OFFBOARD ONBOARD
Software Flow
PC Software Flow
Initialize:Open Serial PortTest Serial Port
Get Data:Listen for PacketParse Packet Store Data:
Update Pos/Vel/AccUpdate Error ValuesPID Calculations:Read Error ValuesCompute Corrections
Flight Planning:Check Flight ModeAdd Desired Offsets
Format Output:Combine Offsets+PIDPut Data Into Buffer
Send Data:Write Buffer to
Serial Port
Software Flow
Master μCSoftware Flow
Initialize:Open Serial PortsInitialize SensorsInitialize PWMs
Get Sensor Data:Send CommandsRead/Save Responses
Format Sensor Data:Use 8 MSbsCast To Chars
Send Sensor Data:fprintf Each ByteWrap Word With Tags
Get Correction Data:Wait For UART ReadyRead 4-Byte Word
Set Control Signals:Parse First 2 BytesSet PWM Duty Cycles
Software Flow
Slave μCSoftware Flow
Initialize:Open Serial PortInitialize PWMs
Get Correction Data:Wait For UART ReadyRead 4-Byte Word
Set Control Signals:Parse First 2 BytesSet PWM Duty Cycles
Focus: Accelerometer Interface (components)
Digital Interface Microcontroller: I²C Master Accelerometer: I²C Slave ADC performed by accelerometer All data transfer performed via register
read/write
Wiring SCL: clock, synchronizes data rate SDA: Bidirectional data line; only one device
can transmit at a time, negotiated by I²C protocol
Focus: Accelerometer Interface (tests)
Communications test:
Read the WHO_AM_I register, verify it reports known value
Write config data to CTRL_REG1, read to verify it worked
Scale test (once per axis):
Tilt sensor so target axis is subject to gravity, read the value of each axis, verify target axis is roughly 1g while other axes are roughly zero.
Speed test:
Read values from all 3 axes at a rate of 2.56KHz (delay 390 µs between reads), ensure data changes as we tilt sensor
Focus: Accelerometer Interface
Master Microcontroller Accelerometer
Initialize I²C
Send: I²C Start
Send: Write EnableADC Register
Send: Read [X,Y,Z] Axis Register
Receive: [X,Y,Z] Axis Value
Store: [X,Y,Z] Axis Value
Listen on Bus
Start ADC Conversions
Fetch Register Contents
Send: Register Contents
Wait for Conversion to Finish
(Updates at 2.56KHz)
Focus: Accelerometer Interface (design
decisions) Using digital vs. analog interface
Analog interface would have required using microcontroller's ADC, which would also be occupied by gyroscope
Analog interface used 3.3V logic, limiting the full range when coupled to the 5V microcontroller ADC
Less ADC code interspersed through the microcontroller code
Using I²C vs. SPI
SPI uses 4 wires, where I²C only requires 2 Using one 3-axis device vs. multiple single-axis devices
Size and weight constraints, as well as wiring complexity
Remaining Work Testing
Gyroscope digital interface Master microcontroller loop speed
We need to know if the loop runs faster than ADC
Refinement PID scale tuning Optimize code in master microcontroller main loop If we have time, increase baud rate for serial
communications
Implementation Accelerometer interface (partially done) User interface
Gantt Chart
\ Week February March April May Todos \ 02/03/08 02/10/08 02/17/08 02/24/08 03/02/08 03/09/08 03/16/08 03/23/08 03/30/08 04/06/08 04/13/08 04/20/08 04/27/08 05/04/08 05/11/08 05/18/08
Hardware:3.3V Power Supply5V Power Supply
PCB LayoutPCB AssemblyDebugging
PC Software:Data AggregationPID Algorithm CodingBT Serial InterfaceUser InterfacePID TuningDebugging
Documentation:Draft of Final PaperFinal Paper