How to start Quadocopter...??

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
HI,

I don't understand why motor drew current some times 1.8amps some times 3.8Amps.
I am using 12V 4Amp power suplly and for large current i usually connect more adapter in // to increase current.

So, why sometimes motor drew motor current sometimes less??
is there any other specif theory of it???
 

Audioguru

Joined Dec 20, 2007
11,248
If you are using a electronic speed controller for your brushless motor and it requires the signals from a model radio controlled system then simply make a testing circuit for radio controlled servos. It makes pulses of different widths to control a servo or for motor speed control. 0.92ms is zero motor speed and 2.12ms is maximum motor speed.
 

Audioguru

Joined Dec 20, 2007
11,248
Where will you buy gyroscope ICs?
Quad-copters that are sold today have 2 or 3 gyroscopes to feed the micro-controller together with your inputs.

Now modern RC model airplanes also come with gyroscope ICs.
 

Audioguru

Joined Dec 20, 2007
11,248
Speed controllers for little brushless motors are available and are inexpensive. Instead of designing one we simply buy one.

We do not know what are the inputs and outputs of your micro-processor.
Usually the gyroscopes and an RC radio receiver provide inputs.

How does a quad-copter change its yaw?
 

Audioguru

Joined Dec 20, 2007
11,248
It says it is controlled with PPM and I2C so learn about them.

I think PPM is the 1ms to 2ms pulse width delivered by most RC receivers.

What is a "potential meter"?
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
It says it is controlled with PPM and I2C so learn about them.
I have sen that, but i have no idea how to start coding of it in PIC uC..!
and I mean to say i want to control speed from Variable Resistor, for testing it!
 

Audioguru

Joined Dec 20, 2007
11,248
You can use a 555 IC to make a variable 1ms to 2ms pulse width that is used to test RC servos and speed controllers.
Maybe a PIC uC can do it and also maybe do I2C instead.
 

SgtWookie

Joined Jul 17, 2007
22,230
Why are you insisting on the PIC16F877? The PIC16F87x series has basically been superceded by the PIC16F88x series. One rather large advantage is that you can use the built-in clock of the PIC16F887, rather than an external clock being mandatory on the PIC16F877. Crystals are rather fragile, so you should keep that in mind.

If you want to know how to program a PIC, you should start off reading some tutorials. Microchip supplies a number of example programs with the tutorial that comes with the free MPLab. There are also lots of routines available for downloading from the Microchip site.
 

Audioguru

Joined Dec 20, 2007
11,248
What will the PIC do without having inputs from gyros?
YOU will be the pilot, not the PIC.

I wonder how they hover and control the yaw by turning it around to the left or right?
 

Markd77

Joined Sep 7, 2009
2,806
If you have the rotors arranged like this (cw=clockwise, ccw=counterclockwise):
Rich (BB code):
cw-------------ccw
|               |
|               |
|               |
|               |
|               |
|               |
ccw------------cw
Increasing the speed of the two cw propellors, and decreasing the ccw ones will cause it to rotate.
Increasing the left side speeds and decreasing the right will cause it to tilt, but not rotate.
Increasing a corner speed and decreasing the opposite corner speed will cause it it to tilt, but not rotate.

So, how to start it using PIC uC...??
I suppose the best place to start is to generate the servo pulses, try to generate 4 on 4 pins. Your PIC has an ADC so you could connect a potentiometer to that for initial testing.

I wrote this when I was learning PICs, it's pretty bad, and your PIC has 16 bit timers which should suggest an improvement.

Rich (BB code):
    list    p=16F84a 
    radix    hex 
    title "SERVO" 
        #include <p16f84a.inc> 
    __config _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC 
 
;    servo control 1-2ms pulse every 20ms  
    cblock 0x0C 
    W_TEMP 
    STATUS_TEMP 
 
    servo0            ;pin rb0 position 0-255 
    servo1 
    servo2 
    servo3            ;pin rb3 
    intservogoto 
     
    endc 
     
 
;    org 0x2100        ;initial values for timer H and L bytes (10 seconds) 
;    de 0x00,0x0a    ;first 2 bytes of eeprom 
 
;---------------------------------------------------------------------- 
 
    org    0x000 
    goto init 
    org 0x004    ;interrupt goes here 
    MOVWF W_TEMP ; Copy W to TEMP register, 
    SWAPF STATUS, W ; Swap status to be saved into W 
    MOVWF STATUS_TEMP ; Save status to STATUS_TEMP register 
         ; Interrupt Service Routine 
     
;writes intservergoto to program counter to send timing pulses to 4 servos in sequence 
;without any messy logic. Initial value of intservergoto 09h. Timing is for 4MHz clock 
;0 in servo variables gives about 2ms pulse, 254 gives about 1ms 
;Don't use 255 for servo value  
;Advantages: fast, not many files used 
;Disadvantages: uses lots of program memory, hard to modify 
 
    movfw intservogoto     
    movwf PCL 
mk0 
    call prescaler4        ;PCL 09h        servo0 
    bsf PORTB,0            ;start pulse and next interrupt after 1ms 
    movlw low mk1 
    movwf intservogoto 
    goto endint 
mk1 
    movfw servo0        ;PCL 0E 
    movwf TMR0            ;variable part of pulse 0-1ms 
    movlw low mk2 
    movwf intservogoto 
    goto endint 
mk2 
    call prescaler16    ;PCL 13 
    movlw 30            ;for 3.5ms pause before next servo 
    movwf TMR0 
    bcf PORTB,0            ;end pulse 
    movlw low mk3 
    movwf intservogoto 
    goto endint 
mk3 
    call prescaler4        ;PCL 1A        servo1 
    bsf PORTB,1            ;start pulse and next interrupt after 1ms 
    movlw low mk4 
    movwf intservogoto 
    goto endint 
mk4 
    movfw servo1        ;PCL 1F 
    movwf TMR0            ;variable part of pulse 0-1ms 
    movlw low mk5 
    movwf intservogoto 
    goto endint 
mk5 
    call prescaler16    ;PCL 24 
    movlw 30            ;for 3.5ms pause before next servo 
    movwf TMR0 
    bcf PORTB,1            ;end pulse 
    movlw low mk6 
    movwf intservogoto 
    goto endint 
mk6 
    call prescaler4        ;PCL 2B        servo2 
    bsf PORTB,2            ;start pulse and next interrupt after 1ms 
    movlw low mk7 
    movwf intservogoto 
    goto endint 
mk7 
    movfw servo2        ;PCL 30 
    movwf TMR0            ;variable part of pulse 0-1ms 
    movlw low mk8 
    movwf intservogoto 
    goto endint 
mk8 
    call prescaler16    ;PCL 35 
    movlw 30            ;for 3.5ms pause before next servo 
    movwf TMR0 
    bcf PORTB,2            ;end pulse 
    movlw low mk9 
    movwf intservogoto 
    goto endint 
mk9 
    call prescaler4        ;PCL 3C        servo3 
    bsf PORTB,3            ;start pulse and next interrupt after 1ms 
    movlw low mk10 
    movwf intservogoto 
    goto endint 
mk10 
    movfw servo3        ;PCL 41 
    movwf TMR0            ;variable part of pulse 0-1ms 
    movlw low mk11 
    movwf intservogoto 
    goto endint 
mk11 
    call prescaler16    ;PCL 46 
    movlw 30            ;for 3.5ms pause before next servo 
    movwf TMR0 
    bcf PORTB,3            ;end pulse 
    movlw low mk0 
    movwf intservogoto 
mk12 
    goto endint 
 
prescaler4 
    bsf     STATUS, RP0    ; bank 1 
    movlw   B'10000001'     ; prescaler 4 
    movwf   OPTION_REG      ;   
    bcf     STATUS, RP0    ; bank 0 
    return 
 
prescaler16 
    bsf     STATUS, RP0    ; bank 1 
    movlw   B'10000011'     ; prescaler 16 
    movwf   OPTION_REG      ;   
    bcf     STATUS, RP0    ; bank 0 
    return 
 
endint 
 
     ; should configure Bank as required 
     ; 
    SWAPF STATUS_TEMP,W     ; Swap nibbles in STATUS_TEMP register 
    ; and place result into W 
    MOVWF STATUS             ; Move W into STATUS register 
    ; (sets bank to original state) 
    SWAPF W_TEMP, F         ; Swap nibbles in W_TEMP and place result in W_TEMP 
    SWAPF W_TEMP, W         ; Swap nibbles in W_TEMP and place result into W 
    clrf INTCON                ;clr interupts 
    bsf    INTCON,T0IE            ;enable timer interupt 
    retfie 
     
init    ;initialise stuff here 
    ;sets interupts only on timer0 internal and prescaler 256 
     
    bsf     STATUS, RP0    ; bank 1 
    movlw   B'10000111'     ; rtcc inc = tcylc/256 = tclk/(4*256) 
    movwf   OPTION_REG      ;   
    bcf     STATUS, RP0    ; bank 0 
 
    movlw low mk0 
    movwf intservogoto 
 
    clrf    TMR0            ; reset timer (and prescaler!) 
    movlw   B'10100000'     ; enable timer interrupt and GIE 
    movwf   INTCON          ;   
     
    BCF STATUS, RP0 ; bank 0 
    CLRF PORTB                 ; Initialize PORTB by 
                            ; clearing output 
                            ; data latches 
    BSF STATUS, RP0         ; Select Bank 1 
    MOVLW B'11110000'         ; Value used to 
                            ; initialize data 
                            ; direction 
    MOVWF TRISB             ; Set RB<0-3> as output, all others input 
                            ;porta should all be inputs anyway 
    BCF STATUS, RP0         ;bank 0 
 
 
start 
     
    goto start 
 
 
 
 
    end
 
Last edited:
Top