mike's website

embedded, robots, rust

<<<

Building a Flight Computer from Scratch

This is the first post, hopefully in a series, about building a flight computer from scratch with embedded Rust. When I say from scratch, I really mean it: I’m designing the hardware, the software, the airframe, and the design requirements entirely from scratch.

I have made some progress which is summarized later in this article.

Quick bullets:

I am planning for this to be a glider airframe, optimized for long-term loitering. I think eventually I want to put a camera up there and experiment with computer vision, but that has to come in a year when I have the flight computer working. The reason for a glider is that it’s a combined hardware + software challenge and perhaps a bit different than what most people are doing with their RC airframes.

Why?

The real purpose of this project is to learn. I am focused on the difficult parts: embedded Rust (which after solid year I don’t feel is that difficult), control theory and aerodynamics, and hardware design. I am not too interested in airframe design. There are a few things that I am not trying to do:

Hardware: Current Progress

So far, I have produced 3 hardware prototypes.

Left to Right: v3, v2, and v1 of the baord.

V1 Hardware

The first version of the OllyFC flight computer was designed in late 2023. The units arrived from JLCPCB in January.

Unfortunately, the design had the boot0 pin floating. I’m not sure if this is a critical design flaw, but it is specifically pointed out by probe-rs as an issue that prevents debugging and flashing:

On STM32 series chips, check the state of the BOOT0 pin:

  • If BOOT0 is HIGH or floating, the core will run from internal bootloader instead of flashed firmware.
  • BOOT0 should be pulled LOW for SWD programming, however even if it is HIGH or floating, programming may appear to succeed but firmware will not properly run.

You can see the intended layout.

v1 labeled image

The purple rectangle is sized 30.5mm x 30.5mm, which is the standard size for a drone power distribution board. These are cheap and do the difficult electrical work of converting the high voltage battery power to a stable 5V.

Unfortunately, this board doesn’t work. Lesson learned?

V2 Hardware

I found a number of other issues with the V1 board, so the v2 board was almost a complete redesign. The v2 board has a few differences:

And other various small component changes. The mechanical connection to the 30.5mm x 30.5mm drone PDB is retained.

The PWM IC is the same, but the package changed to a cheaper and more available JLCPCB part.

v2 labeled image

Unfortunately, this board has a critical flaw: the PWM chip has a short across VDD and VSS. So I think what happens is that the current will flow e.g. through extclk, or A0-A5 to ground, instead of through VSS.

Sleep deprivation and no review of the schematic. Bad decisions made.

I knew I had a short, because I could feel the heat from the excess current flowing through the power path IC and the LDO, and eventually found that the component itself was heating up significantly.

This was pretty devastating, because it seemed like a $150 mistake and no additional progress could be made. However, because I opted to use an expensive power path IC, the current was limited which prevented major damage to the other components on the board.

Upon removing the offending IC, the chip powered on and could be flashed. None of the other components were affected. This was great news, becuase I could do bringup on some of the other components while I revised the board.

In hindsight, there were a number of issues with this board, too:

V3 Hardware

The v3 hardware. It seems to be working out of the box so far

After the resounding success of the v2 silkscreen, I went with a significantly more intricate and complex logo for this board, based off of the California Least Tern which is native to San Diego.

larger image

This board is working well so far and is probably pretty close to the finalized product provided there are no bring-up issues.

This board has the following major components:

The u-blox module and differential pressure sensor are both expensive, somewhat unnecessary, and large enough to be soldered on. So I did not have my assembly house do it, instead I am going to purchase those components and do the assembly myself.

A few things were changed on the v3 board:

The back of the v3 board. The buzzer is absolutely enormous. But look at how many test points we have!