arduinoarduino-unoroboticsgyroscopepid-controller

Quadricopter + arduino+mpu6050(gyro+oscillo) +PID


so I'm trying to creat a quadricopter with an arduino and gyroscope mp6050 and this with PID algorithme (using arduino PID,mpu library) so I make everything work separately but when it comes to use PID I don't know how to do it which one will be the input or setput ... I'm confused on how I can use gyroscope information and brushless information and other information to make my quadri fly ... thank you


Solution

  • It sounds like you need a better understanding of what PID does. Here is a great article about real world implmentation of PID http://eas.uccs.edu/~cwang/ECE4330F12/PID-without-a-PhD.pdf

    It follows this code from AVR's website exactly (they make the ATMega32p microcontroller chip on the UNO boards) PDF explanation and Atmel Code in C

    enter image description here
    A PID controller is a feedback control loop.

    The input ("Command" on the diagram) is the desired position, in your case this is what you want the gyroscope to read.

    The "Output" is a control signal. It will tell your brushless motors (the "Plant") what to do to achieve the desired position.

    The Feedback (input/output) We then use our "Sensors" to read the actual position. In your case this is the gyroscope data

    Now the PID controller takes the error = desired position - actual position and uses the error to create the next command. The overall goal is to drive the error down to 0, in other words desired position = actual position The exact details of your PID coefficients are based on your specific setup and usually they must be tuned manually in order to achieve desirable results (see the links provided for more details).

    Loooking at the Arduino PID Library Documentation shows that they have easy methods to set KP, KD, KI, input, output THey even have an autotune parameter that can automatically find your PID constants. Hope that helps, Good luck.