Skip to the content
4 layers64.1 × 50.5 mmFlight controller version1, the printed circuit board in 3D

Custom STM32F411 quadcopter flight controller: KiCad PCB, embedded C, ICM-20948 IMU over SPI, quaternion complementary filter, PID attitude control.

Size
64.1 × 50.5 mm
Copper layers
4
Thickness
1.6 mm
Parts
81
Nets
93
Pads
320
Tracks, vias
501, 100
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
28 Sep 2026
Updated
19 Oct 2026

Overview

Flight controller version1 is an open-source printed circuit board by santhazsolt, from the santhazsolt/stm32-based-quadcopter-drone repository on GitHub, published under the MIT licence. It is a 4-layer board of 64.1 × 50.5 mm with 81 parts on 93 nets, routed with 501 tracks and 100 vias.

It is built around the TPS54336ADDA, SN74AUP1T34DCK and AMS1117-3.3, with the ICM-20948, TLV75518PDBV and AO3401A among its other parts. Its parts include 37 capacitors, 15 resistors, 10 ICs, 9 connectors and 3 diodes. It belongs with the robots and motor control and sensors and measurement boards and the STM32 boards of this library.

Main components

7

README

README.md

STM32-Based Quadcopter Flight Controller

A custom embedded flight controller built around the STM32F411 microcontroller, an ICM-20948 inertial measurement unit, and a custom-designed PCB.

This project focuses on the design and development of a quadcopter flight controller, combining embedded C firmware, sensor interfacing, control-system development, power electronics, and printed circuit board (PCB) design.

The goal is to develop a custom hardware and firmware platform capable of reading inertial sensor data, estimating the drone's attitude, processing pilot commands, and controlling four electronic speed controllers (ESCs). The project is also intended to serve as a foundation for future autonomous flight and precision agriculture applications.

Repository: stm32-based-quadcopter-drone


Table of Contents


Project Overview

Commercial flight controllers typically integrate a microcontroller, inertial sensors, power regulation, communication interfaces, and motor-control outputs on a single PCB.

This project explores how those components can be designed and integrated into a custom embedded system.

The hardware is built around the STM32F411CEU6, an ARM Cortex-M4 microcontroller with an FPU, hardware timers, SPI, UART, ADC, and other peripherals suitable for real-time embedded applications.

The controller interfaces with an ICM-20948 9-axis IMU, which combines a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer. The sensor provides measurements that can be used for attitude estimation and flight stabilization.

The project covers two interconnected areas:

  • Hardware: Schematic design, component selection, PCB layout, power distribution, signal interfacing, and hardware debugging.
  • Firmware: Peripheral configuration, sensor drivers, inertial data processing, attitude estimation, control algorithms, and ESC signal generation.

The long-term objective is to develop a functional flight-control platform that can be extended with GPS navigation, autonomous flight, and aerial crop-monitoring capabilities.

Project Objectives

The primary objectives are to:

  1. Design a custom flight-controller PCB around the STM32F411.
  2. Integrate an inertial measurement unit using SPI communication.
  3. Develop embedded C firmware for sensor acquisition and peripheral control.
  4. Establish the software architecture for attitude estimation and PID-based stabilization.
  5. Generate control signals for four ESCs using STM32 hardware timers.
  6. Integrate a radio-control receiver for manual pilot input.
  7. Design a power architecture suitable for operation from a LiPo battery.
  8. Establish a repeatable hardware bring-up and debugging procedure.
  9. Build a modular platform that can support future autonomous navigation and precision agriculture applications.

System Architecture

The flight controller is designed as a real-time embedded system. Its main responsibility is to process sensor measurements and pilot commands, calculate the required control response, and generate motor outputs.

mermaid
flowchart TD
    BAT[LiPo Battery] --> PWR[Power Management]
    PWR --> MCU[STM32F411]
    PWR --> IMU[ICM-20948 IMU]
    RC[RC Receiver] --> MCU
    IMU -->|SPI| MCU
    MCU -->|PWM or supported ESC protocol| ESC[Four ESCs]
    ESC --> MOT[Four Brushless Motors]
    MCU <--> DBG[SWD Debug Interface]
    MCU <--> USB[USB / Serial Debugging]
    GPS[Future GPS Module] -.-> MCU

Main subsystems

SubsystemResponsibility
STM32F411Main processor and real-time control
ICM-20948Inertial measurements for attitude estimation
RC receiverPilot commands and manual control
ESC interfacesMotor command generation
Power managementBattery input and regulated supply rails
SWD interfaceProgramming and low-level debugging
USB interfaceDevelopment, programming support, or diagnostics, depending on implementation
GPS modulePlanned navigation and position estimation

The architecture separates sensor acquisition, state estimation, control calculations, and actuator output. This separation makes the firmware easier to test, debug, and extend.


Hardware Design

The hardware is being developed in KiCad, from the electrical schematic through PCB layout and manufacturing preparation.

1. Microcontroller

STM32F411CEU6 — ARM Cortex-M4

The STM32F411 is the central processing unit of the flight controller.

Key capabilities relevant to this project include:

  • 32-bit ARM Cortex-M4 core with a floating-point unit.
  • Hardware timers for precise timing and PWM generation.
  • SPI for high-speed sensor communication.
  • UART for serial communication with external modules.
  • ADC for analog measurements, including battery-voltage monitoring.
  • SWD for programming and debugging.

The exact peripheral allocation, clock configuration, timer assignments, and GPIO mapping are defined by the firmware and hardware design.

2. Inertial Measurement Unit

ICM-20948 — 9-axis IMU

The ICM-20948 provides:

  • 3-axis accelerometer measurements.
  • 3-axis gyroscope measurements.
  • 3-axis magnetometer measurements.

The accelerometer measures specific force, including the influence of gravity. The gyroscope measures angular velocity. The magnetometer can provide heading-related information when properly calibrated and when magnetic interference is controlled.

The firmware is intended to use these measurements to estimate the drone's orientation.

The sensor communicates with the STM32 through SPI. Because the ICM-20948 has specific digital-I/O voltage requirements, the hardware design incorporates a dedicated 1.8 V supply and logic-level translation between the sensor and the 3.3 V microcontroller domain.

Important: Correct sensor identification, register access, initialization, data acquisition, and calibration must be verified on the actual hardware before the IMU can be considered operational.

3. Radio-Control Receiver

The controller is designed to accept pilot commands from a radio-control receiver.

The receiver interface is intended to provide the flight controller with inputs such as:

  • Roll command.
  • Pitch command.
  • Yaw command.
  • Throttle command.

The receiver protocol and electrical interface must match the selected receiver and firmware configuration. For an IBUS-based receiver, the firmware must correctly configure the appropriate UART, baud rate, packet parsing, and input-validation logic.

Receiver disconnection and invalid or stale commands should be handled explicitly before flight operation.

4. ESC and Motor Interfaces

The flight controller is designed to command four ESCs, each driving a brushless DC motor.

The intended quadcopter platform uses:

  • Four brushless motors.
  • Four ESCs.
  • A quadcopter frame.
  • A LiPo battery.

The ESC interfaces must use a signal format supported by the selected ESCs and configured in the firmware. PWM is a possible implementation, but the actual timer configuration and signal timings must be verified.

Motor order, rotation direction, and the relationship between motor outputs and the quadcopter's frame orientation must be documented and tested.

5. Programming and Debugging

The board is designed to support development and troubleshooting through:

  • SWD programming and debugging.
  • USB connectivity where supported by the implemented circuit.
  • Measurement of regulated power rails.
  • Inspection of digital signals with an oscilloscope or logic analyzer.
  • Firmware logging and diagnostic output, where implemented.

These interfaces support verification of the power supply, MCU startup, sensor communication, and control-signal generation.


Power Management

Power management is a critical part of the flight-controller design because the system combines a high-current battery-powered propulsion system with low-voltage digital electronics.

The hardware uses a staged power architecture.

Power stageComponentPurpose
Battery inputXT60 connectorMain LiPo power connection
Input protectionFuse and reverse-polarity protection circuitryProtect the input against specified fault conditions
Main DC-DC conversionTPS54331 buck converterGenerate the main regulated supply
5 V to 3.3 VAMS1117 regulatorSupply the MCU and other compatible 3.3 V circuitry
3.3 V to 1.8 VTLV75518 regulatorSupply the ICM-20948 digital-I/O voltage domain
Logic-level translationDedicated level-shifting circuitryAdapt signals between 3.3 V and 1.8 V domains

The final electrical behavior depends on the selected component variants, resistor values, capacitor values, PCB implementation, and load conditions.

Firmware Architecture

The firmware is intended to be organized into independent modules, separating low-level hardware access from flight-control algorithms.

The exact module names and implementation status should follow the source code in the repository.

1. Hardware initialization

The initialization layer configures the STM32 peripherals required by the application.

Typical responsibilities include:

  • System clock configuration.
  • GPIO initialization.
  • SPI initialization.
  • UART initialization.
  • Timer and PWM configuration.
  • Interrupt configuration where required.

STM32CubeIDE and STM32CubeMX can be used to configure the device peripherals and generate the initial project configuration.

2. IMU driver

The IMU driver is responsible for communication with the ICM-20948.

Its intended responsibilities include:

  • Reading the device identification register.
  • Resetting and initializing the sensor.
  • Configuring accelerometer and gyroscope ranges.
  • Configuring the required operating modes.
  • Reading sensor registers.
  • Converting raw values into engineering units.
  • Detecting communication errors.

The SPI interface should be verified independently before sensor-fusion or control algorithms are integrated.

3. Sensor calibration and filtering

Raw IMU measurements contain bias, noise, and other errors.

The sensor-processing layer is intended to support:

  • Gyroscope bias estimation.
  • Accelerometer offset or calibration procedures.
  • Conversion from raw measurements to physical units.
  • Filtering of noisy measurements.
  • Validation of sensor readings.

A complementary filter or a suitable alternative can be used to combine accelerometer and gyroscope data for attitude estimation.

A magnetometer-based heading estimate requires additional calibration and appropriate handling of magnetic interference.

4. Attitude estimation

Attitude estimation calculates the orientation of the quadcopter from sensor measurements.

The firmware architecture can accommodate Euler-angle or quaternion-based representations.

The estimated state can provide roll, pitch, and yaw information for the control system. The selected algorithm must account for sensor coordinate conventions, sampling frequency, and numerical stability.

5. PID control

PID controllers can be used to reduce the difference between the desired and measured attitude or angular rate.

The general controller equation is:

[ u(t)=K_p e(t)+K_i\int e(t),dt+K_d\frac{de(t)}{dt} ]

where:

  • (e(t)) is the control error.
  • (K_p) is the proportional gain.
  • (K_i) is the integral gain.
  • (K_d) is the derivative gain.
  • (u(t)) is the controller output.

The actual control architecture may use cascaded rate and attitude loops. Controller execution must use a known timing interval, and the implementation should include appropriate output limits, integral anti-windup, and handling of invalid sensor data.

PID control is a planned or developing subsystem until its implementation and behavior have been verified.

6. Motor mixing and output generation

The motor-mixing layer converts control commands into individual motor commands.

For a conventional quadcopter, this combines collective throttle with roll, pitch, and yaw corrections according to the selected frame configuration.

The mixing matrix must match the actual motor numbering, rotation directions, and frame geometry.

The output layer then converts the calculated commands into the electrical signals expected by the ESCs.

7. Safety and fault handling

A flight controller must detect conditions that make continued control unsafe.

The firmware should ultimately address:

  • Invalid or unavailable IMU data.
  • Sensor initialization failures.
  • Radio-control signal loss.
  • Invalid throttle or control inputs.
  • Control-loop timing failures.
  • Out-of-range actuator commands.
  • Safe startup and motor arming conditions.

These mechanisms must be explicitly implemented and tested. Their presence should not be assumed solely from the firmware architecture.


Flight Control Fundamentals

The intended control pipeline is:

  1. Acquire sensor measurements.
  2. Validate and calibrate the sensor data.
  3. Estimate the vehicle's attitude or angular rate.
  4. Decode pilot commands.
  5. Calculate the control error.
  6. Execute the relevant PID controllers.
  7. Apply motor mixing and output limits.
  8. Generate ESC signals.
  9. Repeat at the configured control-loop rate.

The timing of this pipeline is as important as the individual algorithms. Sensor sampling, controller execution, and actuator updates should be coordinated to provide predictable behavior.

A control-loop frequency should be selected based on sensor configuration, processing requirements, and validated hardware performance rather than assumed in advance.


Communication Interfaces

InterfaceIntended use
SPIICM-20948 communication
UARTRC receiver or serial peripherals
PWM-capable timersESC command generation
ADCBattery-voltage measurement
SWDProgramming and debugging
USBConnectivity and development support, subject to the implemented hardware

The STM32 peripheral mapping must be documented in the firmware configuration or a dedicated pin-assignment document. Exact pins and alternate functions should not be inferred from the component list alone.


Development Tools

The project uses the following tools and technologies.

Tool or technologyPurpose
KiCadSchematic capture and PCB design
STM32CubeIDEFirmware development, compilation, and debugging
STM32CubeMXPeripheral and clock configuration
STM32CubeProgrammerProgramming and device access
ST-LINKSWD debugging and flashing
CEmbedded firmware development
Oscilloscope / logic analyzerHardware signal inspection
Git and GitHubVersion control and project documentation

Relevant embedded topics include SPI, UART, ADC, timer configuration, PWM generation, sensor calibration, real-time control, and hardware debugging.

Development Workflow

The project follows a hardware-and-firmware development process.

Hardware development

  1. Define system requirements and component interfaces.
  2. Select the microcontroller, IMU, power components, connectors, and protection circuitry.
  3. Design the electrical schematic in KiCad.
  4. Perform electrical-rule checks and manually review critical circuits.
  5. Assign and verify component footprints.
  6. Transfer the schematic to the PCB editor.
  7. Define the board outline, mounting holes, and connector locations.
  8. Place components and route the PCB.
  9. Perform design-rule checks and review manufacturing outputs.
  10. Manufacture and assemble the PCB.
  11. Bring up the board progressively, checking each supply rail and subsystem.

Firmware development

  1. Configure the STM32 clocks and peripherals.
  2. Verify startup, programming, and debugging.
  3. Test the SPI communication interface.
  4. Implement and validate IMU initialization and data acquisition.
  5. Verify calibration and sensor-data conversion.
  6. Develop and test the attitude-estimation algorithm.
  7. Implement control-loop timing and PID calculations.
  8. Verify motor mixing and ESC signal generation without propellers.
  9. Integrate the receiver and validate input handling.
  10. Perform staged, controlled system testing.

Planned Improvements

Flight-control functionality

  • Complete the IMU driver and sensor calibration.
  • Implement and validate attitude estimation.
  • Develop PID-based rate and attitude control.
  • Add motor mixing and output constraints.
  • Implement arming logic and failsafe behavior.
  • Improve diagnostics and runtime fault detection.

Hardware validation

  • Complete PCB manufacturing and assembly.
  • Validate power integrity and signal levels.
  • Measure sensor communication timing.
  • Verify ESC interfaces and receiver compatibility.
  • Document hardware revisions and any required design changes.

Autonomous navigation

Future development may include:

  • GPS integration.
  • Position and altitude estimation using suitable additional sensors.
  • Return-to-Home functionality.
  • Autonomous waypoint navigation.
  • Telemetry and mission monitoring.

These capabilities require additional hardware, algorithms, and extensive validation beyond basic attitude stabilization.

Precision agriculture

An additional long-term objective is to use the quadcopter as a platform for agricultural monitoring.

Potential applications include:

  • Aerial field mapping.
  • Multispectral image acquisition.
  • Vegetation-index calculations such as NDVI.
  • Crop-health monitoring.
  • Integration with a companion computer for image processing and autonomous mission planning.

These are future extensions rather than assumed capabilities of the current flight controller.


Learning Outcomes

This project provides practical experience in:

  • Embedded C development on STM32 microcontrollers.
  • Peripheral configuration and real-time firmware architecture.
  • SPI communication with inertial sensors.
  • PCB schematic capture, layout, and design verification.
  • Power regulation and signal-level compatibility.
  • ADC measurements and sensor-data processing.
  • Attitude estimation and feedback-control fundamentals.
  • Timer-based actuator control.
  • Hardware debugging using SWD and laboratory instruments.
  • System integration across hardware, firmware, and control algorithms.

The project combines electronics engineering and embedded software development in a single system, with a focus on understanding the interactions between physical hardware and real-time control.


References

Consult the applicable datasheets and reference manuals for the exact device variants used in the hardware.


License

Specify the project's license here once it has been selected. If the repository includes both firmware and hardware design files, make sure the chosen license covers the intended reuse of each type of artifact.


Author: Zsolt Sántha

Project: STM32-Based Quadcopter Flight Controller

Parts

81
QtyValueFootprintReferences
140.1uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC14, C15, C16, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29
6100nCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC1, C2, C3, C4, C6, C9
5SN74AUP1T34DCKPackage_TO_SOT_SMD:SOT-353_SC-70-5U6, U7, U8, U9, U10
41uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC7, C8, C17, C18
422Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR3, R4, R5, R6
4Conn_01x03_PinConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ3, J4, J5, J6
20.1 uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC30, C33
2100kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR13, R14
210kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R16
210pCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC10, C11
222uCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC12, C13
247uCapacitor_SMD:C_1210_3225Metric_Pad1.33x2.70mm_HandSolderC34, C36
2Conn_01x04_PinConnector_JST:JST_SH_SM04B-SRSS-TB_1x04-1MP_P1.00mm_HorizontalJ1, J2
110uCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC5
110uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC35
1120RInductor_SMD:L_0603_1608Metric_Pad1.05x0.95mm_HandSolderFB1
1120pCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC31
112nCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC32
115 uInductor_SMD:L_Coilcraft_XAL6060-XXXL1
116MHzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
119kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR9
11k5Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR2
122kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR15
13.75kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR8
1374kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR11
14.7uCapacitor_SMD:C_1210_3225Metric_Pad1.33x2.70mm_HandSolderC37
151Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR10
161.9kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR12
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U3
1AO3401APackage_TO_SOT_SMD:SOT-23Q2
1BZV55B10Diode_SMD:D_MiniMELFD4
1Conn_ARM_JTAG_SWD_10Connector_PinHeader_1.27mm:PinHeader_2x05_P1.27mm_Vertical_SMDJ7
1D_SchottkyDiode_SMD:D_SOD-123D3
1FuseFuse:Fuse_1206_3216MetricF1
1ICM-20948Sensor_Motion:InvenSense_QFN-24_3x3mm_P0.4mmU2
1REDLED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolderD1
1STM32F411CEUxPackage_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mmU1
1SW_Push_OpenButton_Switch_SMD:SW_SPST_PTS810SW1
1SW_SPDTButton_Switch_SMD:SW_SPST_PTS810SW_BOOT1
1TLV75518PDBVPackage_TO_SOT_SMD:SOT-23-5U4
1TPS54336ADDAPackage_SO:TI_SO-PowerPAD-8_ThermalViasU5
1USB_B_MicroConnector_USB:USB_Micro-B_Molex_47346-0001J8
1XT60-BatConnector_AMASS:AMASS_XT60-M_1x02_P7.20mm_VerticalJ9

Similar boards

  • 2 layers250 × 150 mmStratoSTEAM, the printed circuit board in 3D

    StratoSTEAM

    robotgtfxry/StratoSTEAM

    112 parts
  • 4 layers57 × 73.3 mmMagnitrometr, the printed circuit board in 3D

    Magnitrometr

    kor-and-m/motor_robot_pcb

    90 parts
  • 4 layers77 × 61.5 mmCAN IMU, the printed circuit board in 3D

    CAN IMU

    risingtideresearch/can-imu-pcb

    An IMU carrier PCB

    56 parts
  • 2 layers83.6 × 107.3 mmShield stm2025, the printed circuit board in 3D

    Shield stm2025

    Rami-Troudi/Electrique-Eurobot-IEEE-INSAT-2026

    Repo for my electrical work for the Eurobot competition

    66 parts1
  • 4 layers101 × 175 mmPower PCB, the printed circuit board in 3D

    Power PCB

    ICRS/IPRL-Electronics-Hardware

    96 parts1
  • 4 layers50 × 50 mmFlightController Drone, the printed circuit board in 3D

    FlightController Drone

    damnitzhemanth-oss/Flight_Controller

    Custom STM based flightcontroller designed from scratch.

    157 parts
  • 2 layers68 × 98 mmSpindle driver, the printed circuit board in 3D

    Spindle driver

    dougsthenri/spindle_driver_v1

    PCB project for a BLDC motor driver tailored for CNC spindle motors

    97 parts

Questions

How big is the Flight controller version1 PCB?

It measures 64.1 × 50.5 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Flight controller version1 use?

81 parts, built around the TPS54336ADDA, SN74AUP1T34DCK, AMS1117-3.3 and ICM-20948. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Flight controller version1 KiCad files?

From the santhazsolt/stm32-based-quadcopter-drone repository on GitHub, at the commit this page was made from: the board is hardware/pcb/flight_controller_version1.kicad_pcb and its schematic hardware/schematic/flight_controller_version1.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Flight controller version1 design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).