This is by no means a simple project.

I wrote one with a friend last year, as a university project, and it took us almost two months to get everything right.

The implementation and actually writing the code for the microcontroller are the least of your worries. You first have to come up with a mathematical model of the dynamics of the quadcopter, then write a simulator for that model (we used Dormand-Prince), linearize it, discretize it, design a discrete-time controller and state observer (using LQR+LQE), tune the controller and observer in simulation, then actually try to fly it, find out that the simulation doesn't really match up with reality, do some more tuning, etc.

Of course, there are some papers and other resources that propose controllers and observers, or even provide code, but understanding them takes some time as well. You could of course blindly copy their code and try to tune it without understanding what it's doing under the hood, but you're going to have a hard time doing so if you don't have a clue what each tuning parameter does.

We spent a good amount of time on understanding the underlying mathematics of optimal control theory, and wrapping our head around quaternions.

Steve Brunton's Control Bootcamp was really helpful:

https://www.youtube.com/watch?v=Pi7l8mMjYVE&list=PLMrJAkhIeNNR20Mz-VpzgfQs5zrYi085mYou'll also need a good sensor fusion algorithm for your IMU (accelerometer+gyroscope), we used an improved version of Sebastian Madgwick's algorithm. It combines the angular velocity and the acceleration vectors, numerically integrates the angular velocity to get the absolute position, and uses the direction of gravity to eliminate integration drift.

A note on safety as well: Drones kill people. I've heard horror stories of people losing fingers, eyes, and even one guy who was flying alone in a field somewhere: one of the propellers hit his neck, cut open his artery, and he bled to death.

At our university, we had a drone room with a heavy net around the flying zone, and strict rules: never fly alone, always wear safety goggles (propellers can and do shatter), no drones with battery connected and propellers outside of the drone cage.

I think this is a great project to learn about control theory and programming, just be careful, and don't expect to get a perfectly stable drone in a week.

Pieter