Introduction to Pulse Width Modulation (PWM)

脉宽调制(PWM)是一种利用处理器的数字输出来控制模拟电路的强大技术。它广泛应用于从测量、通信到功率控制和转换等多个领域。本文介绍了模拟电子设备的特点、PWM的工作原理及其在数字控制中的优势。

      Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a processor's digital outputs. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion.

Analog electronics

An analog signal has a continuously varying value, with infinite resolution in both time and magnitude. A nine-volt battery is an example of an analog device, in that its output voltage is not precisely 9V, changes over time, and can take any real-numbered value. Similarly, the amount of current drawn from a battery is not limited to a finite set of possible values. Analog signals are distinguishable from digital signals because the latter always take values only from a finite set of predetermined possibilities, such as the set {0V, 5V}.

Analog voltages and currents can be used to control things directly, like the volume of a car radio. In a simple analog radio, a knob is connected to a variable resistor. As you turn the knob, the resistance goes up or down. As that happens, the current flowing through the resistor increases or decreases. This changes the amount of current driving the speakers, thus increasing or decreasing the volume. An analog circuit is one, like the radio, whose output is linearly proportional to its input.

As intuitive and simple as analog control may seem, it is not always economically attractive or otherwise practical. For one thing, analog circuits tend to drift over time and can, therefore, be very difficult to tune. Precision analog circuits, which solve that problem, can be very large, heavy (just think of older home stereo equipment), and expensive. Analog circuits can also get very hot; the power dissipated is proportional to the voltage across the active elements multiplied by the current through them. Analog circuitry can also be sensitive to noise. Because of its infinite resolution, any perturbation or noise on an analog signal necessarily changes the current value.

Digital control

By controlling analog circuits digitally, system costs and power consumption can be drastically reduced. What's more, many microcontrollers and DSPs already include on-chip PWM controllers, making implementation easy.

In a nutshell, PWM is a way of digitally encoding analog signal levels. Through the use of high-resolution counters, the duty cycle of a square wave is modulated to encode a specific analog signal level. The PWM signal is still digital because, at any given instant of time, the full DC supply is either fully on or fully off. The voltage or current source is supplied to the analog load by means of a repeating series of on and off pulses. The on-time is the time during which the DC supply is applied to the load, and the off-time is the period during which that supply is switched off. Given a sufficient bandwidth, any analog value can be encoded with PWM.

Figure 1 shows three different PWM signals. Figure 1a shows a PWM output at a 10% duty cycle. That is, the signal is on for 10% of the period and off the other 90%. Figures 1b and 1c show PWM outputs at 50% and 90% duty cycles, respectively. These three PWM outputs encode three different analog signal values, at 10%, 50%, and 90% of the full strength. If, for example, the supply is 9V and the duty cycle is 10%, a 0.9V analog signal results.


Figure 2 shows a simple circuit that could be driven using PWM. In the figure, a 9 V battery powers an incandescent lightbulb. If we closed the switch connecting the battery and lamp for 50 ms, the bulb would receive 9 V during that interval. If we then opened the switch for the next 50 ms, the bulb would receive 0 V. If we repeat this cycle 10 times a second, the bulb will be lit as though it were connected to a 4.5 V battery (50% of 9 V). We say that the duty cycle is 50% and the modulating frequency is 10 Hz.


PWM controllers

Many microcontrollers include on-chip PWM controllers. For example, Microchip(link is external)'s PIC16C67 includes two, each of which has a selectable on-time and period. The duty cycle is the ratio of the on-time to the period; the modulating frequency is the inverse of the period. To start PWM operation, the data sheet suggests the software should:

  • Set the period in the on-chip timer/counter that provides the modulating square wave
  • Set the on-time in the PWM control register
  • Set the direction of the PWM output, which is one of the general-purpose I/O pins
  • Start the timer
  • Enable the PWM controller

Although specific PWM controllers do vary in their programmatic details, the basic idea is generally the same.

Communication and control

One of the advantages of PWM is that the signal remains digital all the way from the processor to the controlled system; no digital-to-analog conversion is necessary. By keeping the signal digital, noise effects are minimized. Noise can only affect a digital signal if it is strong enough to change a logic-1 to a logic-0, or vice versa.

Increased noise immunity is yet another benefit of choosing PWM over analog control, and is the principal reason PWM is sometimes used for communication. Switching from an analog signal to PWM can increase the length of a communications channel dramatically. At the receiving end, a suitable RC (resistor-capacitor) or LC (inductor-capacitor) network can remove the modulating high frequency square wave and return the signal to analog form.

PWM finds application in a variety of systems. As a concrete example, consider a PWM-controlled brake. To put it simply, a brake is a device that clamps down hard on something. In many brakes, the amount of clamping pressure (or stopping power) is controlled with an analog input signal. The more voltage or current that's applied to the brake, the more pressure the brake will exert.

The output of a PWM controller could be connected to a switch between the supply and the brake. To produce more stopping power, the software need only increase the duty cycle of the PWM output. If a specific amount of braking pressure is desired, measurements would need to be taken to determine the mathematical relationship between duty cycle and pressure. (And the resulting formulae or lookup tables would be tweaked for operating temperature, surface wear, and so on.)

To set the pressure on the brake to, say, 100 psi, the software would do a reverse lookup to determine the duty cycle that should produce that amount of force. It would then set the PWM duty cycle to the new value and the brake would respond accordingly. If a sensor is available in the system, the duty cycle can be tweaked, under closed-loop control, until the desired pressure is precisely achieved.

PWM is economical, space saving, and noise immune. And it's now in your bag of tricks. So use it.
  
  
  
毫米波雷达系统工作在毫米波频段,通过发射与接收电磁波并解析回波信号,实现对目标的探测、定位及识别。相较于传统雷达技术,该系统在测量精度、环境抗干扰性及气象适应性方面表现更为优越。本研究聚焦于德州仪器开发的IWR1843DCA1000型号毫米波雷达,系统探究其在多模态数据采集与多样化应用场景中的技术路径及创新实践。 IWR1843DCA1000传感器为一款高度集成的毫米波探测设备,采用调频连续波技术与多输入多输出架构,可执行高精度目标测量及成像任务。研究过程中,团队对该设备的性能参数进行了全面评估,并在下列领域展开应用探索: 在数据采集环节,借助专用硬件接口连接雷达传感器,实现原始信号的高效捕获。团队研发了配套的数据采集程序,能够实时记录传感器输出并执行初步信号处理,为后续分析构建数据基础。 通过构建FMCW-MIMO雷达仿真平台,完整复现了雷达波的发射接收流程及信号处理机制。该仿真系统能够模拟目标运动状态及环境变量对雷达波形的影响,为系统性能验证与参数优化提供数字化实验环境。 基于高分辨率测距能力,结合目标检测与轨迹追踪算法,实现对人体运动模式的精确重构。通过点云数据的解析,为行为模式分析与场景理解提供多维信息支撑。 利用雷达回波信号的深度解析,生成表征人体空间分布的热力图像。该技术为复杂环境下的定位问题提供了直观可视化解决方案。 针对精细手势动作的识别需求,应用机器学习方法对雷达生成的点云序列进行特征提取与模式分类,建立手势动作的自动识别体系。 通过分析人体表面对毫米波信号的反射特性,开发非接触式生理参数监测方法,可有效检测呼吸韵律与心脏搏动频率等生命体征指标,为健康监护领域提供新的技术途径。 本研究的顺利开展,不仅深化了IWR1843DCA1000雷达系统的应用研究层次,同时为毫米波技术在多元领域的拓展应用建立了技术支撑体系。通过实证分析与仿真验证相结合的研究模式,该项目为行业应用提供了可靠的技术参照与实践范例,有力推动了毫米波雷达技术的产业化进程。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
基于直接模拟蒙特卡洛(DSMC)方法的气体分子运动仿真工具,为微观尺度气体动力学研究提供数值计算支持。该计算工具通过统计方法模拟稀薄条件下气体粒子的运动轨迹与碰撞行为,适用于航空航天工程、微纳流体系统等存在低密度气体效应的技术领域。 为便于高等院校理工科专业开展数值仿真教学,开发者采用矩阵实验室(Matlab)平台构建了模块化仿真程序。该程序兼容多个Matlab发行版本(2014a/2019b/2024b),内置标准化案例数据集可实现开箱即用。程序架构采用参数化设计理念,关键物理参数均通过独立变量模块进行管理,支持用户根据具体工况调整分子数密度、边界条件和碰撞模型等参数。 代码实现遵循计算流体力学的最佳实践规范,主要特征包括:采用分层模块架构确保算法逻辑清晰,关键计算单元配备完整的物理注释,变量命名符合工程仿真惯例。这种设计既有利于初学者理解分子动力学模拟原理,也方便研究人员进行算法改进与功能拓展。 该教学工具主要面向计算机科学、电子工程、应用数学等专业的本科教学场景,可用于课程实验、综合设计项目及学位论文等学术活动。通过将抽象的气体动力学理论转化为可视化的数值实验,有效促进学生对统计物理与计算方法的融合理解。在工程应用层面,该工具能胜任微机电系统流场分析、高海拔空气动力学特性研究、纳米孔道气体输运等现象的定量评估。 随着微纳制造与空间技术的发展,稀薄气体仿真在半导体工艺优化、临近空间飞行器设计等前沿领域的应用价值日益凸显。本仿真工具通过提供可靠的数值实验平台,为相关领域的科研创新与人才培养提供技术支持。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值