This controls Quadrotor ESC
Quad Rotor control with mbed
Here is a video of it flying while being held down /media/uploads/Ryan/img_0735.mov
List of Parts
Q450 Glass Fiber Quadcopter Frame 450mm - Integrated PCB Version
HobbyKing ECO6 50W 5A Balancer/Charger w/ accessories
Turnigy dlux 20A SBEC Brushless Speed Controller w/Data Logging (2s4s)
Turnigy 3300mAh 3S 30C Lipo Pack "I changed this to a 2,200mAh 4S battery"
NTM Prop Drive Series 28-26A 1200kv / 250w
Specs
Stable flight is some where around 0.00139ms pulseWidth and it pulls 14.7amps so 2,200/1000/14.7*60= about 8.97 of flight time.
main.cpp
- Committer:
- Ryan
- Date:
- 2012-08-17
- Revision:
- 0:fe6280c7a52f
File content as of revision 0:fe6280c7a52f:
#include "mbed.h" #include "stdio.h" #include "stdlib.h" #include "string" AnalogIn Volts(p20); PwmOut BLDCM1(p21); PwmOut BLDCM2(p22); PwmOut BLDCM3(p23); PwmOut BLDCM4(p24); Serial pc(USBTX, USBRX); //red right p21 //blue right p22 //white left p23 //red left p24 // -----------> Make SURE!! each ESC is grounded on mbeds ground!!!!!!!!!! <------------ float val; int main() { val =0.001; // Most ESC take standard servo commands so that is a 50hz signal and listens between 1ms and 3ms pulsewidth BLDCM1.period_ms(20); BLDCM2.period_ms(20); BLDCM3.period_ms(20); BLDCM4.period_ms(20); //////////////////////////////// while (1) { //Initailize motors if(pc.readable()){ switch (pc.getc()) { case 'u': val += 0.00005; break; case 'd': val -= 0.00005; break; case 'w': val += 0.00001; break; case 'x': val -= 0.00001; break; case 's': val = 0.001; break; case 'm': val = 0.0018; break; } } BLDCM1.pulsewidth(val); BLDCM2.pulsewidth(val); BLDCM3.pulsewidth(val); BLDCM4.pulsewidth(val); wait(0.25); pc.printf("Volts (%f) Pulsewidth (%f) RPM (%f) \n",(((val*1000)*12)),(val),(((val*1000)*1200))); } }