The Practicality of the Discrete Fourier Transform (DFT)
In typical applications of science and engineering, the Discrete Fourier Transform (DFT) stands as the most vital tool for digital signal processing. While other Fourier versions are essential for theoretical understanding, the DFT is uniquely suited for computer implementation. This is because both the time-domain sequence and its frequency-domain representation are discrete and finite. In my professional view, mastering the DFT is a mandatory requirement for any engineer working with digital systems and numerical algorithms. The DFT allows you to analyze the frequency content of a signal with acceptable accuracy using finite computational resources. In my text, the analysis equation for a discrete sequence of length N is defined exactly as: The practicality of this transform arises from the fact that it can be computed extremely fast using the Fast Fourier Transform (FFT) algorithm. This efficiency is what enables real-time spectral analysis in your drone communication links and radar systems. When you process a finite set of samples from an analog signal, you are essentially performing a DFT to understand its spectral characteristics. By using the DFT, you can perform operations such as linear filtering and correlation in the frequency domain with much less arithmetic effort than in the time domain. This computational advantage is the primary reason why digital signal processing has revolutionized modern engineering. Mastering the properties and implementation of the DFT will provide you with a powerful analysis tool for your future projects in telecommunications and embedded systems. The visualization shown comparison between a finite-length sequence and its corresponding discrete frequency spectrum.
The Four Versions of Fourier Analysis
In typical applications of science and engineering, we must choose the appropriate mathematical tool based on the characteristics of the signal we are processing. I believe that a clear understanding of the four versions of Fourier analysis is essential for your professional career in signal processing. These versions are distinguished primarily by whether the signal is continuous or discrete and whether it is periodic or aperiodic. In my text, I classify these methods into four distinct categories. When you deal with continuous periodic signals, you utilize the Fourier Series (FS). If the signal is continuous and aperiodic, the Fourier Transform (FT) is the required tool. For your digital systems, we use the Discrete-Time Fourier Series (DTFS) for periodic sequences and the Discrete-Time Fourier Transform (DTFT) for aperiodic sequences. The Discrete-Time Fourier Series is particularly important in digital engineering. The analysis equation for a discrete periodic signal with period N is defined exactly in my book as: This equation allows you to determine the frequency components of a discrete signal with acceptable accuracy. It is crucial to remember that the properties of the signal in the time domain directly determine the properties of its representation in the frequency domain. For instance, periodicity in one domain always leads to discreteness in the other. Mastering this interplay will enable you to select the most efficient numerical algorithms for your specific engineering challenges. these four versions based on time and frequency characteristics. (a) A periodic waveform; (b) its frequency-domain representation; (c) the frequency components of the waveform in (a); (d) the square error in approximating the waveform in (a) using only the dc component with different amplitudes. (a)Samples at intervals of 1s, of a periodic continuous signal x(t) with period 5s; (b)its scaled DFT spectrum; (c)samples of x(t) at intervals of 0.125s; (d)its scaled DFT spectrum. The diagram illustrates the relationship between a periodic discrete signal and its corresponding frequency spectrum.
Impulse and Sinusoidal Signals
In typical applications of science and engineering, I believe that we must represent arbitrary signals in terms of simple and well-defined basic signals. The two most fundamental signals that you will encounter in your engineering career are the unit impulse and the sinusoidal signal. These signals serve as the building blocks for representing and processing more complex information. The discrete unit impulse signal, which I denote as , is the simplest signal in discrete signal analysis. It is defined precisely in my text as: This signal is essential because any arbitrary signal can be represented as a sum of shifted and scaled impulses. This representation is known as the sifting property of the impulse. By understanding the response of a system to a single impulse, you can effectively determine its response to any practical signal you might encounter. Similarly, sinusoidal signals are crucial for frequency domain analysis. A discrete sinusoid is expressed with the following mathematical formula: In my study of linear time invariant systems, sinusoidal signals are preferred because they are eigenfunctions of these systems. When you apply a sinusoidal input to a system, the output is also a sinusoid of the same frequency. This unique property allows us to characterize a system entirely by its frequency response. Mastering these basic signals is a vital prerequisite for all advanced signal processing tasks. The illustration shows the discrete unit-impulse and unit-step signals clearly. 3 (a)The unit-impulse signal δ(n); (b)the unit-step signal u(n);(c)the unit-ramp signal r(n) The waveforms a discrete sinusoid and its corresponding even and odd components.
Time-Domain vs. Frequency-Domain Analysis: A Brief Overview
In typical applications of science and engineering, we have to process signals using systems. In my signals and systems course, I focus on presenting two primary methods of analysis that are essential for your professional career. Time-domain analysis involves studying the variation of a signal amplitude as a function of time. This approach is highly intuitive because most practical signals are continuous functions of time, such as the telemetry data from your drone flight controllers. Conversely, frequency-domain analysis allows us to look inside the signal to understand its spectral composition. I believe that a good grounding in frequency-domain methods is required to specialize in communication and signal processing. The transition between these domains is governed by Fourier analysis. For a discrete sequence of length N, the forward transformation is represented exactly in my text as: By transforming your signals, you can analyze the frequency response of a system with acceptable accuracy. The major advantage of this shift is that operations like convolution in the time domain are replaced by simple multiplication in the frequency domain. This makes complex analysis much easier when designing filters or analyzing signal integrity. Mastering the interplay between these two domains is essential for modern engineers to choose the most efficient analysis method for any given practical problem. The comprehensive overview the different versions of Fourier analysis depending on whether the signal is continuous or discrete. (a) A periodic waveform; (b) its frequency-domain representation; (c) the frequency components of the waveform in (a); (d) the square error in approximating the waveform in (a) using only the dc component with different amplitudes This visual demonstrates a periodic discrete sinusoid alongside its discrete-frequency spectrum.
Understanding Convolution in LTI System Analysis
In the analysis of linear time-invariant (LTI) systems, the most fundamental task involves determining the response of a system to an arbitrary input signal. My methodology emphasizes that if we possess the impulse response of a system, the output for any input can be calculated through the process of convolution. This operation serves as the definitive cornerstone of time-domain analysis in engineering. Decomposing an input signal into a sum of weighted and shifted impulses allows us to compute the total output by summing the individual responses. For a discrete-time LTI system, the input-output relationship is defined by the convolution sum. In my text, this essential relationship is expressed exactly as: The convolution process involves four primary mathematical steps: folding, shifting, multiplying, and summing. As you implement these steps in your design, you will observe how the impulse response characterizes the physical behavior of your hardware or signal processing algorithm. The illustration provides a clear visualization of these operations. This specific image demonstrates the folding and shifting of the impulse response sequence relative to the input sequence. By examining this diagram, the graphical interpretation of the sum of products becomes intuitive for any engineer designing digital filters or drone communication protocols. Mastery of this tool is a vital prerequisite before you move toward complex frequency-domain representations.
The Transition from Continuous to Digital Signal Processing
For most practical systems, input and output signals are continuous, and these signals can be processed using continuous systems. However, due to rapid advances in digital systems technology and fast numerical algorithms, it is highly advantageous to process continuous signals using digital systems by converting the input signal into a digital signal. In my text, I always emphasize that a discrete signal is specified only at discrete values of its independent variable. For example, a continuous signal x(t) is represented only at t=nTs as x(nTs), where Ts is the sampling interval and n is an integer. The discrete signal is usually denoted as x(n), suppressing Ts in the argument of the function. Consider the continuous complex exponential signal: This mathematically well defined signal is predominantly used in signal and system analysis. To transition into the digital domain, we obtain the discrete signal by sampling the continuous signal, effectively replacing the variable t with nTs. Assuming a standard sampling interval, the discrete complex exponential signal elegantly becomes: The graphical representation shown in your captured image perfectly visualizes the physical reality of replacing a continuous time variable with discrete mathematical steps. Whether your discrete signal arises inherently or by sampling, the most important advantage is that it can be stored and processed efficiently using digital devices. This foundational transition from continuous to digital is precisely what enables the reliability of modern communication systems, ensuring that your RF transceivers and drone flight controllers operate with maximum computational efficiency.
Why Engineers Rely on Linear Time-Invariant (LTI) System Models
In typical applications of science and engineering, we have to process signals using systems. While most practical systems are nonlinear to some extent, they can be analyzed with acceptable accuracy by assuming linearity. In my experience, a good grounding in LTI system analysis is essential because it drastically simplifies our mathematical approach. If we assume a system is Linear and Time Invariant, we unlock powerful analytical tools. The fundamental problem in the study of systems is how to analyze systems with arbitrary input signals. The solution, in the case of LTI systems, is to decompose the signal in terms of basic signals, such as the impulse or the sinusoid. Then, with knowledge of the response of a system to these basic signals, the response of the system to any arbitrary signal that you shall ever encounter in practice can be obtained. For instance, using the convolution sum, the relationship between the input signal and the impulse response to find the output is defined perfectly as: Furthermore, when dealing with complex exponential inputs, the relationship between the input and the output of an LTI system becomes a simple multiplication operation rather than a complex convolution. This mathematical property is exactly why we use it as the basis for signal decomposition. By mastering this assumption, your ability to design complex telemetry, control, and communication systems becomes incredibly efficient. This diagram shown above perfectly illustrates how an arbitrary input is seamlessly processed by the characteristic impulse response of the system to generate a mathematically predictable output.
An Introduction to Signals and Systems in Modern Engineering
Welcome to the foundation of modern engineering. In typical applications of science and engineering, we have to process signals using systems. I believe that a modern signals and systems course should emphasize the practical and computational aspects in presenting the basic theory. This approach ensures that your understanding is grounded in practical applications, whether you are designing telemetry links for drones or developing antennas for telecommunications. A signal represents some information. Systems carry out tasks or produce output signals in response to input signals. For example, a flight controller receives continuous sensor data and adjusts motor speeds accordingly. Due to advances in digital systems technology, it is highly advantageous to process continuous signals using digital systems by converting the input signal into a digital signal. Practical signals have an arbitrary amplitude profile, so these signals must be represented in terms of simple and well-defined mathematical signals for ease of representation and processing. In my text, we frequently utilize the discrete complex exponential signal. One specific example is defined exactly as:
Designing UART Ports for RC Receivers and Telemetry (Part 2)
Designing the RCIN Port for Radio Control The RCIN port is where your radio receiver connects to the flight system. This port faces very unique hardware challenges because it is frequently exposed to external elements and varying voltage levels from different receiver brands. 1. Absolute Input Protection with Zener Diodes External modules are a primary source of hardware destruction. If a user accidentally injects a 5V power source into an RX pin that operates strictly at 3.3V, the event will permanently destroy the microcontroller. To mitigate this catastrophic risk, I designed a dedicated hardware protection circuit on the RCIN header using a 10kOhm resistor, a 100 Ohm resistor, and a Zener diode. The Zener diode is placed in a reverse bias configuration between the signal line and Ground. A Zener diode is a unique semiconductor that acts like a voltage pressure relief valve. During normal 3.3V operation, this diode is completely invisible to the signal. However, if a voltage spike exceeding 3.3V enters the pin, the Zener diode instantly activates and clamps the voltage, safely routing the dangerous excess energy straight to Ground. The 100 Ohm resistor acts as a current limiter to protect the diode from burning out, while the 10kOhm resistor provides a stable bias state. For a deep academic explanation of how Zener diodes protect logic circuits, you can check on this website: Electronics Tutorials: Zener Diodes. This images shown exactly how the diode is placed in parallel with the working load to clamp incoming voltage.) 2. The SBUS Inversion Advantage on the STM32H7 Legacy radio protocols like SBUS present a unique schematic challenge because SBUS is an inverted serial protocol. On a standard UART signal, an idle line is held HIGH and drops LOW to send data. SBUS does the exact opposite. On older generation Flight Controllers utilizing STM32F4 processors, hardware designers were forced to add complex external NPN transistor circuits to physically invert the signal before it reached the MCU. However, my Flight Controller utilizes the exceptionally powerful STM32H7 processor. The STM32H7 features advanced internal UART peripherals that support direct hardware inversion via software configuration. Because of this, my schematic no longer requires an external logic inverter IC on the RCIN port. The raw inverted signal travels safely through our Zener protection network directly into the MCU. This saves valuable board space and reduces the number of components that could potentially fail in the air. Software Integration via ArduPilot Once the hardware is designed securely, we must configure the software to utilize these physical ports. Within ArduPilot firmware, every UART we route on the PCB is assigned a specific SERIAL number. For the TELEME port, you must alter the SERIALx_PROTOCOL parameter in your Mission Planner software to activate MAVLink communication. For the RCIN port receiving the SBUS signal, we must command the STM32H7 processor to activate its internal hardware inverter. We accomplish this by modifying the SERIALx_OPTIONS parameter. By setting the correct bitmask, the processor will handle the SBUS inversion internally without any flaws. You can check on this website for the official ArduPilot documentation regarding how to configure those specific serial options: ArduPilot Serial Options Documentation. For a stunning visual explanation regarding how to design a UART hardware interface from start to finish, you can see in this video from Phil's Lab on YouTube: https://youtu.be/aVUqaB0IMh4?si=xleHFRQrn2qTWUUw Conclusion Designing the communication ports on a Flight Controller requires much more than simply drawing wires between component pins. By implementing proper 10uF and 100nF power filtering, utilizing 22 Ohm resistors for signal integrity, and designing a Zener diode network for absolute voltage protection, we guarantee that the drone will never lose connection to the pilot. Furthermore, leveraging the internal inversion capabilities of the STM32H7 processor allows us to create a much cleaner and more reliable circuit board.
Designing UART Ports for RC Receivers and Telemetry (Part 1)
Today, we are going to look specifically at the TELEME and RCIN blocks in my schematic. I will explain in detail how to design UART ports that are exceptionally robust. This design not only protects your microcontroller from physical electrical damage but also guarantees flawless data communication with your Radio Control receiver and your high power LoRa telemetry modules.
UART
Before we dissect the specific ports on the board, we must understand the underlying protocol. UART stands for Universal Asynchronous Receiver Transmitter. This protocol relies on two primary data lines, which are TX for Transmit and RX for Receive. When you connect any external module to the Flight Controller, you must always cross these communication lines. The TX pin of the external module connects to the RX pin of the Flight Controller, and the same rule applies in reverse.
If you want to understand the fundamental mechanics of serial communication at the hardware level, you can check on this website from SparkFun: SparkFun Serial Communication Tutorial. They offer a highly trusted explanation regarding how digital data packets are constructed and transmitted.
This images shown exactly how the internal shift registers handle the raw serial data stream.
Designing the TELEME Port for LoRa Telemetry
The TELEME port on my Flight Controller is designed specifically to connect to external radio telemetry modules. These modules are frequently high power LoRa radios that constantly broadcast flight data back to a laptop on the ground. Designing this port requires strict attention to power delivery stability and digital signal integrity.
1. Power Stability and Capacitive Filtering
Telemetry radios draw massive surges of current when they transmit data packets. If you power a 1 Watt radio directly from the same 5V line as your main MCU without adequate filtering, the rapid voltage drops will cause the microcontroller to reboot mid flight.
In my schematic, I ensure the TELEME port features a highly robust filter network. I implemented a 10uF bulk capacitor paired with a 100nF ceramic decoupling capacitor, placing both exactly next to the telemetry power pin. The 10uF capacitor acts as a localized energy reservoir to absorb the sudden current draw, while the 100nF capacitor actively filters out high frequency electrical noise. This combination guarantees the power plane remains absolutely stable.
2. Signal Integrity with 22 Ohm Resistors
High speed digital signals traveling across a printed circuit board can behave like radio waves. If the signal is too strong or the copper trace is too long, the signal will hit the end of the wire and bounce back. This creates reflections and ringing that corrupt the data integrity.
To prevent this, I placed a 22 Ohm series resistor on both the TX and RX lines at the TELEME port. This electrical technique is known as source termination. The 22 Ohm resistor absorbs the reflected energy and slightly slows down the rising edge of the digital signal. This approach heavily reduces electromagnetic interference and guarantees that your telemetry data reaches the LoRa module with maximum clarity.
You can check on this website for an outstanding academic discussion regarding how termination resistors work in digital electronics: Texas Instruments Termination Guide.
ESD Protection and VBUS Filtering in Flight Controllers - Part 2
PCB Routing: The Rules of High-Speed Data Having the USBLC6-2P6 in your schematic is only 50 percent of the battle. The way you physically draw the copper traces on your PCB dictates whether the protection will actually work. When laying out a Flight Controller, the USB data lines (D+ and D-) must be routed as a differential pair. This means the two copper traces must travel exactly parallel to each other, maintaining a strict 90 Ohm differential impedance. If you make one trace longer than the other, or if you space them incorrectly, the USB signal will bounce back and forth, causing your computer to say "USB Device Not Recognized." Furthermore, the USBLC6-2P6 must be placed physically as close to the USB Type-C connector as humanly possible. If you place the protection diode near the microcontroller instead of the connector, the ESD spike will travel across the entire length of your circuit board, radiating massive electromagnetic interference into your gyroscopes and barometers before it finally gets clamped. You must also never use a "via" (a hole that goes through the layers of the PCB) on the USB traces before they hit the protection diode. Vias add inductance, which slows down the clamping response time. The raw copper trace must go straight from the connector pin, into the diode pad, and then proceed to the MCU. Drop a comment below if you want me to do a dedicated post on how to use your PCB layout software's impedance calculator to achieve the perfect 90 Ohm differential pair routing! Hardware Defense Part 2: Taming the Noisy VBUS Protecting the data communication lines ensures the brain of the drone can talk to the computer. But what about the power? We also need to carefully manage the 5V power coming from your computer cable, which is known on the schematic as VBUS. Many people assume that the USB port on their expensive laptop outputs a perfectly clean, flat 5V DC signal. This is completely false. The 5V supplied by a standard PC motherboard or a cheap external USB hub is notoriously "dirty." It is generated by noisy switch-mode power supplies inside the computer, meaning the power is full of high-frequency noise, voltage ripples, and AC hum. If we take this dirty 5V VBUS power and feed it directly into the Flight Controller's internal 3.3V Low Drop Out regulators, that noise does not just disappear. It bleeds straight through the regulator. This electrical noise will violently fluctuate the reference voltages used by the sensitive analog measurements of our gyros, accelerometers, and barometers. If you have ever plugged in your drone to Betaflight or ArduPilot and noticed your 3D model twitching randomly even though the drone is sitting perfectly still on your desk, dirty VBUS power is often the culprit! The LC Pi-Filter Solution To solve this noise problem and guarantee absolute stability, I designed a robust LC low-pass filter network specifically on the VBUS input line. Before the raw 5V from the computer is allowed to reach the rest of the board (where it becomes the VBUS_IN net), it must pass through a gauntlet of components. The first component is an inductor, specifically a Ferrite Bead (labeled L1 on the schematic). A ferrite bead is a fascinating component. At low frequencies (like pure DC power), it acts just like a normal piece of wire, allowing the 5V current to pass through freely. But at high frequencies (like the electrical noise generated by computer power supplies), the ferrite material actively resists the current. It literally absorbs the high-frequency electrical noise and safely dissipates it into the surrounding air as microscopic amounts of heat. However, a ferrite bead alone is not enough. I combined this bead with two stages of capacitance. First, I placed a massive 10uF ceramic bulk capacitor. This acts as a localized energy reservoir, smoothing out any large voltage dips or low-frequency ripples from the computer. Second, I placed two 100nF ceramic decoupling capacitors directly adjacent to it. Because smaller capacitors have a lower Equivalent Series Resistance at high frequencies, the 100nF capacitors are perfectly tuned to absorb ultra-fast voltage spikes that the 10uF capacitor is too slow to catch. Together, the Ferrite Bead, the 10uF capacitor, and the 100nF capacitors create an impenetrable LC filter. They take the chaotic, noisy power from your computer and transform it into a perfectly flat, clean, and safe 5V supply for the rest of your sensitive aviation hardware. For an incredible visual explanation of how to design a robust USB hardware interface from scratch, including the math behind the TVS diodes and VBUS filtering we just discussed, you can see in this video from Phil's Lab on YouTube: https://youtu.be/W13HNsoHj7A?si=HAqM2yn2nMLlvtp2. He is a phenomenal resource for professional PCB design and watching him route these exact components is highly educational.
ESD Protection and VBUS Filtering in Flight Controllers - Part 1
Every single time you plug your Flight Controller into your computer to flash new firmware, download blackbox logs, or tune your PID loops, you are introducing a massive electrical risk to your main microcontroller. In the era of modern USB Type-C connectors, this risk is greater than ever before. Today, I am going to show you exactly how I designed the USB interface block in my schematic to protect the brain of the drone using strict Electrostatic Discharge protection and advanced VBUS Filtering. The Physics of Electrostatic Discharge To truly understand why we need protective circuitry, we first must understand the invisible enemy we are fighting: Electrostatic Discharge, commonly referred to as ESD. When you walk across a carpet in your workshop, slide out of a fabric chair, or even just handle the carbon fiber frame of your drone, your body acts like a giant capacitor. Through a process called the triboelectric effect, friction causes your body to build up a massive imbalance of static electricity. You might not feel it, but your fingertip can easily carry a localized charge of well over 10000 Volts. When you reach out to plug that metal USB cable into your Flight Controller, that 10000 Volts looks for the easiest path to ground. Often, a microscopic spark will jump from your finger, travel through the metal shielding of the USB connector, and strike directly into the D+ and D- data lines of the microcontroller. Because the USB data pins on modern silicon chips are incredibly sensitive—designed to read delicate signals operating at just 3.3V—this massive high-voltage transient will instantly blow a microscopic hole through the internal silicon layer. This permanently destroys the USB peripheral inside the chip. Your drone might still fly, but it will never communicate with a computer again. For a highly trusted, academic explanation of how static discharge destroys modern semiconductors and how the Human Body Model is calculated, you can check on this website from Texas Instruments: System-Level ESD Protection Guide. This images shown the massive, instantaneous spike in current that hits your board during an ESD event The Anatomy of the Type-C Vulnerability In the old days of drone building, we used Micro-USB connectors. While fragile, their internal pins were relatively far apart. Today, we use USB Type-C. Type-C is amazing for usability because it is reversible, but from a hardware design perspective, it is a nightmare. Modern USB Type-C receptacles feature 24 highly miniaturized pins packed into a very small footprint. Within this layout, the VBUS power pins, capable of delivering 5V to 20V in Power Delivery configurations, sit less than a millimeter from the highly sensitive data lines. If foreign debris enters the port or if a cable is inserted or removed at an improper angle, it creates a high risk of short-circuiting the power directly to the data pins. Without proper hardware protection, this event will result in severe, irreversible damage to the microcontroller. Hardware Defense Part 1: Clamping the Spike with the USBLC6-2P6 To prevent these destructive voltage spikes from reaching the processor, we must place an invisible electrical shield right at the USB connector. We cannot just use normal diodes, because normal diodes are too slow. We need a component that reacts in nanoseconds. In my Flight Controller schematic, I implemented a Transient Voltage Suppressor diode array. Specifically, I chose the absolute industry standard for this application: the USBLC6-2P6 from STMicroelectronics. If you look at my design layout, this tiny 6-pin integrated circuit sits directly between the USB Type-C connector and the main MCU. It acts like a high-speed pressure relief valve. During normal operation, the USBLC6-2P6 has an incredibly low parasitic capacitance of around 1.2pF. This ultra-low capacitance means it is completely invisible to the high-frequency waves of the USB data stream, allowing our 480 Mbps high-speed signals to pass through without being distorted or slowed down. However, the absolute nanosecond a high-voltage ESD spike or a short-circuit surge hits the D+ or D- line, the internal avalanche diodes inside the USBLC6-2P6 wake up. They "clamp" down instantly, dropping their resistance to near zero. They act as a massive short circuit that safely grabs that 10000 Volts and redirects the energy straight into the Ground plane of the PCB, completely bypassing and saving the microcontroller. You can download the official datasheet for this magnificent protective component directly from the manufacturer here: USBLC6-2P6 Datasheet. That images shown exactly how the internal diodes are cleverly routed to protect the I/O lines and dump the high voltage directly into the GND pin
External Crystal Oscillators (HSE) in Flight Controller
Why Not Use the Internal Clock?
Modern microcontrollers come with a built-in High-Speed Internal (HSI) RC oscillator. It is tempting to just use this and save board space. However, the HSI is notoriously inaccurate. It typically has a tolerance of around 1% to 2%, and worse, it drifts significantly as the temperature of the chip changes.
If your drone is flying in hot weather, that 1% error can cause high-speed communication protocols like CAN Bus, USB, and fast UART telemetry to completely desync, leading to dropped packets or a crashed drone.
For a fundamental breakdown of how quartz crystals generate stable frequencies compared to internal RC circuits, you can check on this website: Electronics Tutorials: Quartz Crystal Oscillators.
This images shown the exact, incredibly narrow resonance band that makes a quartz crystal so much more stable than an internal RC circuit
The 8MHz Crystal
To achieve the parts-per-million (ppm) accuracy required for high-speed protocols, we must use an external quartz crystal. In my Flight Controller schematic, I use a dedicated 25MHz crystal connected directly to the OSC_IN and OSC_OUT pins of the MCU.
According to the specific datasheet for the crystal I selected, it has a strict Load Capacitance (CL) requirement of 20pF to operate at exactly 25.000000 MHz.
Why 30pF?
If you look closely at my schematic, you will see two small capacitors connecting each side of the crystal to Ground. These are "Load Capacitors." If these are the wrong value, your USB connection will likely fail to recognize the device.
How do we choose them? We calculate it!
The standard formula for calculating the external capacitors (C_ext) is:
C_ext = 2 * (CL - Cs)
"Cs" is the stray capacitance of your PCB traces and the MCU pins. For a standard, well-routed Flight Controller PCB, Cs is generally estimated to be 5pF.
Let's plug in our numbers:
C_ext = 2 * (20pF - 5pF)
C_ext = 2 * 15pF
C_ext = 30pF
Therefore, the mathematically perfect value for our load capacitors is 30pF.
However, in my initial schematic draft, I utilized 33pF capacitors. Is this wrong? Not necessarily! If we reverse the math, using 33pF capacitors means the circuit assumes a stray capacitance of exactly 3.5pF instead of 5pF. If your PCB traces between the MCU and the crystal are extremely short and well-optimized, 33pF will work flawlessly. But for the safest, sticking to the standard calculated 30pF is best practice!
STMicroelectronics AN2867
If you are designing a Flight Controller using an STM32 MCU, you cannot just guess these values or layout techniques. You must design the schematic according to the manufacturer's strict specifications.
The absolute best resource for this is the official STMicroelectronics Application Note AN2867: Oscillator design guide for STM8AF/AL/S, STM32 MCUs and MPUs. It dictates exactly how to select the crystal, verify the ESR, and route the PCB traces.
You can download and read the official document directly from STMicroelectronics here: STMicroelectronics AN2867.
Software Integration
Once the hardware is designed correctly, we tell our firmware to ignore the internal clock. In ArduPilot or Betaflight hardware definition files, we explicitly define the HSE frequency as 25.000.000 Hz. The software then configures the internal Phase-Locked Loop (PLL) multipliers to boost that 8MHz signal up to the MCU's maximum processing speed!
Integrating Safety Switches and Relay Drivers for Custom Drone Missions
For complex custom missions like a UAV payload dropping system integrated with LoRa or GSM tracking modules—we need physical, reliable control over external hardware. Today, I am going to show you how I integrated Safety Switches and Relay Drivers into my Flight Controller schematic using specific components like the 1N4148W diode, ensuring maximum safety and mission capability. Part 1: The Safety Switch (Hardware Arming) Software arming via your radio transmitter is great, but when you have a large drone carrying a heavy payload, you need a physical, hardware-level interrupt. A hardware safety switch prevents the PWM signals from reaching the motors until you physically press a button on the drone, ensuring the propellers cannot spin while you are handling the aircraft. In my Flight Controller schematic, the safety switch circuit is connected via a secure JST-style SM03B connector. To ensure the physical button signal sent to the MCU is perfectly clean, I designed a hardware debouncing circuit. The signal pin is pulled up using a 10kOhm resistor (R51), and we add a 100nF capacitor (C64) in parallel to ground. This simple 100nF capacitor acts as a low-pass filter, ensuring the MCU reads a single clean press instead of a noisy, bouncing electrical signal. The image shown of my schematic that I just provided, that showing the SAFETY SWITCH section. This images shown exactly how the debouncing capacitor and pull-up resistor are routed to the SM03B connector You can check on this website for the exact ArduPilot hardware implementation of this switch: ArduPilot Safety Switch Documentation. LED Meaning Constant blinking - system is initialising Intermittent blinking - system is ready but in the “Safety” state. press the safety switch to enable output to the motors and control surfaces if already armed, or to cancel the pre-arm error condition that prevents arming. Solid - safety switch has been pressed, motors and servos are able to move once the vehicle is armed. Configure the Safety Switch BRD_SAFETY_DEFLT = 0 to disable the switch for systems not equipped.(BRD_SAFETYENABLE in older firmware versions) BRD_SAFETYOPTION. This bitmask controls the behavior of the safety button. It allows you to control if the safety button can be used to enable the safety safety state and/or disable it, and whether the button is only active when disarmed, and to force entry back to the safety on state when you disarm. The default behaviour is for the button to enter or exit the safety state, only when disarmed. BRD_SAFETY_MASK can be used to set which individual channels remain enabled with the safety switch. This allows limited control surface movements to check correct operation on the ground. Motor outputs will remain disabled in all stabilized flight modes. Part 2: The Relay Driver (Actuating the Mission) If we want to trigger a payload drop mechanism, we need a relay. The main MCU operates at 3.3V and outputs only a few milliamps. It physically cannot drive a mechanical relay coil directly without burning out the pin. To solve this, I designed an isolated Relay Driver circuit. As seen in my schematic, we use a transistor (Q2 and Q3) as a digital switch. When the MCU sends a HIGH signal to the transistor's gate or base, it turns on, allowing a larger 5V current to flow through the relay coil and activate our payload. One absolutely critical component you will see in my schematic is the 1N4148W flyback diode (labeled D2 and D3). When the relay coil turns off, the collapsing magnetic field generates a massive high-voltage spike that will travel backwards and destroy the transistor or MCU. We place the 1N4148W diode in reverse-bias directly across the relay coil. If you check a standard 1N4148W datasheet, you will see it has an ultra-fast reverse recovery time of just 4ns! This means it acts instantly to clamp and safely dissipate the destructive energy before it can damage the system. You can check on this website for an amazing, highly trusted breakdown of how this transistor logic works: Electronics Tutorials: Relay Switch Circuit. To see exactly what happens to a circuit when you forget this crucial component, you can see in this video from YouTube: Flyback Diodes in Relay Circuits Explained. Part 3: Software Configuration for Missions In ArduPilot, we map the MCU pin connected to our transistor as a "Relay Pin." Once mapped, we can assign an RC channel (Auxiliary Switch) on our radio transmitter to trigger this relay in mid-air. Even better, for autonomous payload dropping missions, we can insert a DO_SET_RELAY command directly into our GPS waypoint mission. The drone will fly to the target coordinate and automatically trigger the hardware we just designed! You can check on this website for the official documentation on setting this up: ArduPilot Relay Switch Documentation.
Power Isolation to Securing the Main MCU with a Dedicated Servo Rail
When designing hardware for custom drones or autonomous vehicles, we often focus on the "brain" of the system, the main Microcontroller Unit (MCU). But no matter how fast your MCU is, it will completely fail if the power supplied to it is dirty or unstable. Today, we are going to talk about one of the most critical power design rules in drone hardware: physically separating the "thinking" from the "moving" by securing the main MCU with a Dedicated Servo Rail. Back-EMF and Voltage Spikes In a drone system, the flight controller must constantly command motors (via ESCs) and physical servos. These are heavy inductive loads. When a servo motor moves rapidly, abruptly stops, or reverses direction, the magnetic coils inside it act like a generator. They shoot a high-voltage surge of current back into the power line. This is known as Back-EMF (Electromotive Force). If your delicate 3.3V or 5V MCU power rail is directly connected to the same power line as your servos, these sudden voltage spikes can easily reach 8V or more. When this high-voltage transient hits the MCU, it will either instantly reset (causing a mid-air brownout) or permanently destroy the silicon. For a deep technical explanation of how motor inductance causes these destructive spikes, you can check on this website from Pololu: Understanding Destructive LC Voltage Spikes. This image shown exactly how a stable 5V line can violently spike up to nearly 12V when an inductive load is connected! The large capacitor prevents the voltage from changing quite as quickly, yet its high ESR prevents it from drawing as much initial current. Here is the result when we added a 100 uF electrolytic capacitor in parallel with our 10 uF test capacitor: The Schematic Solution: The Dedicated Servo Rail To protect our Flight Controller, we use a strategy called "Power Isolation." If you look at the design of my Flight Controller, the power supply for the MCU (often labeled VCC) and the power supply for the PWM outputs (the Servo Rail) are completely separated. They do not share a 5V source. The MCU Power: The brain gets its clean 5V from our heavily filtered, dual-redundant power module inputs. The Servo Power: The servos get their power from an external BEC (Battery Eliminator Circuit) provided by the ESC or a standalone regulator, which plugs directly into the Servo Rail headers. This is a cropping the "SERVO RAIL" and PWM output pin headers from my Flight Controller schematic. The 5V line on these pins is completely isolated from the MCU's 3.3V and 5V logic rails. By completely separating the positive voltage traces on the PCB, any Back-EMF spikes generated by the servos stay trapped on the Servo Rail. The only things the MCU and the servos share are the PWM signal wires and the Ground Reference (GND). Managing Spikes Even though the MCU is isolated, we still don't want massive voltage spikes bouncing around our Servo Rail, as they can damage other connected peripherals. In professional hardware design, we mitigate this by adding protection components directly to the power rails. For my Flight Controller designs, it is standard practice to place heavy filtering near the power inputs, such as a large electrolytic capacitor combined with smaller ceramic capacitors (like a 10uF and 100nF) placed close to the active components to absorb high-frequency noise. For extreme protection, aerospace and racing drones use TVS (Transient Voltage Suppression) diodes. These diodes act like a pressure relief valve, instantly clamping any voltage spike that exceeds a safe threshold. You can see an incredibly detailed hardware test of how these components protect your drone in this video from Chris Rosser on YouTube: Protect Yourself from ESC Voltage Spikes: Testing Capacitors and TVS Diodes. He hooks up an oscilloscope to a live drone and proves exactly why we need this hardware! Have you ever fried a flight controller because you plugged a servo into the wrong rail? Drop a comment below and share your hardware disaster stories so we can learn from them! ArduPilot Standards: Wiring It Safely This hardware isolation strategy is so critical that major firmware platforms like ArduPilot strictly mandate it in their official documentation. ArduPilot software expects the hardware designer to separate these power domains. You can check on this website for the official ArduPilot hardware wiring guidelines: Powering the Pixhawk. The block diagram below synthesizes an overview of Pixhawk’s power and ESC wiring. In this diagram, a 3DR power module (or equivalent device) powers Pixhawk through its power port (primary source). One power source is enough but obviously not redundant if the power module fails to power this primary source. Therefore the diagram adds a second backup power source via a 5V BEC that wires to Pixhawk’s output servo rail. If the primary source fails, Pixhawk will automatically switch to this second power source.
Implementing FRAM in Flight Controller Architecture
When we design custom hardware for Drone Racing or complex autonomous missions, we often focus heavily on the MCU processing power and the gyro update rates. However, there is a silent workhorse on the board that dictates how fast and reliably we can save critical flight data: the non-volatile memory.
Today, we are going to explore why traditional EEPROM is becoming a bottleneck and how implementing FRAM (Ferroelectric RAM) in my Flight Controller schematic ensures lightning-fast, bulletproof data storage.
The Bottleneck: Why Not EEPROM?
For years, flight controllers used standard EEPROM chips to save PID settings, calibration data, and waypoint missions. While EEPROM is cheap and widely available, it has a major flaw: write speed. Writing data to an EEPROM requires a physical charge pump mechanism inside the silicon, which introduces a delay of several milliseconds per write cycle.
If you are flying a high-speed drone and need to log blackbox data or save parameters on the fly, an EEPROM simply cannot keep up. Furthermore, EEPROMs typically wear out after 100,000 write cycles. In a heavily tested Flight Controller, you can hit that wear-out limit faster than you think.
If you want to understand the deep theory of how traditional memory limitations affect embedded systems, you can check on this paper: https://www.researchgate.net/figure/a-Floating-gate-non-volatile-memory-structure-b-NC-non-volatile-memory-structure_fig2_250308372. They have great articles breaking down the physics behind flash and EEPROM wear-out.
The FRAM Advantage: FM25V02A-GTR
Enter FRAM. Unlike EEPROM, FRAM uses a ferroelectric film to store data. This means it writes data almost instantly as fast as the SPI bus can clock it in.
For my Flight Controller, I specifically chose the FM25V02A-GTR, a 256-Kbit F-RAM chip. According to its datasheet, this chip supports NoDelay writes and an astonishing high-endurance of 100 trillion read/write cycles. It is practically infinite for our use case. Furthermore, it operates incredibly fast, supporting SPI clock frequencies up to 34 MHz.
Take a look at the FM25V02A datasheet. Capture a screenshot of the "Features" section on page 1. This images shown highlights the "NoDelay Writes" and "100-Trillion Read/Write Cycles" bullet points.
Drop a comment if you want me to do a deeper dive into the physics of ferroelectric crystals and how they hold logic states without power!
Wiring the High-Speed SPI Bus
Integrating the FM25V02A into the Flight Controller is straightforward but requires clean, precise PCB routing. Because this FRAM operates at up to 34 MHz, we connect it directly to the fast SPI bus of our MCU.
This images shown the exact routing and support components required for the FM25V02A to function stably.
In my schematic, the FM25V02A chip is connected via the four standard SPI lines: MOSI, MISO, SCK, and M_CS_FRAM (Chip Select). However, there is a lot more going on to ensure stability:
Clean Power: To ensure signal integrity during rapid, high-frequency read/write operations, I placed a 100nF decoupling capacitor (C20) right next to the VDD pin (pin 8) operating at 3.3V.
State Protection: You will notice three 10kOhm resistors (R23, R24, and R25). R25 pulls the Chip Select line high to 3.3V to prevent the FRAM from accidentally activating during the MCU's boot sequence.
Hardware Locking: I also used 10kOhm resistors to pull the WP (Write Protect) on pin 3 and HOLD on pin 7 high to 3.3V. By pulling these high, we tell the chip to always allow writes and never pause communication, ensuring the data stream from the flight controller is never bottlenecked.
Software Integration
Hardware is useless without the right software. When compiling firmware, we must define the storage chip so the MCU knows exactly how to talk to it.
In ArduPilot, FRAM is highly favored for saving parameters and waypoints because the instant write-speed prevents the main flight loop from locking up or hesitating during a write operation. You configure the hardware definitions (hwdef) to map the exact SPI bus and Chip Select pin to the internal FRAM driver.
You can check on this website for the exact ArduPilot developer documentation regarding memory mapping: ArduPilot Storage Allocation.
Designing Dual-Battery Redundancy for High-Reliability Flight Controllers
Hello everyone! Welcome back to another deep dive into my Flight Controller architecture. When we design custom hardware for critical missions or expensive payload-carrying drones, relying on a single power source is a massive risk. A single failed BEC (Battery Eliminator Circuit) or a loose wire can turn a high-tech machine into a falling brick.
Today, we are going to explore the concept of Dual-Battery Redundancy, breaking down the exact components I selected in my Flight Controller schematic to ensure the main MCU never loses power.
The Problem: Single Point of Failure
In a standard setup, your flight controller receives a stable 5V from a single Power Module. The physical connection is usually made via a JST connector. For my design, I selected the SM06B-SRSS-TB(LF)(SN), which is a highly reliable 6-pin SMD connector. It provides a secure locking mechanism that resists the intense high-frequency vibrations of Drone Racing.
But what happens if the regulator supplying that connector overheats and shuts down? The MCU instantly reboots. Mid-air reboots are unrecoverable.
To solve this, professional-grade systems use a concept called "Power OR-ing." This means we provide two separate 5V inputs (Primary and Backup). If the primary fails, the backup takes over instantaneously.
Schottky vs. Ideal Diodes
To safely connect two power supplies together, we need one-way valves so that current doesn't flow backwards from one battery into the other.
1. The Classic Approach: SS34 Schottky Diode
The traditional way to create a redundant supply is using a Schottky diode like the SS34. This diode can handle up to 3A and 40V, making it incredibly robust for raw battery voltage inputs. However, physics has a cost. The SS34 has a typical forward voltage drop of around 0.5V. If your BEC supplies exactly 5.0V, the components downstream will only receive 4.5V.
This Figure shown the "Typical Forward Characteristics" graph from the SS34 datasheet. This shown exactly how much voltage you lose depending on the current draw!
2. The Modern Approach: MAX40200 Ideal Diode
For the critical 5V logic lines where every millivolt matters, I implemented the MAX40200AUK+T. This is an "Ideal Diode." It is not a standard diode, but rather a specialized IC that controls an internal MOSFET.
The result? It acts like a one-way valve but with an ultra-low voltage drop of just 43mV at 500mA! This ensures the MCU gets a clean, full 5V supply without the thermal waste of a traditional diode.
To ensure this transition between power supplies is smooth and free of voltage spikes, I placed 10uF and 100nF decoupling capacitors as close to the IC output pins as possible.
If you want to understand the deep theory behind combining power supplies and the advantages of Ideal Diodes over Schottkys, you can check on this website: Texas Instruments Application Note on Basics of Power OR-ing.
Drop a comment below if you want me to do a dedicated tutorial comparing the thermal dissipation of the SS34 versus the MAX40200 under a heavy 2A load!
Software Integration: Monitoring the Backup via PA4
Having redundant power is great, but your Flight Controller also needs to know if the primary battery has failed so you can land immediately.
To do this, we must route the raw voltage into the ADC (Analog-to-Digital Converter) of our MCU. In my schematic, I use a precise 10kOhm sampling resistor to step down the voltage safely, feeding directly into MCU pin PA4.
Firmware like ArduPilot actively reads the analog value on pin PA4. If the primary power source drops below a safe threshold, the software can trigger an RTL (Return to Launch) failsafe, saving your drone while it runs safely on the backup power routed through our MAX40200.
To show how this looks in software, This a screenshot from the ArduPilot wiki, specifically the "Power Module Configuration" page: ArduPilot Dual Battery Setup. You can also see in this discuss VTOL Plane 4+1, Dual Battery setup - ArduPlane / VTOL Plane - ArduPilot Discourse
Conclusion
Integrating dual-battery inputs using a combination of rugged SS34 diodes for high voltage and highly efficient MAX40200 ideal diodes for logic voltage adds a critical layer of safety to your Flight Controller. By adding proper 10uF and 100nF filtering and routing the voltage divider to PA4, we create a complete hardware-software safety net.
Deep Dive into On-Board Heater Circuits
Hello everyone! Welcome back to another deep dive into my Flight Controller architecture. When designing hardware for high-performance Drone Racing, we often obsess over MCU clock speeds or gyro update rates. But there is a hidden enemy to stable flight that many designers overlook: Temperature changes. Today, I am going to walk you through the On-Board Heater Circuit in my schematic, explaining why it exists, how the hardware works, and how the software controls it. The Invisible Enemy: Thermal Drift Inside your flight controller's IMU (Inertial Measurement Unit), there are microscopic mechanical structures. As your drone flies, the ambient temperature changes. As the temperature of the silicon changes, these microscopic structures expand or contract, causing the zero-point of your gyro and accelerometer to shift. This is called Thermal Drift. For the my Flight Controller, I am utilizing high-end IMUs like the ICM-42688-P and the industrial-grade IIM-42652. If you look at the ICM-42688-P datasheet on the Gyroscope Specifications table, you will see that the Gyro Offset Temp Stability is +/- 5 mdps/C. Meanwhile, the IIM-42652 datasheet specifies a wide operating range of -40C to +105C with exceptional temperature stability. This Figure shown the Gyroscope Specification table from ICM-42688-P to show you the exact "Gyro Offset Temp Stability" row For the IIM-42652, this image shown on page 11 highlights its robust temperature rating (+105 deg C) If your flight controller thinks it is rotating just because the IMU got colder, your drone will drift in the air, ruining your racing line. HEATER Circuit To solve this, we artificially heat the IMUs to a constant temperature (usually around 45C to 60C) so that the silicon never experiences temperature swings. Here is the "HEATER 5V" section from my Flight Controller schematic. This image shows the MOSFET and the resistor array highlighted). 1. The Heating Elements To generate heat, I am using standard SMD resistors. When current passes through a resistor, it dissipates power as heat (P = I^2 x R). By placing multiple resistors closely grouped around the ICM-42688-P and IIM-42652 on the PCB, we create a thermal footprint. 2. The Switching Mechanism (MOSFET) We cannot just hook the resistors directly to the 5V line, or they would heat up continuously. We need a switch. In my schematic, I use an N-Channel MOSFET. The Gate of this MOSFET is connected to a PWM-capable pin on the Main MCU. When the MCU applies a HIGH signal, the MOSFET turns on, allowing current to flow from the 5V rail, through the resistors, and into GND. If you want a great refresher on how MOSFETs act as solid-state switches in circuits like this, you can check on this website: SparkFun's Tutorial on Transistors. They have a fantastic interactive diagram in the "Applications: Switches" section. Drop a comment below if you want me to do a separate post on how to calculate the exact power dissipation and choose the right wattage rating for your SMD heating resistors! PID Temperature Control Hardware is only half the battle. How does the flight controller know when to turn the heater on? Both the ICM-42688-P and IIM-42652 have internal temperature sensors. The MCU reads this temperature via the SPI bus. Firmware like ArduPilot or Betaflight takes this temperature reading and feeds it into a dedicated PID loop specifically for the heater. If the IMU is too cold, the MCU increases the PWM duty cycle to the MOSFET Gate, pushing more current through the resistors. If the IMU reaches the target, the MCU lowers the PWM duty cycle. This Image shown the target temperature configuration parameters directly from Ardupilot IMU Temperature Calibration. This image shows exactly what the user sees when configuring the heater. Conclusion By integrating a simple N-Channel MOSFET and a few strategically placed resistors, the flight controller actively fights thermal drift at the hardware level. This ensures that the data from our ICM-42688-P and IIM-42652 is rock-solid.
CAN Bus (Part 2)
This is my schematic version, using TJA1051T For a deep dive into why this resistance matters, check out this video on YouTube: https://youtu.be/fVy_EXkMKMg DroneCAN: The Software Layer Hardware is only half the battle. To make everything talk nicely, we use DroneCAN (formerly UAVCAN). It is an open-source, decentralized protocol that allows your FC to manage multiple nodes without the CPU overhead of a master-slave relationship. Official Website: Visit https://dronecan.github.io/?hl=id-ID to see the full specification. ArduPilot Integration: ArduPilot has a comprehensive https://ardupilot.org/copter/docs/common-uavcan-setup-advanced.html?hl=id-ID that explains how to configure your parameters to recognize CAN-based GPS and Compass modules. Drop a comment if you want to see the specific C++ code I use to initialize the CAN peripheral on an STM32. it's a bit more involved than a standard UART setup! Practical Implementation Tips Twisted Pairs: You should always twist your CANH and CANL wires together. This ensures that any noise that hits the wire hits both lines identically. I recommend at least 30 twists per meter. Cable Routing: Never run CAN wires perfectly parallel to your high-current battery leads. Cross them at 90-degree angles if you must. Help Me Help You: The Layout File To give you a truly high-quality review of your EMI performance, I need you to export your PCB Layout file (the .json or Gerber files from EasyEDA) and send it to me. While the schematic looks great, the Layout is where the "Silent Power Rails" and "CAN Integrity" live or die. If I can see your trace routing, I can give you a "Pro" checklist on: Ground plane separation for the LIS3MDL. Differential pair routing for your CAN lines. Placement of your 22uF and 10kOhm components relative to high-speed lines. Are you planning to run your LIS3MDL compass via the on-board I2C, or are you moving it to an external CAN node to get it further away from the motor interference?
CAN Bus (Part 1)
Why CAN? (The Differential Advantage)
In many DIY builds, I2C is the default because it’s easy. However, I2C was designed for "chip-to-chip" communication on a single PCB, not for running wires across a drone frame. On a drone, long wires act like antennas, picking up massive electromagnetic interference (EMI) from your motors.
CAN (Controller Area Network) is different. It uses Differential Signaling. Instead of one signal wire, it uses two: CAN High (CANH) and CAN Low (CANL). The receiver only cares about the difference between them. If noise hits the wire, it usually hits both equally, and the difference remains the same.
CAN allows for four different message types. They are the data frame, remote frame, overload frame, and error frame. A standard CAN data frame makes use of the identifier, the data, and data length code, the cyclic redundancy check, and the acknowledgment bits. Both the RTR and IDE bits are dominant in data frames. If the recessive acknowledge bit at the receiving end is overwritten by a dominant bit, both the transmitter and receiver recognize this as a successful transmission.
A CAN remote frame looks similar to a data frame except for the fact that it does not contain any data. It is sent with the RTR bit in a recessive state; this indicates that it is a remote frame. Remote frames are used to request data from a node. When a node detects an error in a message on the CAN bus, it transmits an error frame. This results in all other nodes sending an error frame. Following this, the node where the error occurred retransmits the message. The overload frame works similarly but is used when a node is receiving frames faster than it can process them. This frame provides a time buffer so the node can catch up.
That figure shows a simplified version of a CAN transceiver's output and input. The '101' bitstream is coming from/going to a CAN controller and/or microcontroller. Notice that when the controller sends a stream of bits, these are complemented and placed on the CANH line. The CANL line is always the complement of CANH. For arbitration to work, a CAN device must monitor both what it is sending and what is currently on the bus, i.e., what it's receiving.
The figureshows both the CANH and CANL signals simultaneously so that you can see the CAN bus in action. Plotted below the bus signals is the differential voltage that corresponds to the dominant and recessive states of the CAN signals. The first three segments in time, t1–t3, are drawn to match up with the three bits shown above in Figure 5. We will look at this from the perspective of the output driver. The driver's input initially sees a '1' and complements this to a zero, which is placed on CANH. CANL sees the complement of CANH and goes high. This is shown as t1 in Figure 6. Notice that the CANH and CANL voltages are offset from one another. During time t1, CANH – CANL is very close to zero, since CANH and CANL are almost the same voltage. This period, where the driver is sending a logic '1' resulting in CANH and CANL being close to the same voltage, is what we call the CAN recessive state.
The next bit sent is a '0'. CANH gets its complement and CANL again gets the complement of CANH. Notice this time that the CANH and CANL voltages are not close to one another. Therefore, the differential voltage (VDIFF) is larger. This is the CAN dominant state. We say that the logic is inverted because a '1' takes the bus low and a '0' brings it high. The input receiver works in a similar fashion.
You can see the visual explanation of this noise rejection on the All About Circuits website in their Introduction to CAN Bus https://www.allaboutcircuits.com/technical-articles/introduction-to-can-controller-area-network/.
Drop a comment if you have ever had a "frozen" I2C bus mid-flight. it’s usually because of the noise.
The Hardware: Transceivers and Termination
Looking at your schematic, I see we’ve moved beyond simple logic levels. Your STM32 can't talk to the CAN bus directly; it needs a "translator" called a Transceiver.
The SN65HVD230 Transceiver
This chip converts the 3.3V digital signals from your MCU into the differential voltages required for the bus.
Check the Datasheet: You should download the SN65HVD230 datasheet from Texas Instruments.
This diagram illustrates the typical application circuit from Reddit https://www.reddit.com/r/PrintedCircuitBoard/comments/jcgqch/sn65hvd230_can_transceiver_breakout/?rdt=61456
The 120Ohm Termination Rule
High-speed signals on a bus can "reflect" back when they hit the end of the wire, like a wave hitting a wall. This causes data corruption.
The Fix: You MUST place a 120Ohm (2 x 60Ohm) resistor at the two physical ends of your bus.
In your FC: I noticed your design includes a termination header. This is perfect.
The AMS1117, is it Good Enough for Your Flight Controller?
In my journey building flight controllers, I have seen many designers default to the AMS1117. While it is a "workhorse" for basic digital projects, using it to power a precision flight controller is like putting a noisy lawnmower engine into a luxury car.
If you want your EKF to be stable and your sensor to be accurate, you need a "Silent" power rail. Here is how I explain the shift from basic regulation to professional power integrity.
The AMS1117 Problem: Why it is "Dirty"
The AMS1117 is a linear regulator, but it is not a "Low-Noise" regulator. For a drone engineer, it has three major flaws:
High Dropout Voltage: It usually requires about 1.1V to 1.3V of "headroom." If your battery drops, your 5V rail might dip, causing your 3.3V sensor rail to brown out.
Poor PSRR: Power Supply Rejection Ratio (PSRR) measures how well the LDO blocks noise from the input (like ESC switching noise). The AMS1117 has a low PSRR at high frequencies where motors operate.
High Output Noise: It generates its own internal electrical "hiss" which can confuse the sensitive ADCs in your IMU.
Ultra-Low Noise LDOs
When I design a professional FC, I look for LDOs specifically marketed as Ultra-Low Noise or High PSRR. Examples the LP5907 or MIC5219.
You should look for:
PSRR (dB): Look for values above 60dB or 70dB at 10kHz. This tells you the LDO is an active filter against motor noise.
Noise (uVRMS): A silent LDO should have an output noise below 10uVRMS (from 10Hz to 100kHz).
Accuracy: Look for 1% or 2% output voltage accuracy to ensure your sensors always see exactly 3.3V.
This images shown the PSRR vs. Frequency graph in an LDO datasheet. This curve illustrates how effectively the regulator blocks noise at different motor RPM frequencies.
Designing the "Silent" Rail Architecture
An LDO alone is not enough. You must build a Pi-Filter (C-L-C) to protect your sensors.
Here is the standard implementation I use for the 3.3V rail. The Component Recipe:
Input Bulk Capacitor:22uF tantalum or high-quality ceramic. This handles the "big" ripples from the main battery.
The Ferrite Bead: Use a 10uH or 600Ohm (at 100MHz) ferrite bead between the LDO and the sensor. This acts as a wall against high-frequency RF noise.
Output Decoupling: Use a combination of 10uF (for stability) and 100nF (for high-frequency spikes).
Layout
In my experience, the schematic is only 50% of the work. The other 50% is the PCB Layout.
Ground Planes: Use a solid Ground Plane. Do not "snake" your ground traces.
Kelvin Sensing: Place your output capacitors as close as humanly possible to the Vdd pins of your IMU and Compass.
Isolation: Keep the noisy AMS1117 (if used for LEDs or non-critical parts) on a completely different side of the board from your sensor LDO.
VFLGA-12 package outline and pin indicators to assist in correct PCB footprint design.
Recommended Resources
Professional Websites
TI Precision Hub: An incredible resource for learning about LDO noise. Texas Instruments - LDO Noise Demystified
Analog Devices (ADI) Education: Deep dives into PSRR and power integrity. Analog Devices - Power Management Design
Journals and Papers
"Power Supply Noise Reduction in Sensor Systems": Search this on** IEEE Xplore**. It explains why high-frequency noise causes "bias instability" in gyroscopes.
"System-on-Chip (SoC) Power Integrity": While advanced, this journal content explains the importance of decoupling capacitors like the 22uF and 100nF combo I mentioned.
Kalman Filter in for State Estimation in UAV
In my previous guide, I showed you how to design a high-redundancy Flight Controller (FC) using 2 IMUs and 2 Barometers. But having multiple sensors is useless if the "brain" doesn't know how to merge their data. If one IMU is vibrating and one Barometer has a pressure spike, which one should the drone trust?
This is where the Extended Kalman Filter (EKF) comes in. It is the gold standard for state estimation in modern UAVs.
What is EKF and Why "Extended"?
A standard Kalman Filter works perfectly for linear systems. However, drones are non-linear; rotating a drone by 90 degrees involves trigonometry (sin, cos), which creates curves, not straight lines. The Extended part of the EKF uses a mathematical trick called "Linearization" (usually via a Jacobian matrix) to handle these complex movements.In your custom FC, the EKF performs three main tasks:
Estimation: It guesses the drone's position, velocity, and orientation (Attitude).
Prediction: It uses your IMUs (Accelerometer and Gyroscope) to predict where the drone will be in the next millisecond.
Correction: It compares that prediction with "Truth" sensors like your Compass, GPS, and Barometers to fix any errors.
This images shown the basic loop of a Kalman Filter: Predict (Time Update) and Correct (Measurement Update).
Managing 2 IMUs and 2 Barometers
When you have a redundant setup like the one I designed, the EKF becomes a "Manager." Most advanced firmwares (like ArduPilot or PX4) actually run multiple EKF instances simultaneously.
IMU Blending
The EKF calculates the Innovation for each IMU. Innovation is simply the difference between what the IMU says and what the other sensors (GPS/Baro) expect.
If IMU1 has high vibration, its Innovation Variance will increase.
The EKF will automatically "weight" the data more toward IMU2.
This prevents a single sensor failure from causing a "flyaway."
Barometer Voting
With 2 Barometers, the EKF compares the pressure altitude. If one Barometer is placed near a hole in the frame and experiences "wind buffeting," the EKF detects the noise and relies on the cleaner Barometer.
Key Parameters for Your Code
When programming your EKF, you need to define Noise Density for your specific hardware. For example, if you are using an ICM-42688-P or MPU6000, you should look at the "Spectral Noise" section of the datasheet.
Parameter
Recommended Value (Standard Units)
Gyro Noise
0.005 deg/s/sqrt(Hz)
Accel Noise
0.5 m/s/s
Baro Noise
2.0 meters
EKF Period
10ms
If you use a decoupling capacitor like a 22uF or 100nF near the IMU power pins, you can lower the "Noise" value in your EKF code, making the drone much "snappier" and more stable.
This images shown the Noise Density table in an IMU.
Implementation Resources
To truly master EKF for your project, I highly recommend studying these professional resources:
Technical Documentation
ArduPilot EKF3 Wiki: The best practical guide on how EKF handles multiple IMUs.
Website: https://ardupilot.org/dev/docs/ekf.html?hl=id-ID
PX4 Estimation Guide: Excellent explanation of the 24-state EKF.
Website: https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf
Journals and Academic Papers
"A New Approach to Linear Filtering and Prediction Problems" by R.E. Kalman (1960). This is the foundational paper.
Compass in Flight Controller? Is it Necessary?
Building your own Flight Controller (FC) is a major milestone for any drone engineer. While gyroscopes and accelerometers (the IMU) provide stability, a magnetometer often called a digital compass to provides the "sense of direction" necessary for autonomous flight. Here is a guide on why and how to integrate the LIS3MDL magnetometer into your custom flight controller project. Why Do You Need a Compass in a Flight Controller? A gyroscope can calculate orientation, but it suffers from drift over time. Without a reference point, the drone's heading (Yaw) will slowly rotate in the software even if the drone is pointing straight. Heading Accuracy: The magnetometer uses the Earth's magnetic field to provide an absolute North reference. Autonomous Navigation: For features like "Return to Launch" (RTL), Position Hold, or Waypoint missions, the FC must know exactly which way it is facing to move toward a coordinate. GPS Limitation: A GPS can tell you where you are and your ground speed, but it cannot tell you which way the drone is "nose-in" while hovering. This image illustrates that a drone can move forward while facing sideways; the compass tells the FC the "facing" direction. The Challenge: Magnetic Interference The biggest mistake in FC design is placing the magnetometer "on-board" near high-current components. High-Current Wiring Effects: According to the LIS3MDL datasheet, high current in wiring and printed circuit traces can cause significant errors in magnetic field measurements. The 10mA Rule: Conductor-generated magnetic fields add to the Earth’s field. You must keep currents higher than 10 mA at least a few millimeters away from the sensor. EMI Sources: Motors, ESCs, and battery leads create massive electromagnetic interference (EMI). Design Pro-Tip: Follow the "Cube Orange" or "Pixhawk" architecture. They often use a multi-PCB stack where the sensitive sensors (like the LIS3MDL) are separated from the power distribution and noisy IoT/Microcontroller logic. LIS3MDL Magnetometer The LIS3MDL is an ultra-low-power, high-performance 3-axis magnetometer. It is ideal for custom FCs due to its flexibility. Key Specifications: Selectable Full Scales: ±4/±8/±12/±16 gauss. Digital Interfaces: Supports both I2C (standard and fast mode) and SPI interfaces. Operating Voltage: 1.9 V to 3.6 V. Resolution: 16-bit data output. Hardware Installation & Schematic Guide To integrate the LIS3MDL into your flight controller, follow the standard I2C implementation as shown in my provided schematic. Wiring the LIS3MDL (I2C Mode) To enable I2C mode, the CS (Chip Select) line must be tied high to Vdd_IO. Pin # Name Function Connection 1 SCL/SPC I2C Clock To MCU SCL 11 SDA/SDI/SDO I2C Data To MCU SDA 10 CS Mode Select Tie to 3.3V (Logic High) 9 SDO/SA1 Address Select Tie to GND or 3.3V Critical External Components Decoupling Capacitors: You must connect a 100nF capacitor (C1) between pin 4 and GND. Additionally, the Vdd line requires a 100nF high-frequency ceramic capacitor and a 1uF low-frequency electrolytic capacitor. Pull-up Resistors: Both SCL and SDA lines must be connected to Vdd_IO through external pull-up resistors (typically 2.2kOhm to 10kOhm. My schematic uses 2.7kOhm (R8, R9), which is excellent for Fast Mode I2C. This diagram in the datasheet provides the "golden standard" for your PCB layout. Using an External Compass (GPS Combo) If your on-board PCB layout is too cramped or noisy, the standard industry practice is to use an External Compass. Most modern drone GPS modules (like those based on the u-blox M8N or M10) include an internal magnetometer. The Technique: You bypass the on-board LIS3MDL and connect the I2C wires (SCL/SDA) from the GPS module to your FC's I2C port. Placement: The GPS/Compass is then mounted on a "GPS Mast" high above the motors and battery. Software Configuration: In firmware like ArduPilot or PX4, you simply select the "External" compass as the primary (Compass 1) and disable the "Internal" one to avoid interference. Resources Official Datasheet: STMicroelectronics LIS3MDL Product Page. Journal/Documentation: Refer to the ArduPilot Compass Calibration Guide for details on how to handle "Soft Iron" and "Hard Iron" offsets in your custom code. PCB Design Jurnal: Search for "Minimizing magnetic interference in small UAVs" on IEEE Xplore for academic papers on trace routing for magnetometers.
Why Your Next Build Needs Redundant Barometers (Going Dual Barometers)
Today, we are taking a significant step forward into professional-grade system design. When I am designing a flight controller for high-value applications like expensive cinema cameras or critical long-range missions relying on a single, tiny hole to tell me how high the drone is, is a risk I am rarely willing to take.
The solution? Sensor Redundancy. I highly recommend integrating a Dual Barometer setup.
1. Why Using Two Barometers?
Why two barometers? As every seasoned embedded systems engineer knows, the question isn't if a sensor will fail, but when. Barometers are exposed to the environment. I have tried flying single-baro drones in challenging conditions, and I have seen them nearly crash because a tiny insect blocked the sensor port or a localized thermal pocket gave a false reading.
You can see in various robotics and automotive safety journals (like those from the IEEE Robotics and Automation Society) regarding fail-safe systems, which show that redundancy is the primary defense against localized sensor error. When your firmware (like Ardupilot) detects a discrepancy between two sensors, its Advanced Kalman Filter (EKF) can identify the erratic sensor, isolate it, and seamlessly switch the primary altitude source to the healthy barometer, all while the drone is in flight. Without redundancy, if one baro fails, the drone might violently shoot upward or crash into the ground.
2. Hardware Implementation: Taming the Dual SPI Bus
The biggest challenge in adding a second sensor is pin management. If you used I2C for both barometers, you would run into address conflicts unless you used two separate I2C buses, wasting precious MCU resources.
This is where my previous advice on using SPI really pays off. SPI is a "bus" protocol. As seen in the detailed schematic I have generated below (Image 1), both BARO1 and BARO2 (two BMP388s) share the exact same Serial Clock (SCK), Master Output Slave Input (SDI), and Master Input Slave Output (SDO) lines back to the MCU.
Image 1: SPI Schematic for Dual BMP388 Barometers
The crucial difference is the Chip Select (CSB) lines. BARO1 connects its CSB pin to the CSB_BARO1 net label (pin PA4), and BARO2 connects its CSB pin to CSB_BARO2 (pin PA5). I recommend specifying unique net labels for each CS pin in your firmware configuration. When the firmware needs data from Baro 1, it only pulls CSB_BARO1 low. When it needs Baro 2, it pulls CSB_BARO2 low. It is a highly efficient way to manage multiple high-speed sensors.
3. PCB Layout Strategy for Sensor Isolation
Signal integrity isn't enough when you have redundant sensors; you need to worry about localized environmental noise. Beginners often make the mistake of placing the two barometers right next to each other to simplify routing. I strongly advise against this.
If both sensors are in the same spot, they will likely both be affected by the same problem (like localized ESC heat or prop wash). I have tried physically separating the sensors, and it yields much more robust data.
In the PCB 3D render I have generated for you (Image 2), you can see my recommended placement strategy. I place BARO1 on one corner of the board and BARO2 on the diagonally opposite corner. While this requires longer SPI trace routing (which means you must be careful about keeping them away from noisy motor traces), it guarantees that localized interference affecting one sensor (like sunlight hitting one side) will not equally affect the other.
Image 2: Optimized PCB Layout for Diagonal Barometer Separation
Firmware
Once your hardware is built with two barometers, the firmware configuration becomes vital. Ardupilot is fantastic at handling dual baros. You can see on the Ardupilot Wiki and hardware documentation regarding multi-sensor setups, which show that the Extended Kalman Filter (EKF) is specifically tuned to manage redundant sources.
When setting this up, you must ensure that your firmware configuration accurately defines BARO1_DEVID and BARO2_DEVID to point to the correct SPI buses and CS pins. This tells the flight controller exactly where to look for each physical sensor.
When testing in your Ground Control Station (like Mission Planner), I recommend opening the Status tab and watching the live data feeds for baro1_alt and baro2_alt. When you lift the flight controller, both values should move upward together. There will always be a slight deviation between the two readings due to minute manufacturing tolerances, but they must be consistent and follow the same general curve. This validation proves that your redundant hardware is working and that the firmware is correctly receiving data from both independent sources before you trust it in the air.
Introduction to Barometer for Flight Controller (Part 2)
Signal Integrity & PCB Layout Tips This is the stage where many beginners fail. A barometer is a highly sensitive mixed-signal component. You can see in the book High-Speed Digital Design by Howard Johnson regarding this, which shows that placing sensitive analog sensors near high-voltage switching regulators (like a high-power BEC) will destroy your Signal Integrity and make the barometer data incredibly noisy. Based on my real-world testing, here are the mandatory tips I recommend: Dedicated LDO: Use a separate 3.3V Low-Dropout Regulator (LDO) specifically to power your sensors. I have tried sharing the barometer's power supply with the MCU or camera OSD, and it always results in unstable data. Decoupling Capacitors: Place a 100nF and a 4.7uF ceramic capacitor as close as physically possible to the VDD and VDDIO pins of the BMP388 IC. This absorbs sudden voltage spikes. Keep Away from Heat: The main MCU gets very hot, and air pressure readings are affected by ambient temperature. Always position the BMP388 far away from the main processor on your PCB layout. Firmware Once the hardware is fully assembled, the software needs to know where the sensor is located. I won't mention the specific secret configuration files behind the scenes, so let's just refer to this as your firmware configurations. When you are utilizing advanced firmware like Ardupilot, you must declare exactly which SPI bus the barometer is connected to, along with its specific Chip Select pin. You can see in the Ardupilot Hardware Documentation regarding this, which shows that as long as your SPI routing is correct and the firmware configurations are properly defined, the system will automatically detect the BMP388 during the boot process. My Tip: I always recommend testing your sensor through a Ground Control Station (like Mission Planner) before doing a real flight. Simply lift your flight controller from the floor to your desk while watching the altitude graph. You should see a perfectly smooth curve moving upwards!
Introduction to Barometer for Flight Controller (Part 1)
Welcome back to the workbench! If the IMU is the "inner ear" of your drone that handles balance, the Barometer is its sense of altitude. For anyone designing a Flight Controller (FC) from scratch, getting the barometer right is the difference between a drone that holds its height perfectly and one that randomly shoots into the sky or crashes into the ground. Today, I am going to walk you through everything you need to know about integrating a barometer into your FC, specifically focusing on the Bosch BMP388. I have tried many sensors over the years, and this is currently one of my top recommendations for modern drone builds. What Does a Barometer Actually Do? At its core, a barometer measures atmospheric pressure. As your drone flies higher, the air gets thinner, and the pressure drops. The flight controller reads this tiny drop in pressure and calculates how high the drone is off the ground. Older drones relied heavily on GPS for altitude, but GPS altitude is notoriously inaccurate (it can drift by meters!). A good barometer like the BMP388 gives you centimeter-level precision. When you switch your drone into "Altitude Hold" or "Loiter" mode, the firmware relies on this sensor to keep the drone perfectly level in the air. Introducing BMP388 Reference: BMP388 data sheet If you are upgrading from older chips like the BMP280 or MS5611, the BMP388 is a massive leap forward. Here is why I highly recommend using it in your next design: Incredible Accuracy: It has a relative accuracy of 8 Pascals, which translates to an altitude variance of just 0.66 meters. In practice, with good filtering, it feels locked in. Built-in IIR Filter: It has an Infinite Impulse Response (IIR) filter built right into the silicon. This means it can smooth out sudden spikes in pressure before the data even reaches your MCU. Low Power & Small Footprint: It comes in a tiny 10-pin LGA package, saving precious PCB space. Communication The BMP388 supports both SPI and I2C. However, for a flight controller, I strongly recommend using SPI. You can read in embedded systems journals (like the IEEE transactions on Embedded Computing) that the I2C bus is prone to "locking up" in high-noise environments. If your I2C bus locks up mid-flight, the drone loses its altitude awareness and might drop out of the sky. SPI does not have this vulnerability because it uses dedicated push-pull lines without the need for pull-up resistors. CSB Pin: Connect this to your MCU for Chip Select. SDI/SDO/SCK: These are your standard SPI data and clock lines. I have utilized the high-speed 4-wire SPI configuration for the BARO1 (BMP388). You can clearly identify the interface signals: Serial Clock SCK is routed to pin 2 and tied to the SCLK net; Serial Data Input SDI, serving as the MOSI line, is handled by pin 4 via the SDA_MOSI net; and Serial Data Output SDO, acting as the MISO line, originates from pin 5 on the SDO_MISO net. To manage bus activation, Chip Select CSB, which is an active-low signal, utilizes pin 6 and connects to the CSB_1 net label. By defining this specific CSB_1 net within your firmware, you instruct the MCU to pull this line to 0V only when it intends to communicate with this specific barometer. I have tried minimal decoupling configurations in the past, and I have always found them to be highly problematic, leading to unstable altitude readings. Therefore, in this configuration, I have utilized bulk and bypass decoupling capacitors in parallel on Pin 10 (VDD). Specifically, I have implemented C19, which is a 100nF ceramic capacitor for high-frequency noise suppression, and C20, a larger 4.7uF bulk capacitor to stabilize lower-frequency voltage dips, both referenced to GND. This dual-capacitor approach is essential to maintain a rock-steady reference voltage for the internal ADC during conversion cycles. Finally, you can see from the wiring that I recommend tying all available VSS (Ground) pins (pins 3, 8, and 9) directly to the digital ground plane (GND). This technique reduces the chip's internal ground loop impedance and minimizes digital switching noise from affecting sensitive analog pressure measurements. Note that pin 7 (INT) is correctly left floating (No Connect), which aligns with my recommendation to simplify the sensor interfacing for the main flight controller processor.
Inertial Measurement Unit (IMU) in Flight Controller Application (Part 2)
Add 2 or 3 IMUs in Flight Controller Have more than 1 IMU in Flight controller sound the best practical solution instead of using only 1 IMU because it can be increase their stabilization and accuracy right? Is it possible? The answer is YES. Since the IMU using a SPI communication, you can added more than 1 IMU into your Flight Controller. This is the example that if you use 2 IMUs configuration. The question is, How this can be programmed into our Flight Controller? You can programmed based on C++ on STM32CubeIDE, but you should refering to Ardupilot and define into your firmware what the IMU Series that you used in your flight controller. But remember, don't you use the same series an IMU. I recomened you use different IMU and select it based on the best practical used from their manufacture and datasheet. for example IIM-42652 has industrial grade standrad for the main IMU, ICM-42688P is the accurate IMU sensor to compare the data. For the fusion both of two IMU, you should use the Kalman Filter. A Kalman filter enhances IMU data by optimally combining sensor measurements and system dynamics to reduce noise and improve estimates of orientation, velocity, and position. If you want to refer on Industrial Flight controller that used 2 or 3 IMUs, this is Cube Orange Plus for the example from Ardupilot website. The Cube Orange/+ With ADSB-In Overview — Copter documentation Cube Orange Plus use 2 IMU in their Board (Invensense ICM42688 IMU and ICM20948 IMU/MAG), looked into Specification on the website. Choosing the Right IMU for Your Application When selecting an IMU, consider the following factors: Degrees of Freedom (DoF) – Most IMUs come in 6-DoF (accelerometer + gyroscope) or 9-DoF (accelerometer + gyroscope + magnetometer) configurations. Accuracy & Sensitivity – Higher-end IMUs provide lower drift and better precision. Power Consumption – Critical for battery-powered applications like wearables and drones. Interface Compatibility – Ensure compatibility with microcontrollers, SoCs, or FPGA-based systems. 6 Axis vs 9 Axis IMU The 9 Axis maybe sound better than 6 Axis for Flight Controller IMU right? But it doesnt necesarry at all, it depends on your necessity. 6 Axis: three-axis (XYZ) accelerometer + three-axis (XYZ) gyroscope (also called angular velocity sensor) 9 Axis IMU (AHRS) Combines Accelerometer, Gyroscope, and Magnetometer (3+3+3 axes) to provide total orientation (Roll, Pitch, Yaw). They used Algorithms (Kalman Filter, Madgwick) to fuse data: Accel gives gravity vector (Roll/Pitch), Mag gives North (Yaw), and Gyro provides fast updates and smoothing. For the example, the 9 Axis IMU is using for VR/AR tracking, sophisticated drone control, robot localization, etc. So 6 Axis module can form VRU (Vertical Reference Unit) and IMU (Inertial Measurement Unit), 9-axis module can form AHRS (Attitude Reference System). LSM9DS1 is the example for 9 Axis IMU, it combines 3D accelerometer, 3D gyroscope, 3D magnetometer into single chip. lsm9ds1.pdf The 9-axis IMU is a key component of advanced sensor fusion, forming the foundation for accurate insights across various applications. By integrating sensor fusion software and AI algorithms, industries can achieve higher standards of accuracy and efficiency. Pro Tips To make your guide even more valuable for beginners, consider adding these "Flight Controller" secrets: Power Integrity (The LDO Factor): Mention that IMUs are extremely sensitive to power noise. Beginners should use a dedicated Low-Dropout Regulator (LDO) with high PSRR (Power Supply Rejection Ratio) specifically for the IMU to prevent "gyro drift" caused by noisy power from the motors. Trace Routing: Advise them to keep the SPI traces as short as possible and to keep them away from high-current paths (like the battery leads or ESC signals) to avoid electromagnetic interference (EMI). Mechanical Orientation: Remind them to look for the small dot on the chip. In the drone world, the orientation of the IMU on the PCB must be known so that the firmware can be configured to know which way is "Forward" (X), "Left/Right" (Y), and "Up/Down" (Z). The "Ground" Warning: Regarding advice to ground the INT pin add a small disclaimer. Some IMUs might drive that pin HIGH by default; it is safer to suggest a 10k Ohm pull-down resistor rather than a direct short to ground to prevent accidental hardware damage during firmware boots.
Inertial Measurement Unit (IMU) in Flight Controller Application (Part 1)
What Is an Inertial Measurement Unit (IMU)? An Inertial Measurement Unit (IMU) is an electronic device that measures and reports acceleration, angular velocity, and sometimes magnetic field data. It typically consists of: Accelerometers – Measure linear acceleration along the X, Y, and Z axes. Gyroscopes – Detect angular velocity to track orientation changes. Magnetometers (optional) – Provide heading data by measuring Earth’s magnetic field. By combining these sensor readings, an IMU can determine an object’s movement and positioning, making it essential for applications requiring precise motion tracking. Application in Flight Controller This is a typical implementation of an IMU within a Flight Controller using EasyEDA. For supporting circuits like decoupling capacitors, you should refer to the "Typical Application" section in the IMU datasheet. In this example, I am using the IIM-42652, an industrial-grade IMU designed for high-performance flight controllers. You can access the datasheet here: IIM-42652 Datasheet(PDF) - TDK Electronics. Most commonly, IMUs in this field use SPI communication instead of I2C due to its superior speed. While SPI requires more pins specifically CS (Chip Select), SDO/MISO, SDA/MOSI, and SCLK the performance trade-off is worth it. Most commmonly IMU are using SPI communication instead of I2C or others. this probably needs more Pins, such as CS, SDO/MISO, SDA/MOSI, SCLK. Maybe you asking for INT and FSYNC why they still connected into a netlabel (which is conneted into MCU). The reason is depend on the IMU that you using for. INT (interrupt) is a digital output pin from the IMU that signals the microcontroller when a specific event occurs, so the MCU doesn't have to constantly poll the IMU, saves CPU time and power by avoiding continuous polling, and the MCU can sleep until the IMU signals new data. You can use this pin when your MCU (especially STM32) still have pins that not used, but if not you can float this pin or connected this pin into the ground (check the datasheet for the best termination), but using it is highly recommended for efficiency. FSYNC (Frame Synchronization) is a hardware pin and feature used to synchronize sensor data sampling with an external event or device. Basicly it Aligns IMU data samples with an external timing reference (e.g., a camera frame, GPS pulse, or another sensor). But you should be looked at Hwdef.dat to see is the IMU compatible with the Ardupilot environment or not. Maybe you asked for why I added Ferrite Bead 600 Ohm in Power Rail input for IMU, which is not enter in the datasheet (see the figure in bottom). The reason is for filtering the circuit from noise suppression. A ferrite bead is not an ideal inductor, its main purpose is not to“reflect noise and block it.”So It works by dissipating high-frequency energy as loss (heat), that is why ringing is reduced and the waveform settles faster. But because of the oscillation, you should know which the frequency that you used in the circuit (is it High or Low Frequency) and find the Capacitor for the Pi-Filter. This is the Figure that shown Pi Filter used a ferrite bead and two 100nF Capacitor. Maybe we can discuss how the Pi Filter work and how to choose the value, connected and layouting them. If youre interested you can watch this video from Robert Ferenac and explained by Eric Bogantin https://youtu.be/HaLMjVkKYMw?si=AxCk40LLvW4WpBE9. But the conclution is, the ferrite bead is important to block the noise thatr can be caused an error data IMU which is can be caused a weird moving into your UAV later.
Make Your Own Flight Controller for UAV
Hi, I'm Adib Fridiansya. My world revolves around the intersection of RF and Embedded Systems, and today, I'm pulling back the curtain on the most critical component of any UAV: the Flight Controller (FC). While the maker community often experiments with Atmega (the 8-bit veteran) or the ESP32 for its built-in connectivity, the industrial drone world has a clear, undisputed gold standard: the STM32 Ecosystem. If you want to design a professional-grade FC, you need to understand the hierarchy of these silicon brains. I've categorized them into three tiers that define the modern drone landscape: STM32F4 (The Reliable Foundation): This is the 'OG' of 32-bit flight. It's the core of the legendary Pixhawk 2.4.8. While it's an older generation, its stability and wide support make it the perfect entry point for embedded flight logic. STM32F7 (The Efficiency Specialist): The F7 series is the 'sweet spot.' It offers a massive jump in processing power with surprisingly low power consumption. This is why you'll find the F7 as the heart of high-end Monitoring and Inspection Drones that require long flight times without sacrificing performance. STM32H7 (The Absolute Beast): This is where things get serious. The H7 is pure, raw power. Its clock speed is so high it can effortlessly manage Dual or even Triple IMU sensors (Gyro/Accel) simultaneously to filter out vibration and ensure rock-solid stability. This is the top-tier choice for heavy-lifters and elite Racing Drones from industry leaders like Matek and The Cube (Orange/Blue). Are you ready to stop buying off-the-shelf boards and start engineering your own? Over the next 30 days, I’m hosting a Deep Dive Series on Flight Controller design from schematic logic to sensor integration.