STM32 motor Tutorial 15 - BLDC speed loop current loop embedded

Foreword

Brushless DC (Brushless Direct Current, BLDC) motor is a positive rapid spread of the motor type, it can be used in home appliances, automotive, aerospace, consumer goods, medical, industrial automation equipment and instrumentation industries. As the name points out, BLDC motors do not have brushes for commutation, but the use of electronic commutation. And brushed DC motors and induction motors compared to a BLDC motor, has many advantages. These include:

• Better speed - torque characteristics

• Fast dynamic response

• high efficiency

• long lasting

• noise-free operation

• In addition the higher speed range,

Since the motor output torque and a higher volume ratio, so that the need to focus on applications where space and weight are factors, are very useful.

Brushless Motor

 

12th Course "STM32 Motor Tutorial 12 - BLDC closed-loop current control" tells the story of a BLDC motor current loop simple implementation process, Lecture 14 "STM32 Motor Tutorial 14 - BLDC motor speed closed-loop control" has been introduced closed-loop speed BLDC motor control (monocyclic) implemented in practical engineering applications, often require multiple nested control loop, such as speed loop embedded current loop, velocity loop control when implemented, control current is obtained, in another example, servo the control system of the frequently used the position, velocity, current three-layer nested loop. This section will achieve 3SH BLDC motor speed based NUCLEO-F103RB and X-NUCLEO-IHM07M1 embedded current loop to achieve speed control BLDC!

As used in this section motor operating voltage 24V, the maximum speed of 12000rpm 2836 brushless motor, the motor has two sets of lines (three-phase motor and a Hall sensor line line):

Detailed examples

This section uses the official launch of the ST NUCLEO-F103RB and X-NUCLEO-IHM07M1 3SH development board.

NUCLEO-F103RB wiring diagram corresponding to the general principle:

X-NUCLEO-IHM07M1 3SH partially schematic:

 

 

 

  1. Ready to operate

    1. X-NUCLEO-IHM07M1 3SH is a dedicated to the PMSM (permanent magnet synchronous) or the BLDC motor drive plate (brushless DC), the plate driving motor driver chip model L6230 (detailed data sheet may official website to download st), this section required to IN1, IN2, IN3 and OUT1, OUT2, OUT3, HALL sensor signal interface H1, H2, H3 single resistor and a current sampling interface PC1.

 

Need to use the signal

The corresponding MCU pin

EN1

PC10

IN1

PA8

EN2

PC11

IN2

PA9

EN3

PC12

IN3

PA10

H1

PA15

H2

PB3

H3

PB10

Speed ​​parameter saving positioner

PB1

Current sampling interface

PC1

 

This section is used directly STM32 TIM1 generating three PWM wave signal corresponding to IN1, IN2, IN3, motor speed control is achieved by adjusting the duty cycle of PWM wave; and EN1, EN2, EN3 IO port configured to output normal output mode, H1, H2, H3 configured hall sensor mode TIM2 and open capture T1 interrupt, the interrupt trigger mode bilateral trigger mode (actual TRC signal), the interrupt service routine real reason is more accelerated commutation of the motor with a phase (6-step commutation step) operation, PB1, PC1 configured AD samples pin, wherein PB1 is the speed reference potential input pin, pin PC1 is sampled motor current, this section mining machine 64 in a plurality of the second PWM period to which 64-point average as an average current of the motor.

 

  1. In STM32CubeMX, there are special NUCLEO-F103RB project templates, create a new Cube engineering, chip model st32f103rb:

Produces a simple project template to achieve the RCC, SYS, USART2 configuration interface, while still achieving the (LED) configuration pins LD2. Next, each functional module configured manually, first TIM1, configured to output a three-way PWM mode, PWM carrier frequency is 20Khz = 72M / (2 + 1) / (1199 + 1), each channel 500 is the initial wave PWM:

 

Enable TIM1 of UPDATA interruptions, the current operation and PID control in the interrupt service routine:

Next is TIM2 configuration, open three-way input capture function, enabling XOR function, turn the timer interrupt:

The figure above the desired TIM2 directly HALL sensor function, only CUBE is not arranged in point problem for the following reasons, when configuring the input capture channels, many models are not available:

However, to actually achieve STM32 timer HALL sensor interface function, in addition to open XOR functions (can be checked directly in CUBE):

Also need to use TI1F_ED (direct bilateral edge detection) signal, and, ultimately the TRC signal .. CC1I interrupt, a complete signal flow diagram below:

 

It also needs to open the interrupt, and appropriate modifications to the final TIM.C automatically generated (with source described later on):

Configuration ADC1:

ADC of the present embodiment adopted the motor current sampling resistor in single mode, as shown above, the relationship between the motor current and the current ADC sampling (JP1, JP2 not answer): V = 3 * 0.33 * I, where 0.33 is the sampling resistor the resistance, I is the motor current, V is the motor current amplified 3 times.

 

 

Enable the ADC DMA functions:

Configuration ADC2:

 

Next, the PC10, PC11, PC12 Common IO function configuration, GPIO_output mode, the default output is low:

Finally interrupt priority level configuration:

Generating projects:

 

  1. Open the project, add the prepared bldc.c, pid.c, visualscope.c and bldc.h, pid.h, visualscope.h (.c .h in the src folder in the INC folder) file:

At the same time add the following code tim.c stm32f1xx_it.c and in which:

In dma.c turn off dma interrupt:

Was added in adc.c averaged current Code:

Export variables and function names in adc.h in:

Finally, add the following code in main.c:

 

After downloading the project is set to run automatically:

Compiled code, debugging the code, the code is present on a section speaking "the STM32 Motor Tutorial 14 - BLDC motor speed closed-loop control" achieved on the basis of the motor current can be seen (red) serial port on the oscilloscope, the target speed (yellow) and the actual speed (blue) waveform, the rotary potentiometer can be seen that the effect of the closed loop control of motor speed (yellow, blue substantially coincide):

 

OK, the current test is completed! This concludes this section, the next section will give implementation of current loop introduce closed loop speed embedded. Finally, if you have any questions or want to know there are other content, but also welcome message! ! Finally, like the number of students remember the public plus interest, and every day there are technical dry launched! !

 

 

Source text and data downloads, thirteen public concern number:

33 In the number sent to the public in the "Download | STM32 Motor Tutorial 15":

 

 

Intelligent Recommendation

PWM/speed single closed loop/speed current double closed loop motor control Simulink simulation

PWM/speed single closed loop/speed current double closed loop motor control Simulink simulation The laboratory has been using BBB boards and ARM boards to control the motor through drivers. Recently, ...

STM32 Motor Tutorial 10-BLDC 6-step square wave control

Foreword       Brushless DC (Brushless Direct Current, BLDC) Motor is a type of motor that is rapidly popularizing. It can be used in household appliances, automobiles, aerosp...

STM32 control encoder motor implementation [speed closed -loop control] and [position closed -loop control]

1. Hardware and wiring description The hardware based on this experiment is: STM32F103C8T6 main control board TB6612FNG DC motor driver module 6 Line orthogonal encoder motor (with AB phase) The hardw...

Speed ​​loop plus position loop for motor control

Recently, I used a motor to make a badminton racket and I always had an overshoot. So I got to know about 3 rings. The position loop is based on the positional relationship output speed, controlling t...

Motor Control - Speed ​​Loop Design

refer to InstaSPIN-FOC and InstaSPIN-MOTION User Guide Station b: Haodidi: "PID Regulator" Part 1: Current Loop Design Referring to TI documents, it took some time to sort out the design of ...

More Recommendation

Permanent magnet synchronous motor vector control (3)——current loop speed loop PI parameter tuning

1 current inner loop regulator design The current loop of the vector control system controls the iq and controls the stator current to control the motor torque. The inner loop of the current is capabl...

(Ii) permanent magnet synchronous motor vector control (two-level) - current loop parameter setting speed loop PI

The first section of the stator voltage equation has been derived in the dq coordinate system, the flux equation, electromagnetic torque equation and the equation of motion of the rotor. This chapter ...

Vector Control of Permanent Magnet Synchronous Motor (5)—— PI Parameter Tuning of Current Loop Speed ​​Loop (Supplementary Part)

Vector Control of Permanent Magnet Synchronous Motor (5)-PI Parameters of Current Loop Speed ​​Loop (Supplementary Section) 5.1 Equivalent model of permanent magnet synchronous motor (current loop) 5....

DC brush motor speed and current double closed-loop speed regulation system and Matlab/Simulink simulation analysis

Article directory Preface 1. Buck Chopper circuit (Buck Chopper) 2. Speed ​​and current double closed-loop DC speed regulation system 3. Matlab/Simulink simulation 3.1. Simulation circuit analysis 3.2...

[STM32] HAL library uses PID algorithm closed loop control motor speed (super detailed)

  Hello everyone, I am a small government. This article I willThe STM32Cubemx configuration process of the motor speed by using the PID algorithm closed loop control motor speedDetailed expl...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top