Table of Contents
So many flight controller already out there, why making a new one ?
In top of the fact that I just wanted to make a flight controller, I needed one with very specific features for the next iteration of my TPU stack.
- STM32 F7 MCU. It’s becoming the norm now, and it make inverted protocol like SBUS a no-brainer.
- USB-C connector. More durable than micro B.
- JST connector for I/O. Cleaner and more reliable than solder pad in my opinion
- Integrated high end Vtx.
- Room for direct soldering a R-XSR or a Crossfire Nano receiver
- Ruggedized design & ESD protection for a highly reliable board.
- Full sensor support : IMU, barometer, GPS/compass, and large BlackBox storage.
My flight controller will run Betaflight, so components choice is narrowed to those supported by the software, simplifying the overall conception. The huge number of Betaflight based FC these days gave me a lot of material for retro-enginnering, which allowed me to spot the most common components used and to drawn a global architecture.
The Betaflight source code and it’s documentation also helped me figuring out the pinout requirement for each on-board IC. I decided to not re-use an existing target pinout, as the unified target system allow anyone to create a target quite easely without compiling a specific binary file. This choice allowed me to optimize the components layout and to get a clean routing. I describe in an other post how to create a custom target, from the STM32 pinout to the Betaflight configuration file generation.
A fried MCU is a quite common failure on a flight controller, often caused by a voltage spike that reached one of the MCU I/O pins. Board damaged this way will have the MCU getting hot quickly, and are of course totally out of service.
STM32 device already have protection diodes built-in on most I/O. These diodes protect the pin from short overvoltage by clamping the voltage to VCC+4V, ie 7.3V.
However, if the overvoltage condition persist too long and/or is too high, the current flowing throught the diode will exceed it’s maximum rating and will destroy it. That’s why a MCU with that defect is overheating: some diode are damaged, creating a short circuit. A easy way to prevent this is to add a serie resistor on each pin. The resistor will induce a voltage drop as the current increase, protecting the MCU pin from the voltage spike.
For even more protection, external ESD diodes can be used. Those diode are designed to absord the fastest and highest transient.
On this flight controller, I’ve separated all interfaces in two categories:
- Interface that can power the board : ESC connector and USB. Those interface will have an external ESD protection diode
- Interface powered by the board. Rx, camera, GPS, etc. Only serie resistor will be used here.
ADC pin are more challenging to protect because external diode leakage current will disturb the measurement. But those pins represent a real danger for the MCU, especially the VBATT. This pin, through a voltage divider, is connected to the battery ! I decided to not add any external diode on the ADC pin, just the possibility to disable and isolate those input from the MCU, and to rely on the ESC telemetry to get battery and current reading.
Lastly, I implemented a reverse voltage and overvoltage protection on the battery input to protect the 5V DC/DC, so an inverted battery connector won’t damage the flight controller.
I looked for a good Vtx in a small solderable module, and the TBS Race 2 imposed itself:
- One of the best Vtx manufacturer
- Solderable on PCB: flat bottom, edge solder pad
- MMCX connector
- Top heatsink
Only drawback is the 400mW output power, which is a bit low by today standard. Although this Vtx has a built-in PIT mode, I implemented a “true” PIT mode on the board anyway, as the TBS PIT-mode can only be used at power-up.
Several IMU had been tested over the years on Betaflight board, but the MPU-6000 is probably the most proven and used gyroscope for FPV quad. Given the importance of this sensor for performance and reliability of a drone, I went for a safe and conservative choice, even if this component is not recommended for new design.
On the contrary, I chose for the barometer the lastest chip available, the BMP388. It has a better accuracy than it’s predecessor (BMP280), allowing an altitude resolution of 1m.
Even if this sensor is not on the PCB, I developped his interface based on the Matek M8Q-5883, a full-featured module with GPS, compass and RTC battery.
The power architecture set in place is quite common:
- 5V rail generated from Vbatt by a DC/DC. I used the MP9943, a 3A regulator used on a lot of board these days
- A dedicated 3V3 LDO for the MCU
- A dedicated 3V3 LDO for the sensors
To get the most noise-free video, I decided to power the whole video circuit (i.e camera and OSD chip) from the same source. This one is selectionnable between the one-board 5V regulator and the 5V generated by the Vtx. The goal here is to use the less noisy power supply. Indeed, after some measurement on differend boards, I find out that the TBS Race 2 has a cleaner 5V output than most of the FC I’ve tested.
Board form factor
As this flight controller is meant to be integrated on the TPU stack, I’ve worked on the v2 design and on the board shape simultaneously to take into account integration, usability and layout constraints. The result is a board using the standard 30.5×30.5mm mounting pattern, but with several tabs to accomodate some special features:
- A back tab to bring the Vtx MMCX connector at the edge of the TPU enclosure
- Two sides tabs with exposed copper. This is an attempt to add some thermal dissipation on the side of the enclosure.
PCB stack up and layout
The PCB is 1mm thick (standard 1.6mm didn’t fit inside the TPU stack..) with the following stack-up:
- Top layer : Mostly analog and sensible signals
- L2: Solid ground plane
- L3: Power supply
- Bottom layer: Signals
Video and sensor are gathered on the left side of the board. The most sensitive signal (video, audio) are entirely routed on the top layer, ensuring a good return path and shielding by the solid ground plane below.
Free space left on the board was used to place a bunch of 1206 decoupling capacitor on Vbatt. In total, there is 15 capacitors, providing a total capacitance of 150µF. Having the capacitors on the board itself allow a better filtering of the battery noise, as the capacitors are as close as possible to the device to protect. In conjonction with the external electrolytic capacitor, this setup should provide a very clean power supply to the system.
Thanks to the hardware standardization brought by Betaflight, making a flight controller is quite accessible to anyone with some electonics knowledge, time and motivation. But there is still a bunch of design choice to address in order to get a reliable, good performance and user friendly board, and I hope this design will live to my expectation.
Prototype assembly and testing will be covered in an other post !
6 thoughts on “Designing my own Flight Controller”
Can you share the pcb file?
I published the source file of the project on Altium365:
Hello, thank your for sharing with us your project. Unless I am mistaken, I cannot find the CPL file, could you share it with us ? And could you share the whole project for improvement ? Thanks.
Hi, no problem. You can already open and clone the whole project : Once connected on Altium365, click on “Open with CircuitMaker” on the bottom-left. It will open CircuitMaker with the source files of the project.
More details here : https://www.altium.com/documentation/altium-circuitmaker/quickstart-design-projects
Huge props publishing this guide for free! This is awesome work. I don’t really know much about designing PCBs yet (I’m only in my first year of electronics eng), so I have to ask… is this PCB at the stage of simply uploading the files to a printing company and ordering the Board? I’d love to give it a try. Thanks!
Thanks for the feedback ! The state of the project as I published it fix all the issues I’ve identified on the first prototype. So yeah, it’s pretty safe to send the gerber directly to a PCB manufacturer. Keep in mind however that I haven’t ordered and tested this version myself so far.