PWM
PWM波的频率是一个周期的时间倒数,而占空比就是指在一个周期内,信号处于高电平的时间占据整个信号周期的百分比
Pulse Width Modulation (PWM)
Intro
Defination
PWM is a commonly used control technique that generates analog signals from digital devices such as microcontrollers.
In PWM technique, the signal’s energy is distributed through a series of pulses rather than a continuously varying (analog) signal.
Pulse width modulation is an effective method that is used to control the amount of power delivered to a load without dissipating any wasted power.
In electronics, modulation is the process of varying one or more properties of a periodic waveform.
Pulse modulation is a type of modulation in which the signal is transmitted in the form of pulses.
PWM(Pulse Width Modulation)控制——脉冲宽度调制技术,通过对一系列脉冲的宽度进行调制,来等效地获得所需要波形(含形状和幅值).PWM控制技术在逆变电路中应用最广,应用的逆变电路绝大部分是PWM型,PWM控制技术正是有赖于在逆 变电路中的应用,才确定了它在电力电子技术中的重要地位
The general purpose of Pulse Width Modulation is to control power delivery, especially to inertial electrical devices.
相关概念
By Controlling the Pulse width, we can control the voltage applied to LED and hence the brightness
PWM uses a rectangular pulse wave whose pulse width is modulated resulting in the variation of the average value of the waveform.
占空比
Duty cycle = (T on /T) * 100
- “Ratio of ON time to total time period”
If duty cycle is 50%, it means the pulse remain ON for 50% of the time.
By changing the duty cycle, we control the average voltage applied to load and we can control different devices
输出的PWM中,高电平保持的时间与该PWM的时钟周期的时间 之比
如,一个PWM的频率是1000Hz,那么它的时钟周期就是1ms,就是1000us,如果高电平出现的时间是200us,那么低电平的时间肯定是800us,那么占空比就是200:1000,也就是说PWM的占空比就是1:5。
Signal Average Value
Average value of a pulse waveform f(t) with period T, low value VL, high value VH can be found as:
Vavg =D*V(High)+(1-D)V(Low)
The average value of the signal is directly dependent on the duty cycle D
分辨率
占空比最小能达到多少,如8位的PWM,理论的分辨率就是1:255(单斜率), 16位的的PWM理论就是1:65535(单斜率)。
频率就是这样的,如16位的PWM,它的分辨率达到了1:65535,要达到这个分辨率,T/C就必须从0计数到65535才能达到,如果计数从0计到80之后又从0开始计到80…….,那么它的分辨率最小就是1:80了,但是,它也快了,也就是说PWM的输出频率高了。
双斜率 / 单斜率
假设一个PWM从0计数到80,之后又从0计数到80……. 这个就是单斜率。
假设一个PWM从0计数到80,之后是从80计数到0……. 这个就是双斜率。
双斜率的计数时间多了一倍,所以输出的PWM频率就慢了一半,但是分辨率却是1:(80+80) =1:160,就是提高了一倍。
Principle
理论基础
冲量相等而形状不同的窄脉冲加在具有惯性的环节上时,其效果基本相同。冲量指窄脉冲的面积。效果基本相同,是指环节的输出响应波形基本相同。低频段非常接近,仅在高频段略有差异。
图1 形状不同而冲量相同的各种窄脉冲
面积等效原理:
分别将如图1所示的电压窄脉冲加在一阶惯性环节(R-L电路)上,如图2a所示。其输出电流i(t)对不同窄脉冲时的响应波形如图2b所示。从波形可以看出,在i(t)的上升段,i(t)的形状也略有不同,但其下降段则几乎完全相同。脉冲越窄,各i(t)响应波形的差异也越小。如果周期性地施加上述脉冲,则响应i(t)也是周期性的。用傅里叶级数分解后将可看出,各i(t)在低频段的特性将非常接近,仅在高频段有所不同。
图2 冲量相同的各种窄脉冲的响应波形
用一系列等幅不等宽的脉冲来代替一个正弦半波,正弦半波N等分,看成N个相连的脉冲序列,宽度相等,但幅值不等;用矩形脉冲代替,等幅,不等宽,中点重合,面积(冲量)相等,宽度按正弦规律变化。SPWM波形——脉冲宽度按正弦规律变化而和正弦波等效的PWM波形。
图3 用PWM波代替正弦半波
要改变等效输出正弦波幅值,按同一比例改变各脉冲宽度即可。 PWM电流波: 电流型逆变电路进行PWM控制,得到的就是PWM电流波。 PWM波形可等效的各种波形: 直流斩波电路:等效直流波形
SPWM波:等效正弦波形,还可以等效成其他所需波形,如等效所需非正弦交流波形等,其基本原理和SPWM控制相同,也基于等效面积原理。
模拟信号的值可以连续变化,其时间和幅度的分辨率都没有限制。9V电池就是一种模拟器件,因为它的输出电压并不精确地等于9V,而是随时间发生变化,并可取任何实数值。与此类似,从电池吸收的电流也不限定在一组可能的取值范围之内。模拟信号与数字信号的区别在于后者的取值通常只能属于预先确定的可能取值集合之内,例如在{0V, 5V}这一集合中取值。
Generating of PWM
The simplest way of generating PWM is using a comparator circuit.
A voltage comparator considers two voltage waveforms A and B, and outputs a binary (two-valued) voltage waveform indicating which is larger (high voltage for 𝑉out states that A is larger and a low voltage that B is larger).
When the voltage of triangular wave is greater than the control voltage, the output of comparator will be high
When voltage of triangular wave is less than the control voltage, the output of comparator will be low
The width of the pulse can be changed depending on the value of the control voltage.
If we reduce the control voltage, the width of the output pulse increases
We can generate PWM from a digital output by switching it on and off, and changing the time for which the digital signal is “high” or “low”, but that would take up the time and effort of the CPU.
- The advantage of handling over responsibility of the PWM signal generation to the specific peripheral in the microcontroller chip, is that the CPU is then available to do other stuff.
- This is one of the powerful aspects of a highly functionalised microcontroller – devolving responsibility for things low PWM, D/A and A/D to the peripherals frees up the time of the CPU.
Analog Geneation of PWM
The Intersective Method:
Allows for analog creation of PWM signal through noting intersections between a sawtooth trigger signal and a reference sinusoid.
Length of pulses is dependent upon intersection of reference sinusoid and trigger signal.
When sinusoid is greater than trigger signal, PWM pulse is switched to on/high position, otherwise it is switched to off/low.
Turning PWM back
The average value of the signal will be determined by the duty cycle
By controlling the duty cycle, we can control the average value
If “on” time is small, average value is low; if “on” time is large,
average value is higher
The average value can be extracted from the PWM signal with a low pass filter – then Vout is an analogue output
3 types of PWM
Lead Edge Modulation:
- The leading edge of the signal is fixed and the trailing edge is modulated in accordance with instantaneous values of message signal.
Trail Edge Modulation
- The trailing edge of the trigger signal is fixed and the leading edge is modulated in accordance with instantaneous values of message signal.
Pulse Center Two Edge Modulation
- The pulse center is fixed in the middle and both edges are modulated about the center of the trigger signal.
Pros & Cons
Average value proportional to duty cycle
Low power used in transistors to switch the signal, and fast switching possible due to MOSFETS (metal-oxide-semiconductor field-effect transistor) and power transistors at speeds in excess of 100 kHz
To fulfill partial power requirements, variable resistance devices such as rheostats were used to control the current entering a device (e.g. sewing machines)
Alleviates the problem of high heat losses through resistive elements at intermediate voltage points
The main advantage of PWM is that power loss in digital switching devices (the FET) is very low.
When a switch is off there is practically no current leaking
- When it is on and power is being transferred to the load, there is almost no voltage drop across the switch
- Power loss, being the product of voltage and current, is thus in both cases close to zero