12S ESC
Project Owners: @Ethan Abraham
Requirements
Source an IC that handles the FOC control of the motor
This requirement stems from the fact that in order to compete with COTS motor drivers, we need to implement the motor control algorithm that yields the greatest results. Due to the complexity of FOC, it would be best to source and IC that implements this algorithm for us.
Can take 12S voltage
Can handle 80 A continuous
Has inrush current protection for phase FETs
Create block diagram
Show the high-level process of how the motor controller works from receiving a battery voltage to controlling the phases of the motor
Create table for engineering decisions and tradeoffs for the following components:
MCU
We ordered an MCU that was to be used for the 4S ESC that was being designed, can potentially use this chip: https://www.digikey.ca/en/products/detail/stmicroelectronics/STM32L412KBT6/9656219
Gate driver IC
Does it have field-oriented control?
Does it have built in current sense? That would be extremely useful so that we don’t have to waste board space using a current sense amplifier and shunt
Power MOSFETs
Buck converter for MCU
Battery input connection type
PWM connection type
Programming pins connection type
Component Selection
6 PWM output
1 PWM/DSHOT input
1 SPI
3 ADCs for back EMF
3 ADCs for current sense
2^5 = 32 unique LED patterns (5 leds)
MCU:
Part Number | Price (each for order of 10) | Comments |
---|---|---|
8.75 | 72MHz max clock speed. |
An STM32F3 MCU was chosen over the cheaper alternatives from the F0 series due to it’s higher maximum clock speed. If we want this ESC to actually be used on the drone one day, it needs to be cable of reading DSHOT fast enough. Therefore, using an F0 MCU was decided as too risky. All chips considered were those that were compatible with the STM FOC FW library.
Gate Driver:
Part Number | Price | Comments |
---|---|---|
10.39 |
| |
7.19 | Same as above but max voltage rating is 60V instead of 100V |
Current sense is critical to our board as it is half the inputs to the FOC algorithm. In my opinion it is much more reliable to get a gate driver that has built-in current sense and says that it is designed for FOC applications. TI has an amazing line-up of these FOC gate drivers. The original we wanted went out of stock but the 60V max version should be sufficient. Transient loading could be a concern with the 60V max rating but I think we should be fine.
MOSFET:
Part Number | Price (/10) | Vds | Rds(on) @ 50A | Continuous Current (A) | Gate Charge (nC) @ 10V Vgs, 18A Id | Output Capacitance (Coss in pF) @ 30V Vds | Rise time (ns) | Fall time (ns) | Comments |
---|---|---|---|---|---|---|---|---|---|
1.61 | 60 | 6m | 100 | 42 | 350 | 36.4 | 32.1 | Funky lookin' package | |
1.91 | 60 | 10m | 100 | 15 | 300 | 6.3 | 1.7 |
| |
2.68 | 60 | 4m | 100 | 33 | 1160 | 8.3 | 14.7 | Little sketchy, no recommended land pattern, no parameters from Altium |
Conduction Loss:
Gate Charge Loss:
Output Capacitance Loss:
Switching Transition Loss:
Ref: https://electronicsbeliever.com/how-to-compute-mosfet-switching-losses/
Power Loss Results:
Note that the following calculations are for comparison purposes ONLY. They are not the actual power losses of the FETs for this board. For these calculations, we will be using Vds = 30V, Id = 18A, Vgs = 10V, fsw = 100kHz. These parameters were chosen as they seemed to be common among the FET datasheets, if you change these parameters then you end up changing the FET’s values for Rds(on), Coss, tr and tf.
Part Number | Conduction Loss | Gate Charging Loss | Output Capacitance Loss | Switching Transition Loss | Total Power Loss |
---|---|---|---|---|---|
1.944 | 0.042 | 0.01575 | 1.85 | 3.82175 | |
3.24 | 0.015 | 0.0135 | 0.216 | 3.4845 | |
1.296 | 0.033 | 0.0522 | 0.621 | 2 |
Gate Driver Buck (LMR160006):
Feedback:
R2 = 18k, R1 = 100k, Vout = 5V
https://www.digikey.ca/en/products/detail/yageo/RC0603FR-0718KL/726989
https://www.digikey.ca/en/products/detail/yageo/RC0603FR-07100KL/726889
Inductor:
Using Vin,max = 50.4V, Vout = 5V, fsw = 700kHz, Io = 100mA, K = 0.3, we find that our inductor must be at least 214uH with a continuous current rating of at least 200mA. Will results in 40mA ripple current. From here we optimize filters such as DCR, size, cost, and self-resonant frequency.
Note: We want a K (ratio of ripple current to output current) to be around 0.3. A higher output current will result in a higher ripple current which will cause things like higher ripple voltage, more EMI, and be less efficient. An acceptable ratio is 0.3. If you would like to lower that ratio and decrease you ripple current a larger inductance in needed, but as long as you have a ratio of around 0.3 you’re chilling in CCM with a relatively stable output rail.
Schottky Diode:
Voltage rating of at least 1.25x max input = 50.4*1.25 = 63V. Current rating of at least 200mA
https://www.digikey.ca/en/products/detail/smc-diode-solutions/DSS18U/8341862
Output Capacitance:
Delta I_out is 0.1A, fsw = 700kHz, and desired delta V_out is 0.01V. Minimum voltage rating is 5V. This gives a minimum values of 29uF. Accounting for DC bias, we will use 3 of the following 47uF capacitor for output capacitance (DC bias: 15uF @ 5V)
https://www.digikey.ca/en/products/detail/murata-electronics/GRM21BR61A476ME15L/4905529
Input Capacitance:
Max output current is 100mA, input, fws = 700kHz, desired input ripple is 0.01V. This gives a minimum value of 3.6uF. Minimum voltage rating is 60V. We will go with 10uF. Accounting for DC bias, we will get put 3.
https://www.digikey.ca/en/products/detail/murata-electronics/GRM32EC72A106KE05L/7319245
5V to 3V3 LDO:
3V3 fixed output, 300mA current rating is plenty, max input voltage is 18V, $0.48 pog
https://www.digikey.ca/en/products/detail/diodes-incorporated/AP7370-33WW-7/10295009
One 10uF 25V for input and one for output
https://www.digikey.ca/en/products/detail/murata-electronics/GRM188R61E106KA73J/9887674
Current Sense:
For the SPI version of the IC that we have, you do not use a resistor to set the gain, instead you set a bit in the chip:
To select a current sense resistor, we need to consider the power loss throough the resistor and make sure it’s rated for it, as well as the voltage drop across the resistor that will be sent to the CSA so that we know we are making the most out of our 0 to 3.3V range.
https://www.digikey.ca/en/products/detail/vishay-dale/WSLF25122L000FEB/6194694
Bulk Capacitance:
Phase VSENSE Feedback:
The MCU and control algorithm needs to know the phase voltages at all times to control the timing of the commutation. This is done through a voltage divider from the phase voltage to an ADC pin on the MCU
The maximum voltage we prepare for on any phase is 60V. The maximum input voltage of the STM ADC is 3.3V. Therefore, we can map 60V to 3.2V to make use of our whole voltage range. Resistors chosen have a slightly high power rating as they are exposed to higher voltage and will be able to have better thermal performance
R1 - 18k 1/3W 0603: https://www.digikey.ca/en/products/detail/panasonic-electronic-components/ERJ-PA3F1802V/5035880
R2 - 1k 1/3W 0603: https://www.digikey.ca/en/products/detail/panasonic-electronic-components/ERJ-PA3F1001V/5035848
STM MCU Clock:
In the STM Motor Control Workbench software, we are configuring our MCU to be using an external oscillator with a frequency of 8MHz.
IC:
Dead Time Settings:
Under the conditions specific below, those are the rise, fall, and delay times for the chosen power MOSFET.
When selecting a dead time, we must ensure that it is greater than the sum of the turn-off time and fall time of the HS FET, and then turn-on time and rise time of the LS FET, or vice versa. When adding the times together we get 22.6ns
When setting the dead time for the gate driver over SPI, a value of either 50ns or 100ns seems to be good. We do not want to set this value too high or else we will have no current in our motor windings for too long as it can affect our commutation timing, our power efficiency, our response time, and our heat generation
MCU Pinout & Requirements:
3x ADC inputs for phase current sense voltages
Phase A current sense: Pin 10 (PC2), ADC1_IN8
Phase B current sense: Pin 11 (PC3), ADC1_IN9
Phase C current sense: Pin 8 (PC0), ADC1_IN6
3x ADC inputs for phase B-EMF voltage sensing
Phase A voltage sense: Pin 22 (PA6), ADC1_IN15
Phase B voltage sense: Pin 26 (PB0), ADC1_IN12
Phase C voltage sense: Pin 30 (PB11), ADC_IN14
6x PWM outputs for driving the LS and HS FETs
Phase A HS PWM:
Phase A LS PWM:
Phase B HS PWM:
Phase B LS PWM:
Phase C HS PWM:
Phase C LS PWM:
SPI bus to control gate driver IC
MOSI: Pin 53 (PC12), SPI3_MOSI
MISO: Pin 52 (PC11), SPI3_MISO
CLK: Pin 51 (PC10), SPI3_SCK
CS: Pin 50 (PA15), SPI3_NSS
UART for serial debugging
TX: Pin 58 (PB6), UART_TX
RX: Pin 59 (PB7), UART_RX
1x ADC for bus voltage sensing:
Bus voltage sense:
2 pins for external oscillator
OSC IN: Pin 5 (PF0), RCC_OSC_IN
OSC OUT: Pin 6 (PF1), RCC_OSC_OUT
m
Bus Overvoltage Protection:
60V TVS diode(s):
Chris' Rough Notes
Questions:
What is the purpose of the gate driver?
What is field oriented control?
Why is the input to the gate driver PWM instead of GPIO output?
Still not 100% sure, but I believe the inputs are indeed PWM… I think the idea is as you vary the PWM duty cycle, it too varies the speed of the motor. BUT the rate at which you cycle through your states would also vary the speed of the motor right??
Are we using back EMF to determine the orientation? How does this work with field oriented control?
I don’t believe the gate driver that we selected uses field oriented control. It is a very complex algorithm that usually comes directly with an IC to control the motors for us.
Yes, using back EMF to determine motor orientation looks like the simplest way to achieve sensorless bldc control.
Final thoughts:
The input to the gate driver is PWM.
If you want the fet off then you need a 0% duty cycle but any duty cycle >0% corresponds to the fet being on but only that percent of the max current
This would provide torque control?
To increase and decrease the speed of the motor, you would vary the rate you cycle through the motor states
We would use Back EMF to determine the best time to transition to the next state
This is read using the ADC
We would have a startup sequence to determine the initial orientation of the motor
We need to be able to read PWM or DSHOT
Final Thoughts part 2:
Components of controlling a bldc motor:
Controlling Fets: based on the current gate driver selected, the inputs are 6 pwm signals for the 6 n channel fets. By varying the duty cycle you are varying the amount of current that can flow through the fet (I think) and thus varying the strength of the generated magnetic field, effectively varying the speed of the motor
Back EMF: Since at any given moment, on 2 or the 3 phases are driven, the other phase is left floating, leaving it subject to back EMF (generated by a coil moving through magnetic field…in this case generated by the permanent magnets). Based on this back EMF, one can detect the optimal point to switch the state of the motor to the next one based on the level of back EMF
I believed it can be detected via simple GPIO edge interrupts or reading through ADC
Startup sequence: Since back emf is not generated when the rotor is stationary, there is no way to tell what the starting position is. What can be done tho, is energy the coil with a known pattern, which will force the motor in a known position. Then, the motor sequencing states can start from there.
Input reading: both PWM and DSHOT will require detecting edges to read the entire “frame” of data. Most likely will be implemented via GPIO edge interrupts and timers.
Nice to have: detect whether PWM or DSHOT is being used automatically
Varying speed: Originally I thought you vary the speed based on varying the rate you cycle through the motor states, but I believe varying the states is achieved by increasing the duty cycle of the 6 input pwm signals.
Field Oriented Control:
https://www.microchip.com/stellent/groups/sitecomm_sg/documents/training_tutorials/en532365.pd
After watching this video, it seems very possible to implement this algorithm ourselves instead of sourcing an IC that does it for us…
The main transforms related to this algorithm are simple trig calculations
The part I am unfamiliar with is the PI (from PID) loop, not sure how to implement one of those things but that is not something we need to look into for the hardware.
One thing to look into is how fast we need this algorithm to run and if our current micro can support it
We need to be able to determine the speed of the motor as well as the position of the rotor.
What hardware components are required to facilitate this algorithm without a dedicated FOC IC?
Upon having a discussion, we came to the following conclusions:
We want to see our own custom ESC being used in the future on a comp drone. For this to be possible it needs to perform with similar quality to a COTS ESC. The only way to do this will be to implement FOC (trapezoidal will not be good enough)
The plan is to find an IC that implements FOC for us that is made for our sized load. Implementing FOC by ourselves will be extremely difficult to tune and get working reliably