Monday, 2 March 2020

Custom Flight Controller Part 3.1: STM32F103 Blue Pill and Other Electronic Components

Finally Part 3! In this part, I will talk about hardware component for my flight controller project. This post focuses on the MCU I chose to be the main processing unit for my flight controller as well as other electronic components I installed on the breadboard to form the complete circuit as my custom flight controller.

As mentioned in previous post, originally I purchased STM32F429 Nucleo board because I intended to run Quaternion Kalman Filter. But it turned out that the Nucleo board is too big for my quadcopter frame. In addition, as mentioned before, Madgwick filter performs equally well and is much more lightweight. There is really no strong reason to use the larger Nucleo board anymore. Therefore, I decided to switch to a much smaller board widely known as the "blue pill" which features STM32F103. Although it does not have a floating point calculation unit and is much slower than STM32F429, it should be still fast enough to run Madgwick Filter. Also, Joop Brokking's YMFC-32 project used it and it seems to suffice for controlling quadcopter.

The figure above shows the pinout for STM32F103 on blue pill. I need one I2C for communication with MPU9250, 4 timer PWM outputs for motor control, two UART communication, one for receiver and another for debug. 

With blue pill, I am able to fit all components on two bread boards and install them on my quadcopter frame. 



Note that the receiver SBUS signal passes through a logic inverter before entering STM32F103. This is because SBUS protocol is inverted. More on SBUS will be described in later posts. 

I purchased an AMS1117 3.3V regulator module to get 3,3V from 5V ESC BEC output to power STM32F103 as well as MPU9250. Receiver is powered directly from 5V. This means that the SBUS signal sent from receiver is 5V. Luckily, UART3 pins of STM32F103 are 5V tolerant. 

For debugging, I purchased FT232RL FTDI USB to TTL Serial converter so that the debug message sent through UART2 can be received by computer through USB. 

For downloading code into STM32F103, instead of the using popular method through Arduino, I used ST-Link V2 on Nucleo board. You just have to remove two jumpers from Nucleo board and connect the wires accordingly. Note that using this method, you do not have to toggle the jumper positions. 


1 comment:

  1. hello! im doing the same job, only problem is my escs requires 5v PWM signal vs 3.3v stm32 bluepill PWM voltage level... The ESC wont response until 5v is meet,, its okay with arduino uno. so basically i need a solution,(Looking for logic converter 3.3v to 5 v trial). If u have any better solution please share with us. Thank you.

    ReplyDelete