aytwartoofyoroo

Three-phase brushless DC drive (BLDC)

 
Overview

# Three-phase brushless DC motor drive design

![BLDC_Drive.png]
#### Description
1. All hardware and code have been open source, please go to [code open source link](https://gitee.com/zhouqi98/DC-motor-drive)
2. First of all, this project was made when I was learning. At present, the Hall sensor solution has been verified, and the others have not been verified.
3. If there are any problems, please discuss in the comment area.
#### Introduction
**stm32 DC motor control**
* Using STM32F103C6T6A as the main control
* Main control and drive separation
* Using three-phase inverter bridge circuit
* The front stage uses gate drive MOS with built-in locking
* The driver board can adapt to inductive and non-inductive solutions

#### Project Introduction

  In this project. The main control and drive are separated. The general block diagram is shown below.

![rough block diagram.png]
  There are three boards in total, namely BLDC_Core board (main control board), BLDC_Drive board (driver board), and KEY board (keyboard). Each board is connected with SH1.0 wiring harness. At present, it has been verified that the inductive scheme HALL commutation has no problem. Its full-load motor idles the entire system 800mA.



#### Six-step method

  In fact, the three-phase DC brushless motor can be understood as being controlled by alternating current, and the inverter bridge in the driver board is used to generate alternating current. In the most commonly used BLDC drive, the more common and simple one is to use six-step commutation to drive the motor. This method can be called the 6-step method. In the

  six-step method, only two sets of windings of the three-phase motor have current passing through each time to generate a magnetic field. In order to make the motor rotate, the power switch tubes are generally turned on in the order of Q1Q2-Q2Q3-Q3Q4-Q4Q5-Q5Q6-Q6Q1. The figure below is the structure of the inverter.


![Inverter bridge.png]





#### HALL phase change method


  In this design, an external interrupt is used to obtain the HALL value. When the motor rotates, the HALL interrupt will be triggered. The HALL value is read in the interrupt, and the phase is changed according to the actual value to drive the motor. The following table is a commutation table for a DC brushless motor.






![six_step.png]
  According to our commutation table, a six-step commutation program can be designed. Taking forward rotation as an example, we can design the following program. Among them, hall_state is the value of the Hall obtained. In this design: the upper tube is modulated and the lower tube is driven.


```C
switch (hall_state)
{
case 1:
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_1);//W+
UL_OFF;VL _OFF;WL_ON;//Lower side
break;
case 2:
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_1);//W+
UL_ON;VL_OFF;WL_OFF;//Lower side
break;
case 3:
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_1);//W+
UL_OFF;VL_OFF;WL_ON;//Lower side
break;
case 4:
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);//W+
UL_OFF;VL_ON;WL_OFF;//lower tube
break;
case 5:
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_1);//W+
UL_OFF;VL_ON;WL_OFF;//Lower tube
break;
case 6:
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_3);//U+
HAL_TIM_PWM_Stop(&htim1,TIM_CHANNEL_2);//V+
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);//W+
UL_ON;VL_OFF;WL_OFF;//Lower tube
break;

default:
Motor_Stop();//Motor stops
break;
}

```

#### Schematic diagram


  The schematic diagram of this design is given below.

  BLDC_Drive schematic

![SCH1.png]
  BLDC_Core schematic

![SCH2.png]


#### PCB



  The PCB in this design is given below.


  BLDC_Drive's PCB

![PCB1.png]
  BLDC_Core's PCB

![PCB2.png]


#### Rendering



  The rendering in this design is given below.

  BLDC_Drive's rendering

![BLDC_Drive.png]
  BLDC_Core's rendering

![BLDC_Core.png]




#### Software architecture

  The software framework mainly adopts bare metal development, applies time-sharing scheduling, and uses timer 2 to generate a 1MS time base flag. Scheduling is completed through this flag. For specific scheduling code, please refer to the User_Scheduler.c file. The commutation control is completed in the HALL interrupt. The motor drive code can be found in the hall.c and motor.c files.




#### Contribution
* [Wang Dake who loves learning](https://gitee.com/zhouqi98) was responsible for hardware design and program writing.
* [壹壹零1223](https://gitee.com/one-zero-1223) was responsible for schematic review and welding debugging.
* [lu yoann](https://gitee.com/lu-yoann) was responsible for welding the Core board and the Drive board.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 19:06:46

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号