Flight Controller PCB Design: From Zero to Fabricated Board
Contents
- What a PCB actually is
- The electronics you cannot skip
- Anatomy of a flight controller
- Choosing components and reading datasheets
- Tools, software and the design pipeline
- The schematic, step by step
- PCB layout
- Fabrication
- Assembly and soldering
- Bring-up, testing and firmware
- Designing so one board serves many projects
- Appendices: glossary, reference values, checklists
Introduction
By the end of this guide you will be able to design a working flight controller PCB from a blank schematic, order it from a factory, solder it, flash firmware onto it and fly it. No prior electronics or PCB knowledge is assumed. Every term is defined the first time it appears.
What a flight controller is. A flight controller (FC) is the small circuit board at the centre of a drone. It reads motion sensors (a gyroscope and accelerometer) hundreds or thousands of times per second, listens to the pilot's radio receiver, runs a control loop and tells each motor's speed controller how fast to spin. Commercially these boards are 30 × 30 mm or 20 × 20 mm, run firmware such as Betaflight, INAV or ArduPilot, and cost $25–$80. Everything on them is something you can design yourself.
Why design your own. A custom board lets you choose exactly which sensors, ports and connectors you need, lay them out for your airframe, add features commercial boards lack (extra motor outputs, custom power stages, logging, research sensors) and understand every failure when one happens. It is also the fastest way to learn real electronics: the FC is small enough to finish, but touches power regulation, high-speed digital buses, USB, sensors and firmware all at once.
How this guide is organised. It follows the order in which you actually do the work:
- Parts 1–2 give the physical and electrical foundations: what a PCB is made of and the handful of electronics concepts you cannot skip.
- Parts 3–4 explain what is inside a flight controller and how to pick each part from a datasheet.
- Parts 5–7 are the design itself: tools, the schematic, then the board layout.
- Parts 8–9 take the design to a factory and onto your bench: fabrication, ordering, soldering.
- Parts 10–11 cover bring-up, testing, firmware and how to design so that one board serves many projects.
- The appendices hold a glossary, checklists and reference numbers to return to.
What you need. A computer running KiCad (free, Windows/macOS/Linux), roughly $40–$80 for a first batch of boards and parts, a soldering iron with a fine tip, a multimeter, tweezers and a magnifier. A makerspace with a hot plate or reflow oven and a microscope makes assembly much easier but is not required.
How to read it. Read Parts 1–3 straight through. From Part 4 onwards, keep KiCad open and build the example board as you go; the example is a 30.5 × 30.5 mm STM32-based controller with a SPI gyroscope, a barometer, six UARTs, eight motor outputs, USB and an SD-card blackbox, the same architecture as most commercial boards. Numbers given for voltages, capacitor values and trace widths are typical starting values; the datasheet of the exact part you choose always wins.
Part 1 — What a PCB actually is
A printed circuit board is a rigid sheet of insulating material with thin sheets of copper bonded to it; the copper is chemically etched away everywhere except where you want wires. Components are soldered onto exposed copper pads, and the remaining copper strips (traces) connect them. That is the whole idea; everything else is detail.
The layers, from the top down
| Layer | Material | What it does | Typical thickness |
|---|---|---|---|
| Silkscreen | White epoxy ink | Printed text and outlines: part names (R1, C4), polarity marks, pin 1 dots, your logo | ~0.01 mm |
| Solder mask | Green/black/blue polymer | Covers all copper except pads so solder only sticks where it should and traces do not short | 0.02–0.03 mm |
| Top copper | Copper foil | Pads and traces for components on the top side | 35 µm ("1 oz") |
| Core / prepreg | FR-4 (woven glass fibre in epoxy) | Insulates and holds everything rigid | Whole board 1.6 mm, or 1.0 mm for light FCs |
| Inner copper layers | Copper foil | On 4-layer boards: usually one solid ground plane and one power plane | 35 µm |
| Bottom copper | Copper foil | Pads and traces on the underside | 35 µm |
| Bottom mask + silk | as above | as above |
The features you draw
- Trace. A copper strip carrying a signal or power. Width is chosen by current (a 0.2 mm trace on 1 oz copper carries about 0.5 A comfortably; 1 mm carries about 2.5 A). Signal traces on a flight controller are 0.15–0.25 mm; battery-input and motor-power traces are wide copper pours.
- Pad. Exposed copper a component lead is soldered to. Surface-mount (SMD) pads sit on one layer; through-hole (THT) pads are plated holes going through the board.
- Via. A small plated hole (typically 0.3 mm drill, 0.6 mm pad) that joins a trace on one layer to another layer. Vias let a signal cross under another trace and tie ground pours together.
- Copper pour / plane. A large filled copper region, almost always ground. On a 4-layer board the entire inner layer 2 is one unbroken ground plane; this is the single most important feature for a clean, low-noise flight controller.
- Footprint. The pattern of pads for one component, matching the part's package (e.g. 0402 resistor, LQFP-48 chip, 14-pin LGA gyroscope). Footprints come from libraries; you rarely draw them.
- Board outline / edge cuts. The shape of the board, including the four mounting holes.
- Keep-out. A region where copper or parts are forbidden, e.g. around mounting holes so the screw head cannot short anything.
Two layers or four?
A 2-layer board has copper on top and bottom only. It is cheaper (about $2–$5 for five boards) and fine for simple projects, but a flight controller has an MCU running at 100–500 MHz, a sensitive gyroscope and noisy motor power all within 30 mm of each other. A 4-layer board (about $7–$15 for five) gives you a solid ground plane directly under every signal, which makes routing far easier and the gyro data cleaner. Design the flight controller on 4 layers from the start: top signals, ground, power/3.3 V, bottom signals.
How a factory makes it
- Copper-clad FR-4 cores are coated with light-sensitive film; your copper pattern is exposed onto it and the unwanted copper is etched away.
- Inner-layer cores are laminated together with prepreg under heat and pressure.
- Holes are drilled by CNC, then electroplated with copper so they conduct between layers (plated through-holes and vias).
- Solder mask is applied and cured, leaving pads open.
- Pads get a surface finish: HASL (cheap, tin-lead or lead-free) or ENIG (gold over nickel, flat and better for small parts; choose ENIG for a flight controller).
- Silkscreen is printed, the boards are routed out of the panel, electrically tested and shipped.
You never do any of this yourself. Your job ends at a set of files (Gerbers, Part 8) that describe each layer; the factory does the rest in 3–7 days.
Part 2 — The electronics you cannot skip
You need about a dozen concepts to design a flight controller; everything else can be looked up as you go. Read this part once now and come back to it when a later part uses one of these words.
Voltage, current, resistance, power
- Voltage (V) is electrical pressure between two points; it is always measured relative to something, and on your board that something is ground (GND, 0 V).
- Current (A) is the flow of charge through a wire. A 4-in-1 ESC can draw 100 A from the battery; your MCU draws 0.1 A.
- Resistance (Ω) opposes current. Ohm's law ties the three together: V = I × R. A 10 kΩ resistor with 3.3 V across it passes 0.33 mA.
- Power (W) = V × I, and it becomes heat. A regulator dropping 16.8 V to 5 V at 1 A wastes 11.8 W if it is linear; that is why FCs use switching regulators (below).
Ground
Ground is the reference every voltage is measured against and the return path for every current. On a flight controller there is one ground, and it is a solid copper plane. Every current that leaves the battery must come back along this plane; a plane cut by a slot forces that return current to detour, which creates noise that the gyroscope will see as fake rotation. Rule: never split or slot the ground plane, and give every component a via to it within a millimetre or two.
Passive components
| Part | Symbol | What it does on an FC | Typical values |
|---|---|---|---|
| Resistor | R | Limits LED current, pulls a pin to a known level (pull-up/pull-down), divides a voltage so the MCU can measure the battery | 10 kΩ pull-ups; 1 kΩ for LEDs; 10 kΩ : 1 kΩ battery divider |
| Capacitor | C | Stores charge locally so a chip's sudden demands are met without the supply sagging (decoupling); filters noise; sets timing | 100 nF decoupling; 4.7–22 µF bulk; 20 pF crystal load |
| Inductor | L | Opposes changes in current; energy-storage element in switching regulators; with a capacitor forms an LC low-pass filter for the gyro supply | 2.2–10 µH for regulators; 1–10 µH ferrite bead for filtering |
| Diode | D | Lets current flow one way; protects against reversed battery; drops ~0.3–0.7 V | Schottky, 1–3 A |
| Crystal | Y | Precise 8 or 16 MHz oscillation for the MCU clock (USB needs ±500 ppm accuracy) | 8 MHz, 10–20 pF load |
| LED | D | Status indication | 1–2 mA through a 1 kΩ resistor |
Decoupling: the rule you will apply thirty times
Every power pin on every chip gets a 100 nF ceramic capacitor placed as close to the pin as physically possible, with the shortest path to ground. When a chip switches, it demands a burst of current in nanoseconds; the capacitor supplies it locally so the supply voltage does not dip and the ground does not bounce. Add one larger capacitor (4.7–10 µF) per supply rail per chip. The datasheet for each part tells you exactly how many and which values.
Power rails and regulators
A flight controller runs from a battery of 2–6 lithium cells (7.4–25.2 V, abbreviated 2S–6S) but its chips need 5 V and 3.3 V. Converting is the regulator's job:
- Linear regulator (LDO). Simple, quiet, tiny; burns the excess voltage as heat. Use only for the last step, e.g. 5 V → 3.3 V at a few hundred milliamps, and a separate one for the gyroscope so it sees a clean supply.
- Buck (switching) regulator. Chops the input at hundreds of kHz through an inductor; 85–95 % efficient; needs an inductor, input and output capacitors and a careful layout. Use for battery → 5 V (and often → 9 V for a video transmitter).
The standard FC power tree is: battery → buck → 5 V → LDO → 3.3 V (MCU) and a second LDO → 3.3 V gyro-only. Part 6 draws this out.
Digital signals and buses
A digital pin is either low (0 V) or high (3.3 V). Chips talk to each other over buses:
| Bus | Wires | Speed | Used on an FC for |
|---|---|---|---|
| SPI | 4: clock, MOSI, MISO, chip-select per device | Up to tens of MHz | Gyroscope/accelerometer (must be SPI, not I2C, for 8 kHz sampling), SD card, OSD chip, flash |
| I2C | 2: SCL, SDA, shared, with 4.7 kΩ pull-ups | 100–400 kHz | Barometer, magnetometer, external sensors |
| UART | 2: TX, RX, one pair per device | 9.6 kbit/s–several Mbit/s | Receiver (CRSF/ELRS), GPS, telemetry, VTX control, ESC telemetry |
| USB | 2 data lines + 5 V + GND, 90 Ω differential pair | 12 Mbit/s (Full Speed) | Configurator, firmware flashing |
| PWM / DShot | 1 wire per motor | 150–1200 kbit/s digital pulses | Motor commands to ESCs |
| SWD | 2: SWDIO, SWCLK (+ reset) | — | Debugging and recovery flashing |
Noise, and why the gyro cares
The gyroscope measures angular rate at micro-degree-per-second resolution. Any electrical noise on its supply or ground, and any mechanical vibration reaching it, looks like rotation and ends up in the motors as twitching. Three defences recur through this guide: a clean dedicated 3.3 V for the gyro, a continuous ground plane, and placing the gyro at the board centre away from the switching regulator and the motor-signal traces.
Reading a schematic
A schematic is a drawing of what connects to what, with no regard to physical position. Each component has a reference (R1, C3, U2), a value, and pins; lines are nets (electrical connections). Power symbols (+3V3, +5V, GND) connect all identically named points without drawing wires. A net label (e.g. GYRO_CS) does the same for signals. The layout (Part 7) is where position matters; the schematic is where correctness matters.
Part 3 — Anatomy of a flight controller
Every flight controller is the same seven blocks arranged around one microcontroller. Learn the blocks and any commercial board's schematic becomes readable.
1. Microcontroller (MCU)
The brain. It runs the firmware: reads the gyro at up to 8 kHz, runs the PID control loops, decodes the receiver, drives the motors, talks to the configurator over USB and logs to the blackbox. Nearly all modern FC firmware targets ST Microelectronics' STM32 family: the F405 (168 MHz, the long-standing standard), the F722 (216 MHz) and the H743 (480 MHz, the current high end). Part 4 compares them. The MCU needs: a 3.3 V supply, a crystal, a reset circuit, a BOOT0 pin for recovery, a debug header and decoupling on every VDD pin.
2. Inertial measurement unit (IMU)
A single chip containing a 3-axis gyroscope and 3-axis accelerometer. The gyro is the sensor that actually keeps the drone level and responsive; the accelerometer gives a gravity reference for self-levelling modes. It talks to the MCU over SPI at 10–20 MHz and raises an interrupt line when a new sample is ready. Common parts: TDK ICM-42688-P (current favourite), ICM-20689, Bosch BMI270, Invensense MPU-6000 (legacy). Its placement, supply and mounting matter more than any other part on the board.
3. Barometer (and optional magnetometer)
A pressure sensor gives altitude to roughly ±10 cm for altitude hold and for INAV/ArduPilot navigation. Talks over I2C or SPI; BMP280, BMP388, DPS310 and SPL06 are common. It must sit away from airflow, so it is often placed under a bit of foam. A magnetometer (compass, e.g. QMC5883L or IST8310) is optional and usually left off the FC because motor current fields corrupt it; it lives on the GPS module instead.
4. Power regulation
Takes battery voltage (2S–6S, up to about 26 V) and produces 5 V (for the receiver, GPS, LEDs, camera and the FC's own 3.3 V) and 3.3 V (MCU, sensors). Includes a battery voltage divider and often a current-sense input so the firmware can display and log battery state. Many FCs also provide a 9 V or 10 V rail for the video transmitter. A separate filtered 3.3 V for the gyro is standard practice.
5. Motor outputs
Four to eight MCU timer pins carry DShot (digital) or PWM signals to the electronic speed controllers (ESCs). On a 30.5 mm stack the FC connects to a separate 4-in-1 ESC board through an 8-pin cable carrying battery voltage sense, current sense, ground, and the four motor signals; the ESC board handles the high current. On an all-in-one (AIO) board the ESC MOSFETs are on the same PCB, which is a harder design and not the first project.
6. Communication ports
- UARTs (serial ports): typically six. One for the radio receiver (CRSF/ELRS at 420 kbit/s), one for GPS, one for the VTX control (SmartAudio/Tramp/MSP), one for ESC telemetry, spares for a digital video system or a companion computer.
- USB: a USB-C connector wired to the MCU's native USB peripheral for configuration and flashing; it also powers the board at 5 V so you can configure without a battery.
- I2C: one bus for the barometer, exposed on a pad for external sensors.
- SWD: a three-pad debug header. Essential on a homemade board.
7. Blackbox logging and extras
The firmware records every gyro sample, setpoint and motor output for tuning analysis. Storage is either a SPI flash chip (16–32 MB, simple) or a microSD card slot (unlimited, faster, more layout work). Extras found on commercial boards: an OSD chip (AT7456E) that overlays telemetry on analogue video, an addressable-LED output, a buzzer driver and a camera-control pin. Each is a small, optional sub-circuit you can add later.
How they talk to each other
The MCU is the hub; nothing talks to anything else directly. The gyro and blackbox are on SPI (fast). The barometer is on I2C (slow is fine). Every external device is on its own UART. Motors are on timers. Power flows battery → 5 V → 3.3 V and into every block. Keep this picture in your head throughout the schematic in Part 6: each block becomes one sheet or one region of the drawing.
Physical form
The industry standard is a 36 × 36 mm board with four M3 mounting holes on a 30.5 × 30.5 mm square, stacked on top of a 4-in-1 ESC with the same pattern. Smaller builds use 25.5 × 25.5 mm (M2 holes, 20 × 20 mm pattern) or 16 × 16 mm. Use the 30.5 mm pattern for a first design: there is room for every part, hand soldering is feasible and every ESC fits.
Part 4 — Choosing components and reading datasheets
Choose the MCU first, then the IMU, then everything else around them. Prefer parts that existing open-source flight controllers already use: the firmware supports them, their footprints are in libraries, and their application circuits are proven.
The microcontroller
| MCU | Clock | Flash / RAM | Package | Firmware support | When to choose it |
|---|---|---|---|---|---|
| STM32F405RGT6 | 168 MHz | 1 MB / 192 kB | LQFP-64, 0.5 mm pitch | Betaflight, INAV, ArduPilot: universal | First board. Hand-solderable, cheapest, thousands of reference designs |
| STM32F722RET6 | 216 MHz | 512 kB / 256 kB | LQFP-64 | Betaflight, INAV | Same footprint as F405, faster; flash is tight for INAV |
| STM32H743VIT6 | 480 MHz | 2 MB / 1 MB | LQFP-100, 0.5 mm pitch | Betaflight, INAV, ArduPilot | When you want headroom for many UARTs, SD logging and future features |
| STM32G474 / AT32F435 | 170 / 288 MHz | 512 kB–1 MB | LQFP-48/64 | Betaflight (AT32), limited | Cost-reduced boards; only if you already know the toolchain |
What to read in the MCU datasheet and reference manual:
- Pinout and alternate functions table. Each pin can be a UART, SPI, timer or ADC, but only specific ones. The firmware's target file (Part 10) must match what you wire, so plan the pin assignment on paper first: which pins give you six UARTs, two SPI buses, one I2C, eight timer channels on independent timers (for DShot), two ADC inputs and USB, without conflicts.
- Power scheme. How many VDD pins (F405: five VDD + VDDA + VBAT + VCAP), what capacitors each needs (100 nF each, 4.7 µF bulk, 2.2 µF on each VCAP).
- Clock. External 8 MHz crystal on OSC_IN/OSC_OUT with two load capacitors; 8 MHz is what every firmware target assumes.
- Boot configuration. BOOT0 pulled low through 10 kΩ with a button or pad to pull it high for DFU recovery.
- Absolute maximum ratings. 3.6 V maximum on VDD; some pins are 5 V tolerant (marked FT) and only those may see 5 V signals such as an old PWM receiver.
The IMU
| Part | Interface | Max gyro rate | Package | Notes |
|---|---|---|---|---|
| ICM-42688-P | SPI up to 24 MHz | 32 kHz | 14-pin LGA 2.5 × 3 mm | Current standard in Betaflight; low noise; the one to use |
| BMI270 | SPI 10 MHz | 6.4 kHz | 14-pin LGA 2.5 × 3 mm | Good, widely supported, lower sample rate |
| ICM-20689 / MPU-6000 | SPI | 8 kHz | 24-pin QFN 4 × 4 mm | Older, larger, easier to solder |
Read: supply voltage (1.71–3.6 V, feed it 3.3 V from its own LDO), the recommended decoupling (typically 100 nF + 1–2.2 µF on VDD and VDDIO), the interrupt output pin (INT1 to an MCU EXTI pin), chip-select polarity, and the orientation diagram — the firmware needs to know which way the chip's X axis points relative to the board's arrow.
Regulators
- Buck, battery → 5 V, 1.5–3 A: TPS54302, MP2359, AP63203, or a module. Read: input voltage range (must exceed 26 V for 6S), switching frequency (affects inductor choice), recommended inductor and capacitor values, and the datasheet's layout drawing — copy it exactly.
- LDO, 5 V → 3.3 V: ME6211, AP2112K-3.3, XC6206, or a 500 mA part if you power a GPS from 3.3 V. Read: dropout voltage, output current, required output capacitor (some need ≥1 µF ceramic).
- Gyro LDO: a second small LDO or an LC filter (10 µH ferrite bead + 10 µF) from the main 3.3 V.
Everything else
| Item | Choice | Reason |
|---|---|---|
| Barometer | BMP280 (I2C) or DPS310 | Cheap, supported everywhere |
| Blackbox | W25N01G 128 MB NAND flash or microSD push-push socket | Flash is zero-effort; SD needs a 4-bit SDIO or SPI layout |
| USB connector | USB-C 16-pin, mid-mount or top-mount | Add 5.1 kΩ CC pull-downs to GND so hosts enable 5 V |
| Crystal | 8 MHz, 3.2 × 2.5 mm SMD | Standard target |
| Reset / boot | 10 kΩ pull-up on NRST + 100 nF; 10 kΩ pull-down on BOOT0 with a pad | Recovery |
| Passives | 0402 for signal decoupling, 0603 for bulk, 0805/1206 for power | 0402 is hand-solderable with practice; 0603 if unsure |
| Connectors | 1.0 mm JST-SH for ESC and peripherals, plus solder pads | Matches commercial ESC cables |
| LEDs | Green power, blue status, 0603 | Visible indication |
| Protection | Schottky diode on 5 V from USB so USB and battery can both be present; TVS on battery input | Prevents back-feeding and spikes |
Packages: what you can actually solder
- 0402 / 0603 passives: fine with tweezers and a fine tip; 0603 if your hands are new to this.
- LQFP (leads on four sides, 0.5 mm pitch): drag-solder with flux; the standard way to solder an STM32 by hand.
- LGA / QFN (pads underneath, no leads): cannot be reached with an iron. Requires solder paste, a stencil and a hot plate or hot-air station. The IMU is LGA, so plan on paste and a hot plate from the start — most makerspaces have one.
- BGA: avoid.
Where to get parts
LCSC (pairs with JLCPCB assembly), Mouser and DigiKey carry everything listed. When ordering a board with factory assembly (Part 8), choose parts that are in the assembler's stock; the LCSC part number goes into your schematic as a field so the bill of materials exports correctly.
Building a parts list
Before drawing anything, make a spreadsheet with: reference designator, value, package, manufacturer part number, supplier part number, quantity and unit price. This becomes the bill of materials (BOM). For the example board it runs to about 120 placements of roughly 35 distinct parts, totalling $12–$20 per board in small quantities.
Part 5 — Tools, software and the design pipeline
Use KiCad. It is free, open source, runs on every platform, has a huge built-in library, and is what most open-source flight controllers are designed in, so you can open their files and learn from them. The whole pipeline from idea to factory files runs inside it.
The KiCad applications
| Application | What you do in it |
|---|---|
| Project manager | Creates the project folder; holds the .kicad_pro, .kicad_sch and .kicad_pcb files |
| Schematic Editor (Eeschema) | Place symbols, wire them, label nets, assign footprints, run the Electrical Rules Check (ERC) |
| Symbol Editor | Draw a symbol for a part the library lacks |
| Footprint Editor | Draw the pad pattern for a part the library lacks, from the datasheet's land-pattern drawing |
| PCB Editor (Pcbnew) | Define the outline and stackup, place footprints, route traces, pour ground, run the Design Rules Check (DRC), export Gerbers |
| 3D Viewer | Check that connectors face the right way and parts do not collide |
Settings to fix before you start
- Units: millimetres. Every datasheet and every fab uses them.
- Grid: 0.5 mm for placement, 0.1 mm for routing fine parts, 50 mil (1.27 mm) in the schematic — never change the schematic grid or wires will stop meeting pins.
- Design rules (Board Setup → Design Rules): copy from your chosen fab's capability page. Typical JLCPCB 4-layer values: minimum trace 0.09 mm (use 0.15), minimum clearance 0.09 mm (use 0.15), via drill 0.2 mm/pad 0.45 mm (use 0.3/0.6), minimum hole-to-copper 0.254 mm.
- Net classes: create
Power(0.5 mm trace, 0.25 mm clearance),Signal(0.15 mm),USB(0.2 mm, differential pair, 90 Ω) so the router applies the right width automatically. - Stackup: 4 layers, 1.6 mm (or 1.0 mm for a light board), 1 oz outer copper; name the layers Top, GND, PWR, Bottom.
Libraries
KiCad ships symbols and footprints for the STM32 family, generic passives, USB-C, crystals and common connectors. For the IMU, regulators and barometer, search first in KiCad's library, then on the manufacturer's site, then on component-library sites that export KiCad format; always open the downloaded footprint and check its pad dimensions against the datasheet's recommended land pattern before trusting it. Keep project-specific symbols and footprints in a project library folder inside the repository so the design is self-contained.
Version control
Put the project folder under Git from day one and commit after every working session. KiCad files are text, so diffs are readable and nothing is ever lost. Tag each board revision you send to a fab (v1.0, v1.1) so you can always rebuild exactly what was ordered.
Other tools worth installing
- STM32CubeMX (free, ST): a pin-assignment planner that flags conflicts between peripherals before you wire anything.
- A Gerber viewer (KiCad's own, or an online one): to inspect exported fab files exactly as the factory will see them.
- Saturn PCB Toolkit or an online trace-width calculator: current capacity and impedance.
- Betaflight / INAV configurator and STM32CubeProgrammer: for Part 10.
The example project structure
fc-v1/ fc-v1.kicad_pro fc-v1.kicad_sch (root sheet; sub-sheets: power, mcu, sensors, io) fc-v1.kicad_pcb lib/ (project symbols, footprints, 3D models) fab/v1.0/ (Gerbers, drill, BOM, position file as sent) docs/ (pinout table, bring-up notes, photos) firmware/ (target definition for Betaflight/INAV)
Part 6 — The schematic, step by step
Draw the schematic in four hierarchical sheets — power, MCU, sensors, I/O — in that order, and finish each with the checklist at its end. A correct schematic is the only thing that makes the layout tractable; errors here are the expensive ones.
Step 0: the pin plan
Before placing a symbol, assign every MCU pin in a table. For the STM32F405RGT6 the example board uses the following, chosen because they match Betaflight's standard peripherals and keep every motor on an independent timer channel:
| Function | Pins | Peripheral |
|---|---|---|
| Gyro SPI | PA5 SCK, PA6 MISO, PA7 MOSI, PA4 CS, PC4 INT | SPI1 |
| Blackbox flash / SD SPI | PB13 SCK, PB14 MISO, PB15 MOSI, PB12 CS | SPI2 |
| OSD or spare SPI | PC10 SCK, PC11 MISO, PC12 MOSI, PA15 CS | SPI3 |
| Barometer I2C | PB8 SCL, PB9 SDA | I2C1 |
| UART1 (receiver) | PA9 TX, PA10 RX | USART1 |
| UART2 (GPS) | PA2 TX, PA3 RX | USART2 |
| UART3 (VTX) | PB10 TX, PB11 RX | USART3 |
| UART4 (ESC telemetry) | PA0 TX, PA1 RX | UART4 |
| UART5 / UART6 (spare) | PC12/PD2, PC6/PC7 | UART5, USART6 |
| Motors 1–4 | PB0, PB1, PA8, PB4 | TIM3 ch3, TIM3 ch4, TIM1 ch1, TIM3 ch1 |
| Motors 5–8 | PC8, PC9, PB3, PB5 | TIM8 ch3, TIM8 ch4, TIM2 ch2, TIM3 ch2 |
| Battery / current ADC | PC1, PC2 | ADC1 |
| USB | PA11 D−, PA12 D+ | USB OTG FS |
| LEDs, buzzer, LED strip | PC13, PC14, PB6 | GPIO / TIM4 |
| SWD | PA13 SWDIO, PA14 SWCLK, NRST | — |
Check in STM32CubeMX that no two assignments collide and that DShot-capable motor pins are on separate DMA streams. Save this table; it becomes the firmware target in Part 10.
Sheet 1: Power
- Battery input. Two large pads VBAT and GND (or the 8-pin ESC connector). Add a TVS diode (e.g. SMBJ30A) from VBAT to GND for spike protection and a 10 µF/50 V ceramic plus a 47–100 µF electrolytic as input bulk capacitance.
- Battery voltage sense. Divider from VBAT: 10 kΩ top, 1 kΩ bottom, 100 nF across the bottom resistor, into PC1. At 25.2 V the ADC sees 2.29 V. Current sense: the ESC provides a voltage proportional to current on the 8-pin cable; feed it through a 10 kΩ/100 nF RC filter into PC2.
- 5 V buck. Copy the regulator datasheet's typical application circuit exactly: input capacitor, inductor (e.g. 4.7 µH, rated ≥ 2 A saturation), output capacitors (2 × 22 µF), feedback resistors for 5.0 V, enable tied to input. Rated for at least 2 A so it can run a receiver, GPS, LEDs and camera.
- USB power ORing. USB VBUS (5 V) through a Schottky diode to the 5 V rail, so the board powers up from USB alone and the buck is not back-fed when both are present.
- 3.3 V main LDO. 5 V → 3.3 V at ≥ 500 mA with 1 µF input and 4.7 µF output ceramics. Powers the MCU, flash, barometer, OSD.
- 3.3 V gyro supply. A second LDO from 5 V (or 10 µH bead + 10 µF from the main 3.3 V) feeding only the IMU. Label the net +3V3_GYRO.
- Optional 9 V/10 V VTX buck. Same pattern as step 3 with different feedback resistors; add a solder jumper to choose 5 V or 9 V on the VTX pad.
- Test points and LEDs. A test pad on every rail; a green LED with 1 kΩ on 5 V.
Checklist: every regulator has the datasheet's capacitors; every rail has a test point; USB and battery can be present simultaneously; the gyro has its own net.
Sheet 2: MCU core
- Supply. Every VDD pin gets 100 nF to GND; add one 4.7 µF bulk. VDDA gets 100 nF + 1 µF via a 10 µH bead or 10 Ω from +3V3 (clean analogue supply for the ADC). VBAT pin ties to +3V3. Each VCAP pin gets a 2.2 µF ceramic to GND (internal regulator; mandatory).
- Clock. 8 MHz crystal between OSC_IN (PH0) and OSC_OUT (PH1), with a load capacitor from each side to GND. Load capacitor value = 2 × (crystal CL − stray); for a 10 pF crystal, 15–18 pF each.
- Reset. NRST pulled to +3V3 by 10 kΩ with 100 nF to GND; bring NRST to the SWD header.
- Boot. BOOT0 to GND through 10 kΩ; a two-pad jumper or button to +3V3 for DFU mode. BOOT1 (PB2) to GND through 10 kΩ.
- SWD header. Three pads SWDIO, SWCLK, GND (plus NRST and +3V3 if space): 1.27 mm or 2.54 mm pitch, or pogo-pin pads.
- Status LEDs. Blue on PC13 via 1 kΩ to +3V3 (active low) and a second colour on PC14.
- Decoupling placement note. Write "place within 2 mm of pin" on the schematic next to the 100 nF capacitors; your future self in the layout will thank you.
Checklist: count VDD pins against the datasheet (F405 LQFP-64: VDD on 19, 32, 48, 64; VDDA 13; VBAT 1; VCAP 31 and 47); crystal and load caps present; NRST and BOOT0 resistors present; SWD pads present.
Sheet 3: Sensors
- IMU (ICM-42688-P). VDD and VDDIO to +3V3_GYRO, each with 100 nF and 2.2 µF. SCLK, SDI (MOSI), SDO (MISO) to SPI1; CS to PA4 with a 10 kΩ pull-up so the chip is deselected during MCU reset; INT1 to PC4; AP_CS and AP_SDO (aux port) tied per datasheet (typically to VDDIO and GND). Draw the chip orientation arrow and note it.
- Barometer (BMP280/DPS310). VDD and VDDIO to +3V3 with 100 nF; SCL/SDA to I2C1 with 4.7 kΩ pull-ups to +3V3 (one pair for the whole bus); CSB tied high to select I2C mode; SDO to GND to set the address.
- Blackbox flash (W25N01G). VCC to +3V3 with 100 nF; CLK, DI, DO to SPI2; CS to PB12 with 10 kΩ pull-up; WP and HOLD pulled high.
- Optional microSD. If used instead of flash: SPI2 wiring to the socket's DAT0/CMD/CLK pins, 10 kΩ pull-ups on every data line, card-detect to a GPIO, and 100 nF + 10 µF on the socket's 3.3 V.
Checklist: every sensor's CS has a pull-up; I2C has exactly one pull-up pair; the IMU is on its own supply net; the INT line reaches an EXTI-capable pin.
Sheet 4: I/O
- USB-C. VBUS to the ORing diode; D+ to PA12, D− to PA11 through 22 Ω series resistors; CC1 and CC2 each to GND through 5.1 kΩ; shield to GND through 1 MΩ + 100 nF (or directly). Add a USB-rated ESD diode array (e.g. USBLC6-2) on D+/D− if you have space; drones get static.
- Motor outputs. Eight pads or the 8-pin JST-SH ESC connector, each motor pin directly from its timer pin; optionally 100 Ω series resistors to tame ringing on long wires. On the ESC connector also route VBAT, GND, current-sense and battery-sense.
- UART pads. TX/RX pairs for UART1–6 with +5V and GND pads beside each. Mark the receiver UART. Any UART that might see a 5 V signal must be on a 5 V-tolerant (FT) pin.
- I2C pads. SCL/SDA/+3V3/GND for an external compass or sensor.
- LED strip, buzzer, camera control. LED data on PB6 through 220 Ω; buzzer via an NPN or N-MOSFET low-side driver from PC14 with a flyback diode; camera control via a resistor to the camera's OSD pin.
- ESC telemetry input on UART4 RX, and VTX control on UART3 TX.
Checklist: USB has CC pull-downs and series resistors; every pad has +5V/GND neighbours; no 5 V signal reaches a non-FT pin.
Finishing the schematic
- Annotate (assign R1, R2… automatically) and give every part a value.
- Assign footprints to every symbol; check each unfamiliar one against its datasheet land pattern.
- Add supplier part numbers as a symbol field (LCSC#, MPN) for the BOM.
- Run ERC and fix every error. Unconnected-pin warnings on unused MCU pins are expected; mark them with a no-connect flag.
- Print it and trace every net with a pencil against the datasheets. This half-hour catches more than any tool.
- Commit with a message like
schematic v1.0 complete, ERC clean.
The mistakes everyone makes once
- Forgetting the VCAP capacitors (the F4 does not boot without them).
- Swapping TX and RX: the MCU's TX goes to the peripheral's RX.
- Missing CC pull-downs on USB-C: the board never gets 5 V from a USB-C host.
- Putting the I2C pull-ups on every device instead of once per bus.
- Choosing motor pins that share a timer with a UART or with each other in a way DShot cannot use.
- Wiring the IMU's SDO and SDI backwards; read the datasheet's SPI timing diagram, not the pin names.
Part 7 — PCB layout
Layout is placement first, routing second, and placement decides 80 % of the result. Spend a full session on placement before drawing a single trace.
Step 1: outline, holes and stackup
- Draw a 36 × 36 mm square on the Edge.Cuts layer with 2 mm corner radii (or the rounded-corner shape commercial boards use).
- Place four mounting holes at (±15.25, ±15.25) mm from centre: 3.1 mm drill for M3 with a 6 mm copper-free keep-out ring, or 2.1 mm for M2 on the 20 mm pattern. Many FCs make the holes 4 mm with rubber grommets to isolate vibration; if you do, draw the hole for the grommet's inner diameter.
- Set the stackup to four layers: F.Cu signals, In1.Cu solid GND, In2.Cu +3V3/+5V, B.Cu signals and power pours. Give each a sensible net: assign In1.Cu a full-board GND zone with no other copper on it.
- Add a direction arrow on the silkscreen pointing to the nose of the aircraft; the firmware's IMU alignment is defined relative to this arrow.
Step 2: placement
Place in this order, because each constrains the next:
- Connectors and pads at the edges. ESC connector on one edge (usually the rear), USB-C on a side where a cable fits in the stack, UART/I2C pads along the remaining edges grouped by function, battery pads if any at the rear corners. Orientation matters: a connector facing the wrong way is the most common reason to re-spin a board.
- IMU at the geometric centre of the board, axes aligned exactly with the board edges (rotate in 90° steps only), nothing within 2 mm of it except its decoupling capacitors and the gyro LDO. Keep it away from the regulators (heat changes the gyro bias) and from mounting holes (flexing). Mark its orientation.
- MCU just beside the IMU, rotated so that SPI1 pins face the IMU and the motor pins face the ESC connector. Short, direct SPI traces matter more than any other signal on the board.
- Decoupling capacitors next to the pins they serve, on the same side as the chip, with their ground via immediately beside them. Place all of them before any other passive.
- Crystal within 5 mm of OSC pins, load capacitors between crystal and MCU, ground pour around it, no signals routed underneath.
- Regulators in a corner far from the IMU, with inductor, input capacitor and output capacitor forming the tightest loop possible; copy the datasheet's layout drawing. Give the buck's switching node (the pad between chip, inductor and diode) minimal copper area.
- USB circuitry near the connector so D+/D− are short.
- Blackbox flash or SD socket wherever space remains, SD socket at an edge where the card can be removed in the stack.
- Barometer away from the regulators, ideally where a small foam cover can sit; a few vent holes in the board nearby help pressure equalise.
- LEDs, buzzer driver, test points, SWD pads last; keep the SWD pads reachable with the board in a stack.
Use both sides: passives and the flash on the bottom are normal. The 3D viewer tells you whether a bottom-side part collides with the ESC below.
Step 3: ground and power
- In1.Cu is one unbroken GND zone. Never route a trace on it; never let the zone be split by a row of vias.
- Every ground pad gets its own via to In1.Cu within 1 mm. Use via stitching (a grid of ground vias every 3–5 mm) across the board so top and bottom ground pours and the inner plane are one piece of copper.
- In2.Cu carries +3V3 as a large zone, with a separate +5V zone region and a small +3V3_GYRO island under the IMU. Vias from each chip's supply pins drop onto these zones; with power on a plane, almost no power trace needs routing on the outer layers.
- VBAT and high-current paths: bottom-layer pours 2–4 mm wide from the battery pads to the ESC connector and buck input; never route battery current across the board on a thin trace.
- Keep the buck regulator's input capacitor, switch node and output capacitor loop entirely on the top layer with its own local ground connection, then tie that to the plane with several vias.
Step 4: routing
- Route the IMU SPI first. Four short traces, same length to within a few millimetres, directly over the ground plane, no vias if possible. Route INT alongside.
- USB D+/D− as a differential pair, 0.2 mm width, 0.15 mm gap (gives roughly 90 Ω on a 4-layer board with a 0.2 mm prepreg), equal length within 1 mm, no stubs, the 22 Ω resistors near the MCU.
- Crystal traces short and surrounded by ground, nothing underneath on any layer.
- Motor signals from the MCU timer pins to the ESC connector: straight, 0.2 mm, can be on either layer; they are low-speed and robust.
- UARTs and I2C on whichever layer is convenient; 0.15–0.2 mm.
- Blackbox SPI / SDIO at 0.15 mm, matched lengths for SDIO.
- Analogue sense lines (battery, current) away from the buck's switch node; the RC filter near the MCU pin.
Routing conventions: traces meet pads at their centre; 45° bends, not 90°; a trace changes layer with a via only when there is no path on its current layer; two vias per layer change for power. If you cannot route something, move a part rather than adding vias.
Step 5: pours, silkscreen and the final checks
- Pour GND on F.Cu and B.Cu with 0.2 mm clearance and thermal reliefs on pads (solid connection on high-current pads). Fill zones and look for islands of copper not connected to anything; remove them.
- Silkscreen: reference designators small (0.8 mm) or hidden on a board this dense; pad labels (UART1 TX/RX, 5V, GND, M1–M8) in 1 mm text, pin-1 marks, the direction arrow, a board name and revision, a version number.
- Add fiducials (two 1 mm bare-copper dots in opposite corners) if the board will be machine-assembled.
- Run DRC with the fab's rules loaded; zero errors. Common DRC errors: clearance between a via and a pour, unconnected net (a trace you forgot), silkscreen over a pad, a hole too close to the board edge.
- Open the 3D viewer and check every connector faces outward, no two parts overlap, bottom parts do not sit on the mounting-hole keep-outs.
- Print at 1:1 on paper, lay real parts on it; a 0402 looks very different in your fingers than on screen.
- Commit and tag:
layout v1.0, DRC clean.
Vibration and the IMU, in practice
Motor vibration reaches the gyro through the frame, the standoffs and the board itself. Three choices reduce it: grommet-mounted holes (soft rubber between screw and board), the IMU at the centre where board flex is smallest, and a 1.6 mm board rather than 1.0 mm if weight allows. Firmware filtering handles the rest; a well-placed gyro on a stiff board needs much less filtering, which means less latency and a better-flying aircraft.
Part 8 — Fabrication: from files to boards in your hand
A fab needs three things from you: Gerber files describing each layer, an Excellon drill file, and (for assembly) a BOM and a component position file. KiCad exports all of them in two dialogs. Order five boards of a first revision; you will use at least two.
Step 1: export the fabrication files
- In the PCB Editor: File → Fabrication Outputs → Gerbers. Select layers F.Cu, In1.Cu, In2.Cu, B.Cu, F.Paste, B.Paste, F.Silkscreen, B.Silkscreen, F.Mask, B.Mask, Edge.Cuts. Tick "Use Protel filename extensions" (fabs expect
.GTL,.GBL,.GKO…), untick "Plot reference designators" only if you hid them deliberately, and set the output folder tofab/v1.0/. - In the same dialog, Generate Drill Files: Excellon format, PTH and NPTH merged or separate (either is accepted), millimetres, and generate a drill map for your own reference.
- File → Fabrication Outputs → BOM: export CSV with reference, value, footprint, quantity and your supplier part-number field.
- File → Fabrication Outputs → Component Placement (.pos): CSV, millimetres, both sides, origin at the board's drill/place origin (set the origin to the bottom-left corner of the board outline first so positions are positive).
- Zip the Gerber and drill files; keep the BOM and position file separate.
Step 2: inspect the Gerbers
Open the zip in a Gerber viewer and look at each layer alone. You are checking what the factory will see, not what KiCad shows. Look for: a missing layer, the board outline absent or open, text mirrored on the bottom, solder mask openings that do not match pads, drill holes offset from their pads, and anything on the paste layer that should not be soldered (test points, mounting holes).
Step 3: choose a fab and options
| Option | Pick for a flight controller | Why |
|---|---|---|
| Layers | 4 | Ground plane; see Part 1 |
| Thickness | 1.6 mm (1.0 mm for racing weight) | Stiffness for the gyro |
| Copper | 1 oz outer, 0.5–1 oz inner | Enough for battery pours when wide |
| Surface finish | ENIG | Flat pads for LGA/QFN; HASL bumps can tilt the IMU |
| Solder mask | Any colour; black or green | Black is conventional; green has highest contrast for inspection |
| Min trace/space | 0.127 mm / 0.127 mm (5/5 mil) | Standard process, no surcharge |
| Via | 0.3 mm drill / 0.6 mm pad | Standard |
| Stencil | Yes, framework-less, top (and bottom if bottom parts) | Needed for the IMU paste; $7–$10 |
| Impedance control | Not required for a first board | USB tolerates ±15 % at 12 Mbit/s |
JLCPCB, PCBWay and ALLPCB ship to the Gulf in 5–10 days by courier; expect $10–$25 for five 4-layer boards plus $7–$10 for a stencil plus shipping. European and US fabs (Eurocircuits, OSH Park, Aisler) cost more but may avoid customs delays.
Step 4: assembly options
- Hand assembly. You solder every part. Cheapest; needs paste and a hot plate for the IMU. Best for learning and for a board with fewer than ~100 placements.
- Factory SMT assembly. Upload BOM and position file; the fab places parts from its own stock and reflows them. JLCPCB's economic service places from its basic parts library at about $2–$3 setup plus a few cents per part; extended parts add a small fee each. The IMU, MCU and regulators are usually in stock. You receive a finished board and only solder connectors. Strongly consider this for revision 2 onwards, or for revision 1 if your hand soldering is untested.
- Hybrid. Have the factory place the LGA/QFN parts and passives; you add the MCU, connectors and anything they lack.
For factory assembly: match every BOM line to the assembler's part number, check the footprint rotation in their preview (rotated chips are the classic assembly error; correct the rotation in the position file), and order at least two assembled boards so one can be sacrificed to debugging.
Step 5: order parts for hand assembly
Order from LCSC, Mouser or DigiKey using the BOM: at least two of every chip and ten of every passive value (0402s vanish). Add a tube of lead-free or leaded solder paste (leaded is easier; use ventilation), no-clean flux in a pen or syringe, isopropyl alcohol and fine solder wire (0.5 mm). Parts for one board cost $12–$20; the extras for a first order bring it to about $35.
What arrives
Boards arrive in a vacuum pack; inspect each under magnification for scratches in the mask, missing holes and a clean edge. Put one aside unsoldered as a reference and for continuity testing. The stencil arrives flat; keep it in its sleeve.
Part 9 — Assembly and soldering
Assemble in two passes: paste and reflow everything you can on a hot plate first, then hand-solder what is left. Work on the side with the IMU first, and inspect before the next step every time.
Tools
| Tool | Minimum | Better |
|---|---|---|
| Iron | 60 W temperature-controlled, 0.8–1.2 mm chisel or conical tip, 320–350 °C | Station with interchangeable tips |
| Reflow | Hot plate (a $20 preheater or a makerspace plate) | Reflow oven with a profile, or hot-air station |
| Magnification | 10× loupe or a phone camera | Stereo microscope |
| Handling | Fine curved tweezers, flux pen, solder wick, isopropyl alcohol, lint-free wipes | Vacuum pick-up pen |
| Measurement | Multimeter with continuity beep | Bench supply with current limit, oscilloscope |
| Safety | Ventilation or a fume extractor, safety glasses |
Pass 1: paste and reflow
- Clean the board with alcohol; tape it to the bench at two edges with other boards or spare PCB scraps around it to hold the stencil level.
- Align the stencil over the pads under magnification; tape one edge as a hinge.
- Spread paste with a card or squeegee in one firm stroke at 45–60°; lift the stencil straight up. Every pad should carry a clean brick of paste; if any are smeared, wipe the board, clean the stencil and repeat.
- Place parts with tweezers, smallest first, from the centre out: IMU (check the pin-1 dot and orientation against the silkscreen twice), then passives, then the MCU and regulators. Press lightly so the part sits in the paste. Surface tension during reflow will self-align parts that are slightly off, but not ones that are 180° rotated.
- Reflow. Hot plate: put the board on, raise to about 150 °C for 60–90 s (paste flux activates, board heats evenly), then to 220–235 °C (leaded) or 240–250 °C (lead-free) until you see every joint flow silver, hold 15–30 s, then slide the board onto a cool surface. Oven: use the paste's printed profile. Hot air: 300–350 °C, low airflow, sweep continuously, heat each area until it flows.
- Inspect every joint under magnification. A good joint is shiny and concave at each lead. Look for bridges between the MCU's leads (fix with flux and a drag of a clean tip, or wick), tombstoned passives standing on end (re-flow with hot air while pressing down), missing parts, and IMU tilt. The IMU's joints are hidden; check it sits flat and flush, and trust the continuity test later.
- Clean with alcohol and a brush; dry.
Pass 2: hand soldering
- Connectors. USB-C: tack two outer shield tabs, check it is flush and square, then solder the pins with flux and a fine tip; the inner 0.5 mm pitch pins are drag-soldered. JST-SH: tack one pad, align, solder the rest.
- Through-hole or large pads. Battery pads, buzzer, pin headers: higher iron temperature, more solder.
- Drag soldering a LQFP (if not reflowed). Flux the leads generously, tin the tip, tack two opposite corners, then draw the tip slowly along each side; the solder follows the flux and bridges are rare. Wick off any that form.
- Bottom side. If the bottom has only passives and flash, paste and reflow it first and hand-solder the top; or reflow the top first and hand-solder the few bottom parts.
Inspection and first electrical checks (before any power)
- Visual: every part present, correct orientation on the MCU (pin-1 dot), IMU, diodes, polarised capacitors; no solder balls stuck in the mask.
- Continuity: with the multimeter beeping, confirm GND reaches every ground pad and the USB shield; confirm +3V3 and +5V are not shorted to GND (expect several kΩ or more; a few ohms means a bridge or a reversed part). Confirm VBAT is not shorted to GND.
- Resistance to ground on each rail compared to the unsoldered reference board: anything under 100 Ω on 3.3 V is a problem.
- Crystal, reset and boot resistors present.
If all checks pass, the board is ready for Part 10. If not, find the fault now: a short found under a microscope takes five minutes; the same short found as smoke takes a new board.
Rework
To remove a chip: flood the leads with flux, heat with hot air at 350 °C while lifting gently with tweezers; never pull before every joint has melted or you will tear pads. To remove a passive: two irons or a wide tip bridging both ends. Clean the pads with wick, re-flux, place the new part, reflow. Keep a log of every rework in the bring-up notes.
Part 10 — Bring-up, testing and firmware
Bring-up means powering the board for the first time in a way that cannot destroy it, confirming each block works in isolation, and only then loading flight firmware. Follow the order below; each step depends on the one before.
Step 1: smoke test on a current-limited supply
- Set a bench supply to 5 V with the current limit at 100 mA and connect it to the 5 V rail (not the battery input yet). If you have no bench supply, use a USB port through a USB current meter.
- Watch the current: a healthy board idles at 30–80 mA with the MCU unprogrammed. More than the limit, or a part getting warm, means a short; power off and find it.
- Measure the 3.3 V rail (3.25–3.35 V) and the gyro rail with the multimeter. Measure VDDA and each VCAP (about 1.2–1.3 V on the F4's VCAP pins once the internal regulator is up).
- Only when 5 V is clean: raise the limit to 500 mA, connect a battery or a supply at 12 V to the battery input, and confirm the buck gives 5.0 V ± 0.1 V with the board drawing roughly the same current. Check the buck's inductor and chip are not hot after a minute.
Step 2: talk to the MCU
- Connect an ST-Link (or any CMSIS-DAP/J-Link) to the SWD pads: SWDIO, SWCLK, GND, and NRST if present. Open STM32CubeProgrammer, choose ST-LINK, Connect. Seeing the device ID (0x413 for an F405) proves the MCU is powered, clocked internally, soldered and alive.
- If connection fails: check the SWD wiring, check 3.3 V on VDD pins, check NRST is high, check BOOT0 is low, reflow the MCU corners.
- Alternatively, hold BOOT0 high, plug in USB, and the MCU should enumerate as "STM32 BOOTLOADER" (DFU). If it does not, the problem is USB wiring, the crystal (DFU needs the external 8 MHz) or the CC pull-downs.
Step 3: blink and check the crystal
Flash a minimal program (STM32CubeIDE or PlatformIO generates one in minutes) that configures the external crystal, enables USB, and blinks the status LED at 1 Hz. If the LED blinks at the wrong rate, the clock configuration or crystal is wrong; if USB enumerates as a virtual COM port, the crystal is within tolerance. This fifteen-minute step saves hours of guessing later.
Step 4: build a firmware target
Flight firmware must know your pin assignment. In Betaflight (4.4 and later) this is a unified target / config file: a text file listing which MCU pins carry each resource. INAV and ArduPilot use target.h and hwdef.dat respectively, with the same information. Write it from the Step 0 table in Part 6:
# Betaflight config excerpt for the example board board_name MYFC_F405 manufacturer_id MYFC resource MOTOR 1 B00 resource MOTOR 2 B01 resource MOTOR 3 A08 resource MOTOR 4 B04 resource SERIAL_TX 1 A09 resource SERIAL_RX 1 A10 resource SPI_SCK 1 A05 resource SPI_SDI 1 A06 resource SPI_SDO 1 A07 resource GYRO_CS 1 A04 resource GYRO_EXTI 1 C04 resource I2C_SCL 1 B08 resource I2C_SDA 1 B09 resource ADC_BATT 1 C01 resource ADC_CURR 1 C02 resource LED 1 C13 set gyro_1_bustype = SPI set gyro_1_spibus = 1 set gyro_1_sensor_align = CW0 set baro_bustype = I2C set baro_i2c_device = 1
Build the firmware (Betaflight's cloud build or a local toolchain), export the .hex, and flash it over DFU from the configurator or STM32CubeProgrammer.
Step 5: bench tests, one block at a time
| Block | Test | Pass criterion |
|---|---|---|
| USB and MCU | Configurator connects | Firmware version shown, board name correct |
| IMU | Setup tab 3D model | Model follows board rotation on all three axes, correct direction; gyro noise < 1 °/s at rest |
| IMU alignment | Tilt nose down | Pitch shows negative (or as firmware expects); fix sensor_align if not |
| Barometer | Lift board 1 m | Altitude readout rises roughly 1 m; readings stable to ±0.3 m |
| Battery sense | Connect a known voltage | Readout within 0.1 V after calibration |
| Receiver UART | Connect receiver | Receiver tab channels move with sticks |
| Each UART | Loopback TX to RX with CLI serialpassthrough | Typed characters echo |
| Blackbox | Enable logging, arm with props off | Log file written, readable in Blackbox Explorer |
| Motor outputs | Motors tab, props removed, ESC connected | Each slider spins only its motor; DShot telemetry shows RPM |
| Current draw | Full configuration idle | < 250 mA from 5 V |
| Thermal | 20 min idle on battery | Nothing above 60 °C |
An oscilloscope, if available, is used for three things: the 8 MHz crystal waveform (clean sine, correct frequency), ripple on the 3.3 V gyro rail (< 20 mV peak-to-peak), and the DShot pulse shape at the ESC connector.
Step 6: first flight
Mount the FC with grommets, arrow forward, props off, and confirm motor direction and order in the configurator. Fly a hover in a safe area with default PIDs, land, and read the blackbox log: gyro noise spectra reveal whether the IMU mounting and supply are good. Tune filters and PIDs only after the hardware log is clean.
Debugging guide
| Symptom | Likely cause | Check |
|---|---|---|
| No 3.3 V | LDO reversed, input missing, short on rail | Voltage at LDO in/out; resistance to GND |
| ST-Link cannot connect | SWD wiring, MCU not soldered, no VDD | 3.3 V on VDD; reflow corners |
| DFU not found on USB | CC pull-downs, D+/D− swapped, crystal | Enumerates with 8 MHz test firmware? |
| Gyro not detected | SPI wiring, CS pull-up missing, wrong gyro rail, IMU not reflowed | Continuity from MCU pins to IMU pads; 3.3 V on gyro rail |
| Gyro noisy or drifting | Switching noise on gyro supply, IMU near regulator or hole | Scope on gyro rail; log at rest |
| UART dead | TX/RX swapped, wrong pin in target | Loopback test |
| Motor does not spin | Wrong timer in target, DMA conflict, ESC protocol | Try PWM protocol first; check resource mapping |
| Resets under load | 5 V rail sagging, buck undersized, bad input cap | Scope on 5 V while spinning motors |
Record every finding in docs/bring-up.md with the board revision and date; this file is the input to revision 2.
Part 11 — Designing so one board serves many projects
A reusable flight controller is one you can move between airframes, reconfigure without re-soldering, repair without a new order, and iterate without starting over. Each of those is a design decision made before the first revision, not after.
Mechanical reuse
- Standard mounting. 30.5 × 30.5 mm M3 (or 20 × 20 mm M2) means every frame, ESC and stack accessory ever made fits. Do not invent a pattern.
- Grommet holes. 4 mm holes with rubber grommets let the same board go on a stiff 5-inch quad and a vibrating fixed-wing without changing the IMU filtering.
- Connectors over solder pads for anything you will unplug between projects: a JST-SH 8-pin for the ESC, 4- or 6-pin for the receiver and GPS, with pinouts matching the common commercial order (GND, 5V, TX, RX) so bought cables fit.
- Keep the stack height standard (bottom parts no taller than 3.5 mm) so it sits on any ESC with 5 mm standoffs.
Electrical reuse
- More UARTs than you need now. Six is the practical maximum on an F405; break every one out. An unused UART costs two pads.
- A spare SPI and I2C bus on pads for research sensors, an optical-flow or range sensor, a companion computer.
- Solder-jumper options: VTX pad at 5 V or 9 V; receiver UART inverter in or out; buzzer on or off; a jumper that selects which pin feeds a resource. A solder jumper is two pads and a drop of solder, and it saves a revision.
- Both blackbox options: footprint for a SPI flash and for a microSD socket sharing one SPI bus with separate chip-selects; populate whichever a project needs.
- A wide input range: 2S–6S (7–26 V) covers almost every small aircraft; 8S needs different regulators and should be a separate variant.
- ESD protection on every external line (USB, UARTs, LED strip): a repaired board is a reused board, and the most common field failure is a static-killed UART.
- Test points on every rail and bus, labelled, on the top side, so a board can be diagnosed without disassembling the stack.
Firmware reuse
- One target definition covers one pinout. Keep the pin plan identical across revisions unless there is a reason; a changed pin means a new target, a rebuild and a reflash for every board you own.
- Put the config file in the repository next to the hardware, with a version string that matches the silkscreen.
- Keep the board compatible with Betaflight's standard resource naming so it works with INAV and ArduPilot targets written from the same table; a board that flies three firmwares is more useful than one tuned to a single release.
Documentation that makes reuse possible
- Pinout diagram and table (what every pad is, which UART, which voltage) as a one-page PDF in
docs/. - Schematic PDF exported with each revision.
- Bill of materials with supplier numbers, so a board can be rebuilt a year later.
- Bring-up and test log with the pass values from Part 10 for each board serial number.
- Change log between revisions: what changed, why, and which boards have the change.
- Known issues list, including the workarounds (a bodge wire, a jumper setting).
Serialise each board with a marker or a label (v1.0-003) and keep its test record; when one misbehaves in the field, you know exactly what it is.
Iterating: revision 2 and beyond
After the first boards fly, make a list from the bring-up notes and sort it into three groups: must fix (a wrong footprint, a connector facing inward), should improve (a noisy rail, a crowded pad), and nice to have (an extra port). Revision 2 contains the first two groups only. Keep the mounting, the pin plan and the connector pinouts fixed so every accessory, cable and firmware target from revision 1 still works; change silkscreen version and add a revision resistor code if the firmware must distinguish them. Order revision 2 assembled by the factory now that the design is proven; keep revision 1 boards as bench and test units.
Variants from one design
Because the schematic is hierarchical, the same project can produce variants by changing one sheet: a 20 × 20 mm version by shrinking the outline and dropping two UARTs, an H743 version by swapping the MCU sheet and updating the pin plan, an AIO version by adding an ESC sheet. Branch in Git per variant; merge common fixes back.
Appendices
A. Glossary
| Term | Meaning |
|---|---|
| ADC | Analogue-to-digital converter; MCU input that measures a voltage |
| AIO | All-in-one: FC and ESC on one board |
| BOM | Bill of materials: the list of every part |
| Buck | A step-down switching regulator |
| Decoupling | A capacitor beside a chip's power pin that supplies its fast current demands |
| DFU | Device Firmware Upgrade: USB bootloader mode for flashing |
| DRC | Design Rules Check: automatic check of the layout against fab limits |
| DShot | Digital motor-control protocol sent on one wire per motor |
| ENIG | Electroless nickel immersion gold: a flat pad finish |
| ERC | Electrical Rules Check: automatic check of the schematic |
| ESC | Electronic speed controller: drives a brushless motor |
| EXTI | External interrupt pin on the MCU |
| Footprint | The pad pattern for one component |
| FR-4 | Glass-epoxy board material |
| Gerber | The file format describing one PCB layer |
| IMU | Inertial measurement unit: gyroscope + accelerometer chip |
| LDO | Low-dropout linear regulator |
| LGA / QFN | Chip packages with pads underneath; need reflow |
| LQFP | Chip package with leads on four sides; hand-solderable |
| Net | One electrical connection in the schematic |
| OSD | On-screen display: overlays data on analogue video |
| Pour / plane | A large copper fill, usually ground |
| Prepreg | Resin-impregnated glass sheet laminated between copper layers |
| Pull-up / pull-down | Resistor that holds a pin at a known level when nothing drives it |
| SMD / THT | Surface-mount / through-hole component |
| Stencil | Steel sheet with holes matching the pads, for applying solder paste |
| SWD | Serial Wire Debug: two-wire debug and programming interface |
| TVS | Transient voltage suppressor: a diode that clamps spikes |
| UART | Serial port: one TX and one RX wire |
| Via | A plated hole connecting layers |
B. Reference values
| Quantity | Value |
|---|---|
| Trace width for 0.5 A / 1 A / 2 A / 3 A (1 oz, 10 °C rise) | 0.15 / 0.3 / 0.75 / 1.3 mm |
| Via current (0.3 mm drill) | ~1 A each; use several for power |
| Standard via | 0.3 mm drill, 0.6 mm pad |
| Signal trace / clearance | 0.15 mm / 0.15 mm |
| USB differential pair | 0.2 mm wide, 0.15 mm gap, lengths matched within 1 mm |
| 100 nF decoupling distance to pin | ≤ 2 mm |
| Crystal load capacitors (10 pF crystal) | 15–18 pF |
| I2C pull-ups | 4.7 kΩ to 3.3 V, one pair per bus |
| SPI chip-select pull-up | 10 kΩ |
| Battery divider (6S) | 10 kΩ : 1 kΩ, ratio 11:1 |
| USB-C CC pull-downs | 5.1 kΩ each to GND |
| Reflow peak (leaded / lead-free) | 220–235 °C / 240–250 °C |
| Iron temperature | 320–350 °C |
| Mounting pattern | 30.5 × 30.5 mm M3, or 20 × 20 mm M2 |
| Board thickness | 1.6 mm (1.0 mm lightweight) |
| Idle current, 5 V | 30–80 mA bare MCU; < 250 mA fully configured |
| Gyro supply ripple | < 20 mV peak-to-peak |
C. Pre-order checklist
- Every MCU VDD, VDDA, VBAT and VCAP pin decoupled as the datasheet shows
- Crystal, load caps, NRST and BOOT0 circuits present
- IMU on its own 3.3 V net, CS pulled up, INT on an EXTI pin, orientation marked
- One I2C pull-up pair; every SPI CS pulled up
- USB: CC pull-downs, 22 Ω series, ESD array, D+/D− not swapped
- Motor pins on DShot-capable timers without DMA conflicts (checked in CubeMX)
- 5 V-only signals reach only FT pins
- Pin plan table saved and matches the schematic
- ERC clean; schematic printed and traced by hand
- Footprints checked against datasheet land patterns
- 4-layer stackup: unbroken GND on In1.Cu
- IMU at centre, axes aligned, 2 mm clear; regulators in a corner
- Every ground pad has a via within 1 mm; stitching vias across the board
- Connectors face outward (checked in 3D)
- Silkscreen: arrow, pad labels, version, pin-1 marks
- DRC clean with the fab's rules
- Gerbers inspected layer by layer in a viewer
- BOM has supplier part numbers; position file rotations checked
- Git tagged with the revision sent
D. Bring-up checklist
- Visual inspection under magnification complete
- No rail shorted to GND; resistance compared with bare board
- 5 V applied through current limit; current normal; 3.3 V, gyro 3.3 V, VCAP correct
- Battery input applied; buck output 5.0 V; nothing warm
- ST-Link connects and reads the device ID
- Blink test runs at the correct rate; USB enumerates
- Flight firmware target written from the pin table and flashed
- IMU, barometer, battery sense, each UART, blackbox, motors tested per the Part 10 table
- Board serial number and results logged
E. Where to learn more
- The schematics of open-source flight controllers (several Betaflight-supported boards publish KiCad or PDF schematics on GitHub): the fastest way to see how professionals wire the same blocks.
- STM32F405 datasheet and reference manual (ST), and ST application note AN4488 ("Getting started with STM32F4 hardware development") for the exact decoupling, crystal and boot circuits.
- TDK ICM-42688-P datasheet, sections on power, SPI timing and recommended PCB layout.
- Your chosen fab's capability page and design-rule file for KiCad.
- Betaflight, INAV and ArduPilot developer documentation on target definitions.
- KiCad's official Getting Started guide and the Footprint Editor tutorial.
- A general reference on PCB layout practice (e.g. Henry Ott's Electromagnetic Compatibility Engineering) for the reasoning behind the ground-plane and decoupling rules.