当前位置:网站首页>Principle and application of PWM
Principle and application of PWM
2022-06-12 07:15:00 【Snow falls on the devil's land】
What is? PWM
PWM(Pulse Width Modulation) Short for pulse width modulation , It is a very effective technology to control analog circuit by using digital output of microprocessor , Widely used in measurement 、 signal communication 、 Industrial control .
PWM The frequency of
It means in 1 In seconds , The number of times the signal goes from high level to low level and back to high level , In other words, one second PWM How many cycles are there , Company Hz.
PWM The cycle of
T=1/f,T It's a cycle ,f It's the frequency .
If the frequency is 50Hz , In other words, a cycle is 20ms, Then there will be... In a second 50 Time PWM cycle .
Duty cycle
Is a pulse period , The ratio of the time of high level to the time of the whole cycle , The unit is % (0%-100%)
The length of a cycle , As shown in the figure below .

among , The period is the time of a pulse signal ,1s Period within T The number of times is equal to the frequency f, Pulse width time refers to high-level time .
Above picture , Ratio of pulse width time to total cycle time , Is the duty cycle .
For example , The time of the cycle is 10ms, The pulse width time is 8ms, Then the duty cycle is 8/10= 80%, This is the duty cycle 80% Pulse signal of .
PWM It's pulse width modulation , The pulse width can be adjusted by adjusting the duty cycle .
PWM principle
With STM32 For example, SCM , Its IO The port can only output high level and low level .
Suppose the high level is 5V、 Low level is 0V, So to output different analog voltages, you need to use PWM. By changing IO The duty cycle of the square wave output from the port , Thus, the analog voltage signal simulated by the digital signal is obtained .
The voltage is applied to the analog load in a pulse sequence , High level when connected 1, Low level when disconnected 0. DC power supply output when connected , When disconnected, the DC power supply is disconnected . By controlling the on and off time , In theory , It can output any voltage value not greater than the maximum voltage 5V The analog voltage of .
For example , Duty ratio 50% That's half the high-level time , Half the low-level time . At a certain frequency , You can get the simulated 2.5V Output voltage . that 75% Duty cycle of , The resulting voltage is 3.75V, As shown in the figure below .

in other words , At a certain frequency , Different output analog voltages can be obtained through different duty cycles ,PWM It is through this principle that the digital analog signal conversion is realized .
PWM application
LED Breathing lights
Take the frequently used breathing lamp for example .
The eyes of ordinary people are very sensitive to 80Hz The above refresh rate has no flicker at all , So what we usually see LED The lamp , When its frequency is greater than 50Hz When , The human eye will produce a visual persistence effect , Basically, there is no flicker , But mistakenly thought it was a constant light LED The lamp .
Since no flicker can be seen at very high frequencies , The larger the duty cycle LED The brighter , The smaller the duty cycle LED The darker , Examples of related breathing lamps :STM32 in PWM Configuration and application of . therefore , When the frequency is constant , It can be changed with different duty cycles LED The brightness of the light , Make it reach the effect of a breathing lamp .
PWM Control of motor speed
The output of different voltages can be realized by adjusting the duty cycle , Realize the adjustment of motor speed .
For DC motors , The motor output pin is high-level, and the motor can rotate , When the output is high , The motor will turn , But it's speeding up bit by bit , When the high level suddenly turns to the low level , The motor will not stop because the inductance can prevent the sudden change of current , Will maintain the original speed , In reciprocating , The speed of the motor is the average voltage output in the cycle , So in essence, our speed regulation is to put the motor in a , It seems to stop , The state of rotating at full speed and not at full speed , Then the average speed in a cycle is the speed adjusted by our duty cycle .
In motor control , The higher the voltage , The faster the motor speed , And by PWM Output different analog voltages , The motor can reach different output speeds .
Of course , In motor control , Different motors have their own frequency Too low frequency will lead to unstable movement , If the frequency is just within the hearing range of the human ear , Sometimes you can hear a whistling sound . When the frequency is too high , The motor may not react , The normal motor frequency is 6-16kHZ It's better between .
PWM Control of steering gear
The steering gear is controlled by a fixed frequency , Give it different duty cycle to control different steering angle .
The frequency of the steering gear is usually 50HZ, That's one 20ms Left and right time base pulses , And the high-level part of the pulse is generally 0.5ms-2.5ms Range , To control different steering angles .
500-2500us Of PWM The high level part corresponds to the control 180 The steering gear 0-180 degree .
With 180 For example, angle servo , So the corresponding control relationship is :
0.5ms-------------0 degree ;1.0ms------------45 degree ;1.5ms------------90 degree ;2.0ms-----------135 degree ;2.5ms-----------180 degree ;
The figure below demonstrates the duty cycle from 1ms Change to 2ms when , The change of the corner .

边栏推荐
- [image denoising] image denoising based on nonlocal Euclidean median (nlem) with matlab code
- 5 lines of code identify various verification codes
- 2022电工(初级)考试题库及模拟考试
- [Li Kou] curriculum series
- ‘CMRESHandler‘ object has no attribute ‘_timer‘,socket.gaierror: [Errno 8] nodename nor servname pro
- TypeScript基础知识全集
- Kali and programming: how to quickly build the OWASP website security test range?
- 6 functions
- FCPX插件:简约线条呼出文字标题介绍动画Call Outs With Photo Placeholders for FCPX
- Curry carries the fourth game of the warriors against the Celtics
猜你喜欢

2 variables and basic types

Category 7

Database syntax related problems, solve a correct syntax

Jackson XML is directly converted to JSON without writing entity classes manually

Kali与编程:如何快速搭建OWASP网站安全实验靶场?

报表工具的二次革命

Detailed explanation of 14 registers in 8086CPU

Demonstrate "topic communication, action communication, service communication and parameter server" with a small turtle case

【图像去噪】基于偏微分方程(PDE)实现图像去噪附matlab代码

Detailed explanation of multi coordinate transformation in ROS (example + code)
随机推荐
网络丢包问题排查
The most understandable explanation of coordinate transformation (push to + diagram)
Detailed explanation of multi coordinate transformation in ROS (example + code)
Matlab 6-DOF manipulator forward and inverse motion
1.3-1.9 summary
CL210OpenStack操作的故障排除--章节实验
Introduction to JDE object management platform and use of from
Pyhon的第四天
【图像检测】基于深度差分和PCANet实现SAR图像变化检测附matlab代码
AI狂想|来这场大会,一起盘盘 AI 的新工具!
What is the difference between < t > and object?
A journey of database full SQL analysis and audit system performance optimization
Pyhon的第六天
Postman splice replacement parameter loop call interface
Noi openjudge computes the n-th power of 2
Detailed explanation of coordinate tracking of TF2 operation in ROS (example + code)
1. Foundation of MySQL database (1- installation and basic operation)
esp32 hosted
Putty installation and use
node:打不开/node:已拒绝访问