Posts

ESC protocols overview with implementation on STM32

Image
 What is ESC protocol? When our flight controller calculates new values for each of the motors they need to be sent to ESC microcontroller which can then process these values and control MOSFETs. How exactly signals are received and then send to motors is ESC's software secret, which is another really interesting and complicated topic. For now, let's know that we can not control the motors or even MOSFETs from our FC, we need to send new values between two microcontrollers. And here is our topic: how to exchange this information efficiently and correctly?   Analog way The oldest and probably the most recognizable protocol is PWM signal, taken from servo controlling. All the analog protocols are based on this signal. Period and duty cycle changes, but the idea remains the same: the FC sends a signal, and the ESC measures the time of the high and low signal, and this measured value is treated as a new set for the motor. The main features of this approach are: simplicity of imp

Filters - Theory

Image
 Filters  In this post, I want to present the theory needed for digital filter design. Firstly, a quick description of mainly used filters in the continuous domain - I want to give you some intuition in interpreting the transform functions. Next, I will present practical discretization from the '$s$' domain into the '$z$' (discrete time). Finally, a difference equation will be provided which can be directly programmed on any microprocessor. In a future post, I will show the possible implementation of described filters. In essence, the filter should block undesirable frequencies and let others pass through without distortion. For our applications, we can divide filters into 4 main categories: Low-pass filters High-pass filters Band-pass filters Notch filters Low-pass filter As the name suggests this filter allows low frequencies to pass and suppress high ones. The simplest LPF is a system with one pole: \begin{gather}H(s)=\frac{\omega_{0}}{s+\omega_{0}}\end{gather} A typ

Hardware - how to start?

Image
Introduction The first problem when it comes to programming robots is what hardware should I use and how to set up everything? The easiest solution is to use Arduino which is pretty user-friendly and on the Internet, there are thousands of tutorials about it. However, sometimes Arduino is not powerful enough (usually is more than enough). But you need to use something with more capabilities? Or you just want to be more "professional" than using a simple Arduino. The commonly-known and willingly chosen solutions are STM32 microchips and boards. With HAL library and STM32 Cube IDE gives tons of possibilities without being too overwhelming (nevertheless, this is a significant step-up of complexity referring to the Arduino). Fortunately, there are many resources and guides on this topic - in my opinion, this is the way to start. But if you want to step deeper and don't want to use functions that you don't understand, here comes STM32 and programming on registers. This is