BlueCopter - Arduino Quadcopter

Hey Basel,

Unfortunately i have to use the Arduino uno.
The exact esc's i am using are these ones: (99% sure they are the same ones) Radio Control Planes, Drones, Cars, FPV, Quadcopters and more - Hobbyking

I now just need an imu, could you link me to a good one? (cheaper the better)
Can i get one from hobbyking? (prefered)

Could you draw me up a wiring diagram of where i should plug the imu, receiver, and esc's to the Arduino uno? That would make it 10x easier thank you. The last question i still have is the files... I use "bluecopter.ino" right?

I am 16 and very new to programming, what exactly is the main conflict with the rx code?

Basel,
the child Jesus bring peace and joy to your life and your family! keep it up! Merry christmas and a prosperous new year!

Basel ,
is too strange because of som so it oscillates with the addition of the term " D " did as you told me , and nothing varied the RX_SENSITIVE , decreases to 1 and then increased to 2 and nothing ! one hours initiated in the same " loop " setting of the two values ​​at the same time , "P" and "D " to see if it still respendendo , in case that best P value of 0.315 was found and it continued by adding Kd Replying the stick but not swayed somehow got to add kd equal to 0.2 and nothing , so I uploaded again and tried to vary only the Kd and as before nothing happens on the stick , I think something in the code interferes with the setting of other parameters ! if he'd like to find the period of the oscillations could use the term P - Zilguer Niches to find the critical period ? can you help me !
Is it my trasmissor that has no configuration ?

The video explains well ! and provides for the osclilações , where the term P well they are visible, they are smaller in D and R even lower !

Can you help me ?

satiro:
Can you help me ?

Hey,

It sounds like you have a small delay.. That delay could be the Serial interface.. So just put the D-term to 0.014 (I calculated this number) and try adjusting the I-term instead..

//Basel

Basel, as you did to get its values??? apneas used your step by step? used the serial interface? used some of matlab script and model of the plant? Yesterday I downloaded two batteries and can only find the right value of "P", it swings even!
How do I adjust without using the serial, after all you said that you have not tested this example, so it has no chance to even work. 'll Susbtituir values ??in config.h as you said P = 0.315 and D = 0.014 and I will try to find the value of I, if I could still talk today ahar something.

@satiro: I did use matlab.. I used the serial interface to get data for my model (taking all the delays into consideration in the plant model), then optimized the PID values for the plant model and used those values in my final design..

//Basel

Basel, you can send me the Matlab script for me to try to find the values ??of PID? Look, what you did was find values ??in Matlab with your plan then test and optimize these values ??in the model real.Com time you can use Zilgler-Nichols to find the critical gain and critical period, was that what you did? if possible send scritp Simulink for satiromedeiros@yahoo.com.br.

Basel, tried with the value you suggested and got the Ki value = 0.83, have not tried to fly but tomorrow I will test for real! Look, I know sometimes I'm annoying, but it's for a good cause, I need your help because I'm trying to fly with this Quadcopter .. hey, he's my college work and then I want to thank your references as you should and send you a copy of my work! as I said I'm bothering you more than it should. Look also use Matlab and Simulink have a scrip in, just to test. You could look at it and suggest corrections to me, I am sending you attached, and as I said before, just answer me in satiromedeiros@yahoo.com.br. My version of Matlab is ra2011

Saida_PID_Quad.zip (9.81 KB)

Greetings Basel,

Thanks for your great job and happy New Year.
I am a newbie in microcontrollers and arduino. Trying to learn day by day. As I said I am a newbie, my question may be ridiculous. Sorry for that.
My first question is about analogwirte(). You used analogwrite() to trigger the motors’ esc (am I wirte?), I am a bit confused because there some info says that the analogwrite() cannot be used to trigger the servos and esc (http://forum.arduino.cc/index.php/topic,5701.0.html). I tried to control my servo with analogeitre() but I couldn’t. How did you control the escs with analogwrite()?I will appreciate if you explain this.

Regards,
zafer

Greetings Basel,

I don't understand why the "rx.ino" needs to be re coded to work with an Arduino uno...

The one file i think i would need to re code is the "config.h" because i do not have any pins higher than 13 (for the last part of the code, rx defining)

Or at least that's the way i see it. Please help! :disappointed_relieved:

Hi Basel. It’s me again. I would like to ask a question about pinChangeInt. I upload two code below. In the first one I used attrachInterrupt to get signals from receiver. In the second one I used pinchangeInt. Two code are almost identical except the interrupt functions.

These two codes get different values from the receiver. I couldn’t understand where the problem is. Could you help me to solve this problem?

I got the attachInterrupt code from the previous posts in this topic.

attachInterrupt_exp.ino (615 Bytes)

pinchangeinterrupt_exp.ino (828 Bytes)

Basel!!!!!, Help-us!!!!!!!

Basel,
bad friend, is on vacation? sorry but could help us a bit? look, I'm having difficulty in PID tuning, got the best value of Ku 0.35 it my Kp is 0.315, the best way to adjust the PID is in hand or even as also I am doing the right! Only one axis as I told you before? looks you could pass me the settings? kind since the direction of movement of the propellers until the mode is "+" or "x" ...

Basel, their engines m0, m1, m2 and m3 are setup "+" in the figure and are as on the left side with m0 = m1, m3 m1 = m2 = m4, m3 = m2? and as to the senses? m0 and m3 are normal and m1 and m2 are reversed?

basel i neeeddd ur immediate help.....i bought a leonardo now.....but blue copter's code is not running on ittttt :(((((

will somebody tell me...????????????????????
why its not running...?????
no error in burning, no error in pinouts..like Vin, gnd, SCL, SDA......plzzzzzz help me...its my Final year project, ive to present on wednesdayyy...plzzzzzzzz sombody help meeeee

Muhammad, tell what your problems! Look, I know well the program of Basel and think I can help you! until he can respond again! Look, I've even changed the code to run on atmega 328 ... the only place that you must change the programming is RX.ino because of the interruptions that are different for each type of Arduino! the other must be mega PCINT's just change there ... gives a look at the previous posts and see the code that I put ... the basel explained very well! Look, his model is a quad-X ... you also have to be careful with orientation board sensors... not to read axes reversed!

satiro:
Muhammad, tell what your problems! Look, I know well the program of Basel and think I can help you!

buudy at first i was trying basel's code on mega2560. its working, except the RX.ino
as it is my final year project and i have to present it on wednesday, im running out of time. for that reason i bought leonardo now. but this code is not running :cry:
all other simple programs are running....but why it is not..?????
plzzzz help out meee

But what is happening! if you up-load of other program works exeto the Basel! is it? you did the assembly exactly as in the previous posts? are correct in their conxões GY-80 sensor? in config.h basel to view the data you have going on "macro DEBUG" and enable the data you want to see! and connect the receiver! the receiver for safety is the one who releases the visualization of data, but has other "macro at the beginning of the code in config.h that if you do not need to disable the radio receiver!'s it!'s early in config.h not only remember the name now!

Wow, a lot of messages.. No, I'm not on vacation, it's just I usually visit this site when I get a notification email that says that I've got a new Post on the forum.. This didn't happen...

Anyhow to the problems:

@Satiro: I'm having a hard time knowing what you're after.. Do you want to fly it in + mode? In that case you'll have to modify the output of the PIDs to the motors.. You can find these in the following variables: in FlightCtrl.ino

  int m0_val=throttle+PIDroll_val+PIDpitch_val+PIDyaw_val;
  int m1_val=throttle-PIDroll_val+PIDpitch_val-PIDyaw_val;
  int m2_val=throttle+PIDroll_val-PIDpitch_val-PIDyaw_val;
  int m3_val=throttle-PIDroll_val-PIDpitch_val+PIDyaw_val;

You have to rearrange PIDroll, PIDpitch, PIDyaw accordinaly.. But I don't recommend you to do anything like that until you get your quadcopter working with my setup.. Because if you venture into something like that I can't be 100% sure each time I answer your questions..

What settings do you want me to pass you? Can you try out something for me? Try the following values and report back:

#define ROLL_PID_KP  0.200
#define ROLL_PID_KI  0.800
#define ROLL_PID_KD  0.00
#define ROLL_PID_MIN  -50.0
#define ROLL_PID_MAX  50.0

#define PITCH_PID_KP  0.200
#define PITCH_PID_KI  0.800
#define PITCH_PID_KD  0.00
#define PITCH_PID_MIN  -50.0
#define PITCH_PID_MAX  50.0

#define YAW_PID_KP  0.500
#define YAW_PID_KI  0.300
#define YAW_PID_KD  0.00
#define YAW_PID_MIN  -50.0
#define YAW_PID_MAX  50.0

#define ANGLEX_KP 3.0
#define ANGLEX_KI 0.02
#define ANGLEX_KD -0.015
#define ANGLEX_MIN -100.0
#define ANGLEX_MAX 100.0

#define ANGLEY_KP 3.0
#define ANGLEY_KI 0.02
#define ANGLEY_KD -0.015
#define ANGLEY_MIN -100.0
#define ANGLEY_MAX 100.0

If these settings don't work at all, then you maybe you have your IMU set in the wrong direction on the quadcopter.. Anyhow, try these settings and report back..

@MuhammadArslanKh: What's not working when you upload/run the code on the leonardo..? If you've connected everything right then it should run right out of the box.. Check your connections again and report back..

//Basel