Two Rotor Balancing

Hi

I am computer engineering student and currently working on my quadcopter for my thesis and I am stuck with the part of balancing two rotors for stabilization hovering. I don’t have problem reading the values of accelerometer and gyroscope. The problem so far is that I don’t know if the used PID controller code was correct as well as the formula. Has anyone done already the same project as mine? Just balancing two rotors? I’m almost ran out of time in doing the testing then uploading and testing again and so on and so forth. Please help me.:frowning: I just only need to balance two rotors so that I can hover my quadcopter. I use ESC 30 amps to control brushless dc motor. Attach is the code that I am using. and my controller was arduino atmega 328. Please help me.:frowning:
thank you.

, Luigi Moran

quadcopter_PID4.ino (13.6 KB)

A quadcopter with 2 rotors? That isn't a quadcopter, then.

The problem so far is that I don't know if the used PID controller code was correct as well as the formula.

Why don't you? You are supposed to experiment.

Has anyone done already the same project as mine?

If they had, it wouldn't help you develop your thesis.

I am visualising this as a system with a single degree of freedom i.e. you are using the two rotors to control the attitude of a vehicle about one axis. If you have any sense, the vehicle will be supported so that the only way it can move will be about that axis.

Before you can make any progress at all in controlling the attitude, you need to know what the attitude actually is. Are you able to read the current position, speed and acceleration with respect to the axis of movement as the vehicle is moved about the axis? Until you achieve that, everything else is a waste of time.

PaulS:
A quadcopter with 2 rotors? That isn't a quadcopter, then.

The problem so far is that I don't know if the used PID controller code was correct as well as the formula.

Why don't you? You are supposed to experiment.

Has anyone done already the same project as mine?

If they had, it wouldn't help you develop your thesis.

It is quadcopter but I am only using first the 2 rotors (x-axis) so that I can manage easily.

I already experimented it but I don't know what to adjust to. I adjusted P gain but the effect was too much rotation. I don't know also if I should adjust the thrust of both motors so that it is balanced. My professor said to me that in order to balance a two rotor a quadcopter in one axis is that I should adjust the P and I gains and D gain to be later. Was this true? I'm sorry if I had a bad english..that was weakness. hope you understand what I am saying. thanks.

The PID library comes with a decent tutorial about tuning it, and the PID algorithm is also widely known outside of Arduino and there are many tutorials on the internet explaining how to tune it. Please don't expect us to write personal tutorials just for you. If you have grasped the basic concepts behind PID (what the P, I and D feedback elements represent) then you should be able to follow the guidelines to tune it. If you haven't, then that should be your first step.