Hello all,
I have designed an arudino quadcopter from scratch ..I used an AtMega328p with Arduino bootloader as you can see in the attached picture , a serial Bluettoth module (the blue thing from top-left corner) and a PolouluMinIMU-9.
I used the frame of a RC quad Beetle v929 ..removed it's control board and added mine.Only kept proppelers ,frame,motors from that so they are certainly in the right position .
I have added in the picture the rotation of the motors and the Arduino pins on which every motor is connected to.
The whole thing is powerd by a 3.7V 1400mAh LIPO.
MOTORS are driven by MOSFETS integrate on my PCB they spin really fast are ok..
==========================================================
I am using an "X" configuration for the quad .. and using AHRS library for PolouluMin9 :
Then I get from the library the Euler angles: like pitch,roll,yaw and use the 3 angles in this equations(the equations are in the attached picture also right side ) for stabilizing the quad :
int user_pwm=255;//here I am setting the user pwm which will come from Bluetooth but this is for test
setup(){ //here I am initializing serial ,setting pin directions etc
----blabla
}
loop() //here is the library that calculates euler angles etc in a loop at 50 hz
{
getEuler();
// from here begins my code
analogWrite(6, user_pwm + toDeg(pitch) - toDeg(yaw) ) //front motor I am considering M1 because X axis of IMU is on its side
analogWrite(9, user_pwm - toDeg(pitch) - toDeg(yaw) ) //backmotor I am considering M3 because it is opposide to M1
analogWrite(10, user_pwm + toDeg(roll) + toDeg(yaw) ) //left motor I am considering M2 because Y axis of IMU is on its side
analogWrite(5, user_pwm - toDeg(roll) + toDeg(yaw) ) //right motor I am considering M4 because it is opposide to M2
}
*THIS are the equations I found from internet to stabilize quad but it does not specifies if it s for "+" or "X" quad configuration
front motor PWM = user_thrust + PIDpitch - PIDyaw
back motor PWM = user_thrust -PIDpitch - PIDyaw
left motor PWM = user+thrust+PIDroll+PIDyaw
right motor PWM = user thrust -PIDroll + PIDyaw
My questions are for you guys who made other quadcopters :
1)Are there any OTHER equations specifically for X- configurated quads or this equation for stabilization are ok working for both "X" and "+" configs ? I ask this because I can t tell which should be front motor M1 or M4 and what other forumas shoul I use if they are both considerd (M1+M4)/2?
Currently I am considering front of the quad function of gyrop position which is drawn by me on the picture X,Y axes.
2)Is it ok my gyro position according to axis for a X config ?
3)any reccomandations ?
- currently it does not lift off , it lifted once but rotated and durnet backwards
- does someone has something similar or a piece of code for me something better ..I just want to lift off and stabilize it ...
Nobody explains on the net how can Euler angles be proper converted in PWM nor if it depends of X config and + config .,or how important is the position of the gyro ,IMU ?
Thank you in advance and hope to see a reply from you soon ,
Catalin