其他分享
首页 > 其他分享> > 在PWM控制下的直流有刷电机性能优化

在PWM控制下的直流有刷电机性能优化

作者:互联网

综述

选择合适的电机驱动模式和PWM频率, 能大幅提升直流电机的性能和可控性, 例如在常见的48:1减速电机上使用慢衰减模式和低于100Hz的PWM输出就能看到明显效果.

引言

在一些场合, 需要在慢速下精细控制机械的运转和制动, 但是你会发现电机的启动不是渐进的, 会突然产生速度, 然后又突然停止, 虽然也用了PWM控制速度, 但是为什么速度的变化不均匀呢? 一个明显的原因是, 有刷直流电机在转速低于200RPM(200转每分钟)时如果没有经过调校, 很难得到足够的扭矩来保持稳定转动, 而在高速的区间, 速度的变化也不是线性的. 通过一些实验发现, 可以通过调整PWM信号参数改善这些问题. 这篇文章将尽量详细地说明这些信号参数, 并例举一些常见的电机, 通过这篇内容你可以改进你的项目中的电机性能.

首先让我们看看PWM和直流有刷电机.

PWM 和直流有刷电机

有刷直流电机对于输入的直流电压产生磁力并转动, 例如工作在6V的小电机在使用4节AA电池时全速转动, 而在3节AA电池供电时速度就会慢一些, 使用2节时就会更慢. 在实际应用中, 需要通过软件来控制电压, 这就是PWM(Pulse Width Modulation, 脉冲宽度调制). 微控制器一般通过外置的电机驱动模块来控制电机工作, 通过PWM信号控制电机的方向, 速度和可用扭矩. PWM信号一般包含三个主要特性: 占空比, 衰减模式和频率.

占空比

占空比(Duty Cycle)就是在一个完整的PWM周期中, 高电平脉冲在时间上占的比例, 通常使用一个百分数来表示. 对应的 PWM 等价电压就是供电电压乘以占空比这个百分比. PWM脉冲的宽度由代码控制, 越宽输出的能量就越高, 电机运转就越快. 当直接连接到供电电压上时, 就等价于一个100%占空比的PWM信号.

通过占空比控制电机的速度, 而电流衰减模式和PWM信号频率则会影响到电机的工作效率, 特别是当占空比小于30%的情况.

衰减模式

电机的再循环电流衰减模式是当前电机控制方面一个特殊的特性. 可以区分为快衰减和慢衰减. 在最简单的电机控制中, 通过一个开关控制电机的工作和停止, 开关合上时电机运转, 在开关断开时, 电机失去动力并自行减速并停止. 这种情况叫快衰减, 因为输入的电流迅速减小. 这种模式也称为滑落模式因为电机在开关关闭后是自由滑落到停止状态.

而在很多场合, 例如在边缘运行的机器, 相比较自由滑落停止, 我们更希望有刹车控制, 另一种模式, 慢衰减模式就更适合这种场合. 这种模式通过利用电机转动时的发电效应增加了可控性.

Choose one of your favorite DC motors and an LED from the parts bin. A Yellow-TT motor and a red or green LED will work nicely. Connect the LED to the motor terminals and give the shaft a quick spin then again in the opposite direction. What did you see? A spinning motor creates electricity in proportion to its speed and direction. This phenomenon is called EMF (electro-motive force) and can be measured in volts.

A DC motor creates electricity even when coasting to a stop. If the motor terminals of a coasting motor are connected to each other, the generated EMF will return the power to the motor causing it to try to spin in the opposite direction (back EMF). The result is a rapid slow down of the motor speed, akin to brakes. Very handy for stopping on a dime.

Motor controller breakouts such as the DRV8833 apply active braking when operating in slow decay mode. It’s called slow decay since the motor continues to operate using the current supplied by the motor itself; the motor current doesn’t suddenly disappear. Some controller chip vendors also call this Braking Mode.

The Yellow-TT motor's spin threshold decreases to 1200 RPM when operating in slow decay mode compared to 3000 RPM for fast decay mode. That means that the output shaft of the 1:48 gearbox turns the attached wheel at 25 RPM versus 63 RPM; forward speed drops to 8.5 cm/sec from 21.4 cm/sec.

Also note that the speed versus motor voltage curve for slow decay (blue line) is more linear than fast decay (green line). The linear relationship between speed and voltage simplifies calculating motor speed from the throttle value.

equivalent_voltage = power_supply * throttle

motor_speed = (2500 * equivalent_voltage) - 2000

gearbox_speed = motor_speed / 48

With a 5-volt power supply, the motor and gearbox output shaft speeds for a throttle setting of 0.5 are 4250 RPM and 88.5 RPM.

equivalent_voltage = 5 * 0.5= 2.5

motor_speed = (2500 * 2.5) - 2000 = 4250

gearbox_speed = 4250 / 48 = 88.5

Decay mode terminology is confusing. Remember that the decay mode describes how quickly the motor recirculation current dissipates, not its effect on motor speed. A motor's rotational speed drops more quickly when using slow decay mode (braking) as compared to fast decay (coasting).

Selecting the proper current decay mode for your project will go a long way to fine-tuning required brushed DC motor performance. One other PWM parameter, frequency, is useful for increasing low-speed torque and lowering the throttle value needed to start the motor spinning.

PWM频率

PWM频率就是每秒输出的PWM周期数, 单位是Hz, 在数学上等于周期长度的倒数 (PWM_Frequency = 1 / PWM_Interval_Period).

当计算PWM等价电压时, 我们通常假定电机工作于一个理想状态的非PWM的电源提供的电压. 但是实际情况和这个差距很大. 例如对于常见的48:1小电机, 在连接1.5V的电池时可以轻松启动, 但是在PWM等价电压为1.5V时却纹丝不动, 直到等价电压上升到2V时才开始转动, 然而一开始转动就迅速爬升到4000RPM, 这是什么原因呢?

因为有刷直流电机的转子都包含两个/三个或更多缠绕在铁芯或其他磁性材料上的线圈, 电机在电路上类似于一个电感, 取决于匝数的大小和磁芯的材料, 线圈通常需要几个毫秒才能建立起足够推动其轴转动的能量. 所以在使用PWM进行电机速度控制时转子线圈的电感就成为一个很大的影响因素. 在直接使用直流电压供电时电机线圈的工作状态是最好的, 因为磁场达到所需要的强度需要时间. 对于高频PWM, 加在电机线圈上的脉冲变化太快, 就会导致线圈无法提供转动所需的能量而无法转动.

当PWM频率降低到一个的数值之后, 电机线圈就可以从脉冲中得到足够的能量带动转子, 从而在更低的PWm等价电压上也能开始转动. 对于常见的48:1小电机, 最佳的工作频率接近25Hz. 当频率为25Hz时, 电机在等价电压为0.5V时就能开始工作, 最低转速可以低至100RPM. 因为齿轮将转速减为1/48, 所以此时车轮转速才2RPM, 前进速度才0.7厘米每秒.

选择衰减模式和频率

Slow decay mode is usually selected for controlling brushed DC motors because of its ability to dynamically apply braking. It also helps to linearize the relationship between duty cycle and motor speed. Let’s compare the two modes.

If low-speed operation is required, slow decay mode increases available torque and significantly improves the overall speed range of the motor. Choosing slow decay also provides a linear mapping of the software throttle setting to motor speed which is helpful when measuring velocity and distance traveled.

Slow decay mode appears to be superior in most categories, but isn't the best choice if power consumption is your primary concern. For some battery-powered robots, the power saved using fast decay mode outweighs the more precise control offered by slow current decay.

Fast decay mode is the default mode in CircuitPython motor control libraries. Changing the operational mode parameter to slow decay can be accomplished with a simple, one-line statement. See the Code Examples section for the details.

After changing the mode, test the operation to confirm that the lowest required motor speed is working as needed. If a lower spin threshold is required, try reducing the PWM frequency to the lowest possible value (usually about 25Hz) and work up towards the maximum of the motor controller. Choose the frequency that provides the best balance of torque throughout the desired speed range while balancing the motor chatter that can happen at lower frequencies.

As a rule of thumb, most small brushed DC motors will operate nicely with a PWM frequency of 50Hz to 100Hz and slow decay mode. Projects like the StringCar Racer that don't use gearbox motors seem to work best at 25Hz.

In combination with its CircuitPython library, a motor controller board will offer a range of selectable PWM frequencies as well as decay mode. The table above shows the available frequency range and mode support for a variety of Adafruit motor controllers. Refer to the Code Examples section for how to select a specific decay mode and PWM frequency for your motor controller board.

参考

标签:电机,decay,有刷,mode,motor,PWM,speed,直流
来源: https://www.cnblogs.com/milton/p/15083114.html