有刷电机:有定子和转子两大部分组成,定子上有磁极(绕组式或永磁式),转子有绕组,通电后,转子上也形成磁场(磁极),定子和转子的磁极之间有一个夹角,在定转子磁场(N极和S极之间)的相互吸引下,使电机旋转。改变电刷的位置,就可以改变定转子磁极夹角(假设以定子的磁极为夹角起始边,转子的磁极为另一边,由转子的磁极指向定子的磁极的方向就是电机的旋转方向)的方向,从而改变电机的旋转方向。
电机工作时,线圈和换向器旋转,磁钢和碳刷不转,线圈电流方向的交替变化是随电机转动的换相器和电刷来完成的。在电动车行业有刷电机分高速有刷电机和低速有刷电机。有刷电机和无刷电机有很多区别,从名字上可以看出有刷电机有碳刷,无刷电机没有碳刷。
无刷电机:采取电子换向,线圈不动,磁极旋转。无刷电机,是使用一套电子设备,通过霍尔元件,感知永磁体磁极的位置,根据这种感知,使用电子线路,适时切换线圈中电流的方向,保证产生正确方向的磁力,来驱动电机。消除了有刷电机的缺点。无刷电机的控制器,还可以实现一些有刷电机不能实现的功能,比如调整电源切换角,制动电机,使电机反转,锁住电机,利用刹车信号,停止给电机供电。
从网上采购一个无人机使用的BLDC:
特点:
keil 软件:
MCU,电机参数配置:
- #ifndef __WHOLE_MOTOR_PARAMETERS_H_
- #define __WHOLE_MOTOR_PARAMETERS_H_
- #include "HAL_device.h"
- #include "HAL_conf.h"
- //#define ENABLE_DAC_SHOW //for enable DAC output
- //------MCU parameters------------------------------------------------------------------------------------------------------
- //#define MM32SPIN05
- #define MM32SPIN160
- //#define MM32SPIN06
- //------System parameters---------------------------------------------------------------------------------------------------
- #ifdef MM32SPIN05
- #define SYSYTEM_CLOCK 72000000 //unit:Hz
- #endif
- #ifdef MM32SPIN160
- #define SYSYTEM_CLOCK 72000000 //unit:Hz
- #endif
- #ifdef MM32SPIN06
- #define SYSYTEM_CLOCK 48000000 //unit:Hz
- #endif
- #define PWM_FREQUENCY 16000 //unit:HZ
- #define POLE_NUMBER 12//8
- #define MOTOR_DIR_CW 1 //1:CW, 0:CCW rotation direction define before power on
- #define TARGET_MAX_SPEED TARGET_SPEED_7 //unit:RPM, max. speed limitation
- #define TARGET_MIN_SPEED TARGET_SPEED_1 //unit:RPM, min. speed limitation
- //----Enable/Disable 1 shunt R mode----------------------------------------------------------------------------------------
- //#define ENABLE_1_SHUNT_R_TO_MEASURE_3_PHASE_CURRENT //if not define, it will use 2 shunt R to measure 3 phase current
- //------2 shunt R phase current sensing parameter-------------------------------------------------------------------------------------
- #define MAX_PWM_DUTY_PERCENTAGE_2SHUNT_R 95 //unit:%, it need to limit the maximum pwm duty output for doing the 2 shunt R current sensing
- //------1 shunt R phase current sensing parameter-------------------------------------------------------------------------------------
- #define ADC_DELAY_TIME_1_SHUNT_R 25//20//35 //unit : 0.1us (dead time + OP output signal stable time)
- #define ADC_TOTAL_TIME_1_SHUNT_R 33//30//45 //unit : 0.1us (dead time + OP output signal stable time + ADC sample time)
- //------Rotor initial position detection method 1 parameters-------------------------------------------------------------------------------------
- //#define ENABLE_ROTOR_IPD1_FUNCTION //if define, it will use IPD1 function to detect the initial position of rotor before startup motor
- #define ROTOR_IPD1_TARGET_CURRENT 10 //unit:0.1A define the target torque current in ROTOR_SMALL_SWING_MODE
- #define ROTOR_IPD1_SMALL_SWING_TIME 100 //unit:ms, define rotor small swing time with ROTOR_IPD1_TARGET_CURRENT torque current
- #define ROTOR_IPD1_DETECT_TIME 60 //unit:ms, define rotor angle detection time after rotor small swing, range 40~100ms
- #define ROTOR_IPD1_BEMF_SUM_MINI 50 //unit:mV, define the minimum sum value of bemf |A| + |B| absolute value
- #define ROTOR_IPD1_MAX_FAIL_TIMES 6 //range:(6~65535),if IPD failure times over this setup value, motor operation will enter open loop mode directly.
- //------Rotor initial position detection method 2 parameters---inductance saturation---------------------------------------------------------------
- //#define ENABLE_ROTOR_IPD2_FUNCTION //if define, it will use IPD2 function to detect the initial position of rotor before startup motor
- #define PWM_NUM_FOR_INJECT_VOLT 8 //define PWM numbers as IPD2's inject voltage pulse time, for motor inductance saturation effect //20190626
- #define PWM_NUM_FOR_NON_INJECT_VOLT 24 //define PWM numbers as IPD2's off current time after inject voltage pulse to motor//20190626
- #define INJECT_VOLT_PULSE_AMPLITUDE 5 //unit:%, define motor inject voltage pulse amplitude, range (1~40)
- //----define enable the new startup method and others parameters---------------------------------------------------------------------------------------------------------
- #define ENABLE_NEW_STARTUP_METHOD
- #define NEW_STARTUP_MIN_TIME 30 //unit:10ms, define new startup mode minimum time, 20 means 200ms as new startup time//20190626
- #define NEW_STARTUP_MAX_TIME 50 //unit:100ms,if over this time in new startup mode, it will show error to system,600 means 60second//20190626
- #define NEW_STARTUP_TO_CLOSE_LOOP_SPEED 600//TARGET_SPEED_1 //unit:RPM, define enter close loop mode speed
- #define NEW_STARTUP_RAMP_UP_TIME 48//90 //range(80~3200),16 = 1ms at 16KHz PWM, 1440 pwm cycles of 16khz = 1440/16 =90ms
- #define NEW_STARTUP_INITIAL_CURRENT 8//7//20 //unit:0.1A define the initial torque current in new startup mode for standstill or downwind startup //20190626
- #define NEW_STARTUP_TARGET_CURRENT 8//7//20 //unit:0.1A define the target torque current in new startup mode //20190626
- #define NEW_STARTUP_CURRENT_FOR_AGAINST_WIND 12 //unit:0.1A define the initial torque current in new startup mode for against wind startup //20190626
- #define NEW_STARTUP_RAMP_UP_CURRENT_SLOP 10 //unit:0.1A/sec,range(1~400),increase how many torque current per second in new startup mode//20190626
- //#define ENABLE_BACK_TO_NEW_STARTUP_MODE_WHEN_LOW_SPEED //if enable, it will back to new startup mode if speed below the define "BACK_TO_NEW_STARTUP_MODE_SPEED"
- #define BACK_TO_NEW_STARTUP_MODE_SPEED (TARGET_SPEED_1 -(TARGET_SPEED_1>>1)) //if speed under this in close loop mode, it will back to new startup mode
- #define NEW_STARTUP_OVER_SPEED (TARGET_SPEED_7/2) //new startup over speed define
- #ifdef ENABLE_NEW_STARTUP_METHOD
- #define ENABLE_NEW_STARTUP_METHOD_FOR_DOWNWIND_STARTUP//20190626, enable motor startup in downwind status
- #define ENABLE_NEW_STARTUP_METHOD_FOR_AGAINST_WIND_STARTUP_AFTER_STOPPED//20190626,restart motor use new startup method,for motor has stopped by open loop mode
- #define ENABLE_NEW_STARTUP_METHOD_FOR_LOW_SPEED_AGAINST_WIND_STARTUP //20190626//restart motor use new startup method, if motor run in low speed reverse direction by against wind
- //#define ENABLE_NEW_STARTUP_METHOD_FOR_HIGH_SPEED_AGAINST_WIND_STARTUP//20190626//restart motor use new startup method, if motor run in high speed reverse direction by against wind
- #endif
无刷无感控制控制难点主要有两点:第一,电机的启动;第二,转子位置的检测。
对于无刷电机来讲,电机的运转是靠电子开关控制换相,那么想要电机正常高效的运转,就必须要知道转子的位置之后,才能正常换相,问题来了,电机没有传感器,也没有转起来,所以转子的位置就不得而知了,所以无感的启动就要自转启动,先让电机以一定的速率自转,在电机自动的过程中,我们通过检测反电动势来得知转子的位置,从而得到正确的换相的相位。
电机的自启动说起来简单做起来难,,总结出以下几点经验供参考:
(1)、首先是自转,自转一定要让电机运转顺畅,不能打抖,同时也不能造成大电流。这是启动成功的非常关键的一步。具体如何达到这个效果,就要各位在调试的过程中调节PWM占空比以及换相时间的长短了。
(2)、启动步数不能太少,也不要过多,一般十来步就够了,等电机运行十来步后开始检测反电动势,当检测到正确的反电动势后这时候电机就正常运转起来了。
检测反电动势:
检测反电动势的方法有两种,第一是用单片机内部AD采样反电动势信号来进行比较,第二是用比较器直接比较。
MM32SPIN160C麻雀虽小五脏俱全,功能强大:
灵动微MM32SPIN160C采用高性能为内核为M0的32位微控制器,5V输出的LDO稳压器、三组具备有自举二极管的N通道半桥栅极驱动器。MCU的工作频率最高可达72兆赫兹,内置SRAM高速存储器,丰富的增强型I/O端口和外设连接到外部总线。MM32SPIN160C产品包含1个12位的ADC、1个比较器、1个16位通用定时器、1个32位通用定时器、3个16位基本定时器、1个16位高级定时器。还包含标准的通信接口:1个I2C接口、1个SPI接口和1个UART接口。MM32SPIN160C产品提供QFN32封装形式,该产品适合于三相永磁无刷电机和电动工具等多种应用场合。
MM32SPIN160C特征
•内核与系统
–32位ARM®Cortex®-M0处理器内核
–最高工作频率可达72MHz
–单指令周期32位硬件乘法器
–硬件除法器(32Bit)
–单指令周期32位硬件乘法器
•存储器
–高达32K字节的闪存程序存储器
–高达4K字节的SRAM
•时钟、复位和电源管理
–2.0V~5.5V供电
–上电/断电复位(POR/PDR)、可编程电压监测器(PVD)
–外部2~24MHz高速晶体振荡器
–内嵌经出厂调校的48/72MHz高速振荡器
–内嵌40KHz低速振荡器
•低功耗
–睡眠、停机和待机模式
• 5V LDO 稳压器
– 输入电压最高13.5V
• 三组N 型半桥式栅极驱动器(GATE-DRIVER)
– 三相栅极驱动器
– 支持电压UVLO 保护
– 1A/1A SINK/SOURCE 三相栅极驱动电流
• 96 位的芯片唯一ID(UID)
控制必行
测试视频:
https://www.bilibili.com/video/BV1xa411z72X/
https://www.bilibili.com/video/BV1xa411z72X/