Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
Homepage
Feel free to look at code and implement your own. This article will be updated slowly, whenever I get a break from rock climbing, university and work commitments. Feel free to comment or ask me questions as need be.
Trung Tin Ian HUA - pHysiX Coding May 2014
Introduction¶
Quadcopter (X-Mode) using RTOS.
Insert picture of build
Partslist¶
Sensors¶
- TiltyQuad
- InvenSense MPU6050
- HMC5883L
- MPL3115A2
- Onboard voltage divider for voltage sensing
Frame¶
- Hobbyking SK450
- Custom 3D printed motor mounts
- 5.5mm thickness vibration-absorbing foam
Propulsion¶
- 4x Hobbyking Blue 30A ESC, flashed with SimonK firmware
- 4x Turnigy D2826/950kV motors
- 2x LH 10x4.5 props
- 2x RH 10x4.5 props
Electrical¶
- 1x Turnigy 1000mAh 20C Lipo (Entire control logic uses 300mA peak)
- 1x Zippy 5000mAh 30C Lipo
- 1x Turnigy 5A max Low RF Noise BEC
Radio¶
- 1x HC-05 Bluetooth (TiltyQuad IMU)
- 1x Turnigy 9x v2 9 channel receiver
- 1x Turnigy 9x v2 9 channel transmitter, flash with OpenTX and running lipo pack
Implementation¶
RTOS¶
4 main threads:
- Thread1: Sample MPU6050 and calculate Yaw Pitch Roll angles from DMP quaternion
- Settings: 100Hz sampling rate, 100Hz output FIFO buffer
- Thread frequency: 100Hz
- Thread 2: Gyro sample, and PID control loop. Currently only has Secondary/Inner loop (Rate control).
- Settings: Input limits: -500.0, 500.0; Output limits: -200.0, 200.0; Output bias: 0.0, Automatic mode
- Settings: Proportional gain: 8.0, No Integral or Derivative gain
- Thread frequency: 200Hz (Primary/Outer loop will operate at 100Hz)
- Thread 3: RC & Bluetooth Command, and Telemetry control
- Settings: Default quadcopter is unarmed, and no telemetry is outputted.
- Thread frequency: 50Hz
- Thread 4: Update ESC pulsewidth
- Note: My ESCs can apparently handle refresh rates of up to 400Hz. This means that the ESC should handle a 400Hz PWM pulse. This is distinguished from how fast I update the actual pulsewidth/duty cycle of my pulse!!!
- Settings: PWM frequency: 200Hz, can be increased to 400Hz if the processor/code is fast enough.
- Thread frequency: 200Hz. Thread should be increased to 400Hz since Secondary PID loop is running at 200Hz.
MPU6050 Sampling¶
To be completed
Gyro Sampling & PID calculations¶
To be completed
RC & Bluetooth Command, and Telemetry¶
To be completed
Update ESC¶
To be completed
Results/Demonstrations¶
Link to youtube video
To do/discussions (respective order of priority)¶
- Implement Integral control (P-PI or PI-P);
- Improve Control loop (remove slight oscillations, investigate D gain)
- Add support for EEPROM to store tuned gains outside of default
- Remove Bluetooth arming dependency
- Remap keyboard input for intuitive Telemetry/control
- Add in LCD output for offline setting/debugging
- Add in voltage sensing alarm
- Build GUI using Processing for Multiwii-like control
- Finish this article!