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.
Revision 0:fe6280c7a52f, committed 2012-08-17
- Comitter:
- Ryan
- Date:
- Fri Aug 17 14:18:42 2012 +0000
- Commit message:
- Finished
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 17 14:18:42 2012 +0000 @@ -0,0 +1,66 @@ +#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))); + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Aug 17 14:18:42 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479 \ No newline at end of file