This wiki has been archived and made read-only.
For up-to-date information about TkkrLab and it's projects please visit our main website at tkkrlab.nl.

Quadcopter

From

Revision as of 11:43, 21 August 2014 by Michiel brink (Talk | contribs) (stm32f3 bookmarks)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Project: Quadcopter
Quadcopter Picture.jpg
Name Quadcopter
Initiator Michielbrink and Vondel
Status In progress
Skills lots of skills
Summary awesome quadcopter with a lot of sensors


The quadcopter

To give you an idea of what we are planning with our Quadcopter, here is a list of features we want to include:

  • gyroscope
  • accelerometer
  • compass
  • ultrasonic range sensors on every corner
  • control via wifi
  • live webcam stream
  • according to a comment with the motors we bought: at 1,3Kg, speed up to 75km/h
  • servo to tilt webcam.
  • battery measurement through adc -> uart on msp430g2553.
  • stm32f3 discovery board as brain.
  • raspberry pi for the webcam stream, control and more fun stuff
  • gps (in the distant future)
  • and lots more!

buy list

We ordered for two people but the prices are per person. so there are units at this list that are half.

conrad.nl

hobbykings

random ebay shops

5 Paar = 10 x XT60 Lipo XT-60 Hochstromstecker Stecker & Buchse vergoldet RC 60A] (max 60A) (€3,375)


after shopping

  • 4, Turnigy Multistar 20 Amp Multi-rotor Brushless ESC 2-4S (OPTO) (max 20A) ($39.16)
  • hobbykings stuff (€42,74)
  • 3x #017000058/36344 8045 SF Props 2pc Standard Rotation/2 pc RH Rotation (Black) (EU warehouse) = $10.35
  • 1x #9323000002/36428 Hobbyking X525 V3 Glass Fiber Quadcopter Frame 600mm (EU warehouse) = $18.45
  • 4x #LPGUARD18x22/38354 Lithium Polymer Charge Pack 18x22cm Sack (EU warehouse) = $10.92
  • 1x #015000023/42109 Nylon XT90 Connectors Male/Female (5 pairs) (EU warehouse) = $9.4

stm32f3 bookmarks

http://www.linushelgesson.se/2012/04/pitch-and-roll-estimating-kalman-filter-for-stabilizing-quadrocopters/

License for the stm files https://github.com/micropython/micropython/issues/26 (we need MIT?)

raspberry pi <--> stm32f3 communication

  • spi speeds available on the raspberry pi : 0.5 MHz ; 1 MHz ; 2 MHz ; 4 MHz ; 8 MHz ; 16 MHz ; 32 MHz
  • the data is like [command-code, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7]
  • the command-code is one byte

0x01 = no operation
0x02 = set speed of motors [0x02, m1, m1, m2, m2, m3, m3, m4, m4] (the motor data is 2 times 8 bit (big-endian)
0x03 = control leds on stm [0x03, led_byte, 0, 0, 0, 0, 0, 0, 0]
0x04 = 
0x05 = set web-cam angle
0x06 = 
0x07 = 
0x08 = 
0x80= control leds on quadcopter [0x80, l1, l2, l3, l4, l5, l6, l7, l8]
0x81= control leds on quadcopter [0x81, l9, l10, l11, l12, l13, l14, l15, l16]
0x82= control leds on quadcopter [0x82, l17, l18, l19, l20, l21, l22, l23, l24]

computer/phone <--> raspberry pi communication

  • over tcp/ip because it have an error checking

raspberry pi

  • in python
  • if there is a crash or error -> restart python script [1]
  • password for user pi is: aaps

laptop client

  • in java because it´s OS friendly

measure data, motor

rotor: 8" x 4.5" motor: max 15.8A

  • 14% 0.4A 1500RPM 50g
  • 19% 1.5A 3000RPM 100g
  • 23% 3.2A 4000RPM 200g
  • 28% 4.8A 5000RPM 250g
  • 33% 7A 6000RPM 400g
  • 41% 12.3A 7500RPM 550g
  • 47% 15.4A (Warning!!! to close to the end)

Raspi-motor-speed-measurement-graph-michielbrink.svg

Here are measured values from my static test
Accu: LiPo 3S
Measuring device: Turnigy SuperBrain 40A
Each Prop was run 15sec under full throttle

Propellers:
MA=Master Airscrew Propeller
JXF=JXF Prop 

MA6x3: 12V, 6.5-7.1A, ~11500RPM, ~85W
MA6.5x4: 11.8V, 9.1A, ~10700RPM, ~110W
JXF7x6: 11.6-11.5V, 9.7-10.4A, ~10100RPM, ~120W
JXF8x6: 11.5-11.3V, 11.7-12.3A, ~9200RPM, ~140W
JXF8x8: 11.1-11.0V, 14.3-14.9A, ~8400RPM, ~160W
no prop: 11.8V, <0.6A, ~13500RPM
calculated Kv ~1140 (near to specification)

Motor was warm (not hot) after the test with each propeler
If is not planned to run under full throttle most of the time then 8x8 prop can be used. I expect that motor load will be slightly lower during the flight.
Currently I don't have plane where motor can be used finished.

Result: Motor has parameters as stated.

adc electronics

adc emulation

circuits (quadshields)

raspberry pi
stm
  • [comming soon]
power
  • [comming soon]
ledstrip
  • [comming soon]

the firmware for the msp430g2553 (adc to uart)

    #include <msp430.h>
    #include <stdbool.h>
    #include <stdio.h>
 
    #define GND         BIT4
    #define DAT         BIT5
    #define RXD		    BIT1
    #define TXD		    BIT2
 
    char buffer[4];
    int adc_new;
    int adc_old;
    char * adc_string;
 
    void uart_putc(unsigned char c);
    void uart_puts(const char *str);
    int adc_read();
    void Delay_ms(unsigned int ms);
 
    int main(void)
    {
        //msp430 init
        WDTCTL = WDTPW + WDTHOLD;         // Stop WDT
        BCSCTL1 = CALBC1_1MHZ;            // Set DCO to 1MHz
        DCOCTL = CALDCO_1MHZ;  
 
        //pin init
        P1SEL  = RXD + TXD;                     
        P1SEL2 = RXD + TXD;
        P1DIR |= GND;
        P1OUT&=~GND;
 
        //uart init
        UCA0CTL1 |= UCSSEL_2;                     // SMCLK
        UCA0BR0 = 104;                            // 1MHz 9600
        UCA0BR1 = 0;                              // 1MHz 9600
        UCA0MCTL = UCBRS0;                        // Modulation UCBRSx = 1
        UCA0CTL1 &= ~UCSWRST;                     // Initialize USCI state machine
        IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt  
 
        //adc init
        ADC10CTL1 = INCH_5 + ADC10DIV_3 ;         // Channel 5, ADC10CLK/4
        ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE;  //Vcc & Vss as reference
        ADC10AE0 |= BIT5;                         //P1.4 ADC option
 
        __enable_interrupt();
 
        Delay_ms(1);                   // Wait for ADC Ref to settle
 
        while(1)                    
        { 
            Delay_ms(500);  
            adc_new = adc_read()*10/1023;
            if(adc_new != adc_old)
            {
                sprintf(adc_string, "%d",adc_new);
                uart_puts(adc_string);
                adc_old = adc_new;
            }   
        }
    }
 
    //uart
 
    void uart_putc(unsigned char c)
    {
        while (!(IFG2&UCA0TXIFG));              // USCI_A0 TX buffer ready?
        UCA0TXBUF = c;                    		// TX
    }
 
    void uart_puts(const char *str)
    {
        while(*str) uart_putc(*str++);
    }
 
    //adc
 
    int adc_read()
    {                  
        ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start
        __bis_SR_register(CPUOFF + GIE);        // LPM0 with interrupts enabled
        return(ADC10MEM);
    }
 
    __attribute__((interrupt(ADC10_VECTOR)))
    void ADC10_ISR(void) 
    {
      __bic_SR_register_on_exit(CPUOFF);        // Return to active mode
    }
 
    //delay
 
    void Delay_ms(unsigned int ms)
    {
        while(ms--)
        {
        __delay_cycles(1000);
        }
    }