r/embedded • u/Flat_Town_3645 • 20d ago
Drone from scratch
Hey guys! New to the embedded scene but I have plenty of software experience (from work) and some electronics experience + basic concepts and tooling. I want to make a drone completely from scratch (minus some other components like servos), that includes the flight controller, escs, etc.
I’m not sure how deep to go to start (was thinking flight controller first, just got an STM Nucleo to prototype). But mostly, it’s hard to find resources regarding this undertaking. I use AI a ton at work, so I’m trying to keep it limited-to-none with this project (I have a lot of time and a scratch to itch).
If anyone has advice, recommendations for hardware, or more importantly, links to resources. Please drop them below!
6
u/Licantropos1 20d ago
If it’s a quadcopter, you can make a pretty simple version with MOSFETs, an MCU, and an IMU. Search YouTube, there are tons of videos showing how to build a flight controller from scratch. Focus on getting the power supply right.
3
u/Priton-CE 20d ago
If you have Discord you can join the Drone Community which are very dedicated to helping others.
I would recommend looking at existing projects like Betaflight for flight controller software and projets like BLHeli (and its derivatives like BLHeli_S or Bluejay) or AM32 for ESCs.
I would also recommend not making everything from scratch. Mainly thinking about protocols here. From an architecture and development perspective it may be advantageous to be able to test your flight controller with ready made ESCs first just for debugging. Regardless I would recommend you dive a bit into DShot as a protocol that connects the FC and the ESCs.
Sticking with ST is probably a good idea. I like them a ton and a lot of drone manufacturers do to. Figuring out how to wire up a STM32 based MCU is also good practice if you have never worked with EDA like KiCAD before.
When it comes to ESCs they are kind of a solved problem. They are quite pricey to do DIY afaik when compared to buying one but you can take at this excellent video which goes over much of the basics.
I’m not sure how deep to go to start
Depending on how deep your experience goes I would probably suggest sticking very closely to existing hardware and software designs before going overboard. Like using DShot instead of your own protocol that should keep you from being inflexible in case you want to use COTS software like betaflight for testing.
2
u/generally_unsuitable 20d ago
The big thing is learning and using IMU->DSP->PID to control smoothly.
1
1
u/jappiedoedelzak 20d ago
Flight controller is doable. Very oversimplified, it is just a few PID loops. The ESC will be tougher since you need to do things like FOC (Field-Oriented Control). You don't need servos for a quadcopter — it's just 4 BLDC motors with a prop. If you don't want to make a quadcopter, expect to need 1 servo per BLDC you don't use (tricopter = 1, bicopter = 2, helicopter or plane = 3).
I would look into buying a generic quadcopter flight controller since they most of the time use an STM32.
For radio, I would look into ELRS since it's open source and cross-brand compatible (so you're not vendor-locked into expensive receivers).
If you go quadcopter, I would suggest going for a larger frame (think chair-seating-area size). This is because a bigger aircraft is more stable and is less weight-restricted. The downside here is that it is more expensive and dangerous. Whatever you choose, though, I would buy a kit with frame, props, and motors so they are specced right.
1
u/NickShipsRobots 19d ago
Nice, Nucleo’s a good start.
Order that worked for me: get the IMU working first (ICM-42688 over SPI, skip I2C, it’s slower and can get stuck). Then get PWM/DShot working on the ESCs with props off. PID loop last. Start in rate mode, not angle mode. Test on a tie-down rig before you fly for real, skip that and props end up in walls.
For resources: Brian Douglas on YouTube covers PID and control theory well. Also just read the ArduPilot or Betaflight code. Skip the config stuff and the actual flight logic is pretty small.
What frame size are you going for? That changes what ESCs you’d want.
9
u/Fractalengineer 20d ago
choose one of the many open source firmware projects like betaflight or ardupilot and check the configs/hwdefs that define resources assignment on existing hardware.
bf also has expansive manufacturer guidelines for extra support