Difference between revisions of "STM32 Electronic speed controller (ESC)"
m (Lth moved page ESC to Electronic speed control) |
|||
(32 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[Electronic speed control]] | + | [[Category:STM32 Projects]] [[Category:Work in progress]]{{metadesc|STM32 ESC - Electronic Speed Controller}} |
+ | [[Electronic speed controller]] ([[ESC]]) is a device which can control a [[Brushless DC electric motor]]. This page is meant as a place to write down research notes and it is most definitely a [[:Category:Work in progress|work in progress]]. | ||
+ | |||
+ | == Control == | ||
+ | |||
+ | The first [[ESC]]s were typically controlled by applying a [[PWM]] signal to a pin. Since then many other both analogue and digital approaches have been developed. This section list some of these along with benefits and drawbacks. | ||
+ | |||
+ | === Pulse width modulation (PWM) === | ||
+ | |||
+ | To be added | ||
+ | |||
+ | === SPI === | ||
+ | |||
+ | To be added | ||
+ | |||
+ | === USB === | ||
+ | |||
+ | To be added | ||
+ | |||
+ | == MCU == | ||
+ | |||
+ | The choice of the optimal [[MCU]] is somewhat complex. The following input/output is necessary: | ||
+ | |||
+ | * USB (DP/DM) | ||
+ | * SPI Slave (CLK, MOSI, MISO and CS) | ||
+ | * SPI Master (CLK, MOSI, MISO and CS for flash storage) | ||
+ | * SWD (CLK, DIO) | ||
+ | * UART (RX, TX for debugging) | ||
+ | * 3 x Analog In for current measurement | ||
+ | * 3 x PWM capable high-side outputs | ||
+ | * 3 x low side outputs | ||
+ | * 3 x interrupt capable inputs for zero crossing detection | ||
+ | |||
+ | Experimentally trying to do this on an [[STM32F411]] (of [[Black Pill]] fame) result in this: | ||
+ | |||
+ | [[File:ESC Pinout Test.png|800px]] | ||
+ | |||
+ | In other words, the 48 pin STM32F411CE is quite sufficient for this purpose. | ||
+ | |||
+ | == MOSFET Half Bridge Driver == | ||
+ | |||
+ | To be added | ||
+ | |||
+ | == Current Sensing == | ||
+ | |||
+ | It is important to be able to measure the current running through the motor coil. Technically it would probably be sufficient to measure the overall current but another approach would be to measure each of the 3 coils. | ||
+ | |||
+ | In principle there are two ways to measure current. The basic one is to run the current through a shunt resistor and then measure the voltage drop across that resistor. More advanced current sensors based on hall effect are available. The benefit of the hall effect sensors is a much lower resistance (and thus voltage drop and energy wasted) but they are pricey. | ||
+ | |||
+ | If we are designing towards 80 amps and use a 0.005 Ohm shunt resistor we get the following values | ||
+ | |||
+ | {| class=wikitable | ||
+ | |- | ||
+ | ! Current (A) | ||
+ | ! Voltage (V) | ||
+ | ! Power (W) | ||
+ | |- | ||
+ | | 1 | ||
+ | | 0.005 | ||
+ | | 0.005 | ||
+ | |- | ||
+ | | 10 | ||
+ | | 0.05 | ||
+ | | 0.5 | ||
+ | |- | ||
+ | | 80 | ||
+ | | 0.4 | ||
+ | | 32 | ||
+ | |} | ||
+ | |||
+ | This illustrates why it is probably beneficial to measure the coils individually since some power is burned in the shunt resistor. By measuring the 3 circuits above power is divided by 3, so rather than 32 W we get down in the 10 W range. | ||
+ | |||
+ | == Miscellaneous documentation == | ||
+ | |||
+ | * [https://en.wikipedia.org/wiki/Electronic_speed_control Wikipedia article on Electronic speed control] | ||
+ | * [https://www.ti.com/lit/ml/slua618a/slua618a.pdf?ts=1606839509721&ref_url=https%253A%252F%252Fwww.google.com%252F Fundamentals of MOSFET and IGBT Gate Driver Circuits] | ||
+ | * [https://datasheet.lcsc.com/szlcsc/Infineon-Technologies-IR2103STRPBF_C2957.pdf IR2103 Half Bridge Driver Datasheet] | ||
+ | * [https://www.st.com/resource/en/user_manual/DM00072014-.pdf UM1594 Six-step sensorless BLDC motor drive example] |
Latest revision as of 02:03, 18 July 2022
Electronic speed controller (ESC) is a device which can control a Brushless DC electric motor. This page is meant as a place to write down research notes and it is most definitely a work in progress.
Control
The first ESCs were typically controlled by applying a PWM signal to a pin. Since then many other both analogue and digital approaches have been developed. This section list some of these along with benefits and drawbacks.
Pulse width modulation (PWM)
To be added
SPI
To be added
USB
To be added
MCU
The choice of the optimal MCU is somewhat complex. The following input/output is necessary:
- USB (DP/DM)
- SPI Slave (CLK, MOSI, MISO and CS)
- SPI Master (CLK, MOSI, MISO and CS for flash storage)
- SWD (CLK, DIO)
- UART (RX, TX for debugging)
- 3 x Analog In for current measurement
- 3 x PWM capable high-side outputs
- 3 x low side outputs
- 3 x interrupt capable inputs for zero crossing detection
Experimentally trying to do this on an STM32F411 (of Black Pill fame) result in this:
In other words, the 48 pin STM32F411CE is quite sufficient for this purpose.
MOSFET Half Bridge Driver
To be added
Current Sensing
It is important to be able to measure the current running through the motor coil. Technically it would probably be sufficient to measure the overall current but another approach would be to measure each of the 3 coils.
In principle there are two ways to measure current. The basic one is to run the current through a shunt resistor and then measure the voltage drop across that resistor. More advanced current sensors based on hall effect are available. The benefit of the hall effect sensors is a much lower resistance (and thus voltage drop and energy wasted) but they are pricey.
If we are designing towards 80 amps and use a 0.005 Ohm shunt resistor we get the following values
Current (A) | Voltage (V) | Power (W) |
---|---|---|
1 | 0.005 | 0.005 |
10 | 0.05 | 0.5 |
80 | 0.4 | 32 |
This illustrates why it is probably beneficial to measure the coils individually since some power is burned in the shunt resistor. By measuring the 3 circuits above power is divided by 3, so rather than 32 W we get down in the 10 W range.