Quadcopter from scratch · Part 1

Why I'm building a drone from scratch in embedded C

I got really into drones recently. Flying them is fun but what I actually wanted to know was how they work. Like how does a little board with four motors just sit in the air and not fall over?

Most drones run open source flight controller code like Betaflight so I figured I'd go read that.

I got lost pretty fast. It's good code, but it runs on hundreds of different boards and sensors and has years of features piled on top. I could find the files. I just couldn't find the part that actually keeps the thing flying.

I learn better by building stuff anyway. So I'm building a quadcopter and writing the flight controller myself in embedded C, from nothing, and keeping it small enough that you can actually read all of it.

What's coming

The IMU first. That's the sensor that tells the drone how it's tilted. After that PID control, which is how "I'm tilted left" turns into "spin this motor faster." Then getting the motors to respond fast enough that any of it works.

I'm pretty new to all of this too, so I'm writing these for people starting from zero. I'll post the code and the parts, and I'll post the stuff that breaks, which I'm guessing will be a lot.

Follow along

I post updates on X, or there's an RSS feed.

Updates

Email updates are coming. Until then, follow along on X or RSS.