http://analogtalk.com/?p=534

http://analogtalk.com/?p=551

Posted by AnalogAdvocate on April 09, 2010 
Design, General

In today’s highly competitive electronics environment, designers are constantly looking for ways to reduce overall system costs.  One of the most commonly asked questions that analog specialists at digital microcontroller (MCU) companies hear from customers is, is the almost cost-free Pulse-Width-Modulation (PWM) Digital-to-Analog Converter (DAC) good enough for my application, or do I need a higher-performance, standalone DAC instead?”

The generation of an analog voltage using a digital Pulse-Width-Modulated signal is known as a PWM DAC.  As most designers’ PCB boards have a microcontroller with a built-in PWM-output feature onboard, a simple digital-to-analog data conversion can be easily realized by adding a few passive components at the MCU’s PWM-output pin.  This is an alternative to using a standalone DAC.  In the MCU application environment, system designers can have DAC functionality nearly free of charge.  PWM DACs are widely used in very low-cost applications, where accuracy is not a primary concern.   Standalone DACs, however, are used for applications requiring higher accuracy.

Although the PWM DAC can be realized with the simple addition of a few passive components, implementing a PWM DAC for system applications is not a simple task.  There are many limitations associated with this. Understanding the complexities of using the PWM DAC and its effects can save significant development time and effort.   This article presents a technique for converting a PWM pulse to an analog voltage using a simple, RC low-pass filter. This entry also reviews the PWM DAC’s limitations and its key design constraints on resolution, frequency, ripple, settling time and current consumption are discussed, which are very important design parameters that are largely affected by the R and C values, as well as the PWM duty cycle and frequency.

Standalone DACs

Figure 1 shows an example of a standalone DAC.  Its analog output voltage is given by:

Where Dn is the digital code.  For example, with a 12-bit DAC, the user can get Vout = 2.5V with Vref = 5V and Dn = 1000-0000-0000.  Typical standalone DAC devices provide good linearity and a short settling time, which is the time required to update each output voltage.

Figure 1 Configuration of Standalone DAC

How PWM DACs Work

Figure 2 shows a basic configuration of the PWM DAC. The MCU outputs a PWM signal to an RC low pass-filter. The PWM pulse train’s digital value becomes an analog voltage, when it passes through the RC filter.  At a given period of time, the analog output is proportional to the PWM pulse’s high durations.

Figure 2 Block Diagram of a PWM DAC

A PWM signal is defined as a digital signal with a fixed frequency, but a varying duty cycle.  Figure 3 illustrates a PWM signal.  The PWM period (T) is the time interval required to complete one full PWM cycle.  The duty cycle is the ratio of the high duration (t) to the total period (T).

Figure 3 PWM Signal

The PWM signal and RC-filter circuit parameters affect the analog output’s resolution, amplitude, settling time and ripple.  The PWM DAC’s limitations are clearly demonstrated by analyzing the interaction of the PWM parameters and the RC filter.  A better understanding of the relationship between these parameters enables designers to optimize the PWM to best suit their application’s requirements, while minimizing design time.

PWM DAC Bit Resolution

The PWM counter length (L) and the smallest duty-cycle change in the PWM counter (C) determine the PWM DAC’s bit resolution.  The following equation expresses the maximum bit resolution of the PWM DAC:

For example, if the system generates an analog output voltage from a PWM DAC with a counter of 4096 (L) and a minimum count step of one (C), the PWM DAC’s bit resolution is 12-bits.

When the PWM resolution is determined, it is possible to calculate the Least Significant Bit (LSB) size.  The LSB size is dependant upon the PWM resolution and the PWM’s output-high level voltage (VOH), and can be calculated using the following equation.

For example, a 12-bit PWM DAC with a VOH of 5V has an LSB size of 1.2mV.

RC Filter Design Considerations for PWM DAC

One key design consideration when determining the PWM’s resolution is output-voltage ripple. Ripple occurs due to overshoot and undershoot as the PWM charges and discharges the RC circuit. One way to approximate the charge characteristics is to modify the equations to charge and discharge an RC-filter circuit. As the effects of this are cumulative, the following equations can be used as approximations.

(4)(5)(6)

VLH is the voltage increase for a specific PWM period, and VHL is the voltage decrease for a specific PWM period. The values of VLH and VHL are dependant upon not only the RC filter values, but also upon the PWM frequency and duty cycle. The PWM frequency and duty cycle determine the time available for the PWM to charge (tcharge) and discharge (tdischarge) the capacitor. Vripple is the difference between VLH and VHL for the same PWM period.

Figure 4 illustrates the magnitude of the voltage ripple across the output capacitor vs. time. The vertical axis displays the magnitude of the ripple voltage, while the horizontal axis provides the corresponding time. The plot shows how the ripple voltage settles at approximately 125 mV in a time interval of approximately 40 ms for R = 10K ohms, and 250 mV at 20 ms for R = 1 K ohm. In the previous example, an LSB size of less than 1.2mV for a 12-bit system was needed. This ripple is greater than 100 LSB for 12-bit DAC with a 5V reference, meaning that the resulting PWM DAC solution has an effective resolution of less than 6 bits due to the ripples.

Figure 4: Voltage Ripple Comparison for VOH = 5V, C = 1μF, PWM frequency = 1 kHz, Duty Cycle = 50%

The ripple can be reduced by increasing the capacitor and the resistor values or increasing the PWM frequency. All of these will decrease the ripple’s magnitude.

As shown in Figure 4, the ripple decreases as the resistance value increases. However, nothing comes without a price-the settling time doubles as the ripple decreases by 50 %.

For applications that require faster settling time (increased bandwidth) and higher resolution, one could add a second RC filter. The obvious tradeoffs include the cost of additional components and the increased board space occupied. Figure 5 shows a model for a two-pole RC low-pass filter. Figure 6 shows the analog output voltage of this model.

Figure 5: PSPICE Model for Two-Pole RC Low-Pass Filter

Figure 6: Analog Voltage Output vs. Settling Time of the Two Pole RC Low-Pass Filtere

There are a couple of things to keep in mind when designing the filter. First, make sure that the pole of the RC is set at a much greater frequency than that of the signal being generated. Secondly, if you are designing a two-pole filter, make sure that R2 > R1.

The 3dB corner frequency of the RC filter is given by:

(7)

There are a couple of additional things to consider. Increasing the PWM frequency will also decrease the ripple, but the tradeoff is increased settling time. Figure 7 shows the cases for 10 kHz and 5 kHz

Figure 7: Voltage Ripple at the PWM DAC when PWM Frequency Changes. Where VOH = 5V, C = 1μF, R = 10 kΩ, Duty Cycle = 50 %, PWM Frequency = 10 kHz and 5 kHz

The worst-case ripple occurs at a 50% duty cycle. The ripple will decrease as the duty cycle moves closer to 0% or 100%. Figure 8 shows the peak-to-peak magnitude of ripples on the PWM DAC output. The ripple decreases almost two times as the duty cycle changes from 50 % to 85 %.

Figure 8: Voltage Ripple at the PWM DAC when PWM Duty Cycle Changes. VOH = 5V, C = 10 μF, R = 1 kΩ, PWM Frequency = 1 kHz, Duty Cycle = 50 % (Solid Curve) and 85 % (Dotted Curve)

PWM DACs and Power Consumption

Many electronic products today are portable or handheld devices. These devices are battery powered, and many have strict constraints with regard to power consumption. Therefore, it is a good idea to minimize the PWM DAC’s power consumption. The current consumed in the PWM solution is simple to approximate, using the following equation:

(8)

Figure 9: Current and Voltage Plots of PWM DAC with R =1000 Ω, C = 10μF, Duty Cycle = 50 %, VOH = 5V

Figure 9 shows the current and voltage plots. As sown in the plot, the PWM DAC with a lower resistor draws a significant amount of current (in the range of a few mA). This high level of current consumption is unacceptable for many battery-powered applications. Current can be decreased by increasing the resistor value.

In Figure 10, the resistor value has been increased by a factor of ten, which has likewise decreased the current consumption by a factor of ten.

Figure 10:  Current and Voltage Plots of PWM DAC with R =10,000 Ω, C = 10μF, Duty Cycle = 50 %, VOH = 5V

As the resistor limits the current available to charge/discharge the capacitor, decreasing the amount of current available (increasing resistance) to the circuit will increase the settling time.

Another factor to consider is the filter’s pole. As the resistor value increases, the 3 dB frequency decreases by the same magnitude. This can be compensated for by reducing the capacitor value by the same magnitude, which offsets the increased settling time and maintains the original pole of the filter. Figure 11 demonstrates this. Note that, as the capacitor value reduces, the circuit becomes more susceptible to loading. This is another important design consideration.

Figure 11: Current and Voltage Plots of PWM DAC with R =10,000 Ω, C = 1μF, Duty Cycle = 50 %, VOH = 5Vircuit

转载于:https://www.cnblogs.com/shangdawei/p/3194613.html

PWM DAC vs. Standalone相关推荐

  1. PWM DAC应用试验

    PWM DAC原理 PWM本质上是周期一定,高低电平占空比可调的方波 函数表示: 展开傅里叶级数: N:PWM波一周期中高电平的计数脉冲个数,即STM32ARR-1的值 n:PWM波一周期中高电平的计 ...

  2. 用PWM实现DAC功能

    现在单片机型号很多,但是内部拥有12位DAC且性价比较高的芯片恨少,导致在芯片选型时,捉襟见肘.没办法,就想着用PWM实现DAC的功能,这只是初步理论,还没有实践过,先贴出来,后续实现再看效果如何吧. ...

  3. 正点原子:STM32F103(战舰)、STM32F407(探索者)、STM32F103(MINI)原理图和PCB

    目录 1.STM32F103(战舰) 2.STM32F407(探索者) 3.STM32F103(MINI) 为各位嵌入式好朋友分享三个重磅资源,正点原子三件套,可直接打样使用~ 1.STM32F103 ...

  4. 咦?智能颈部按摩仪还能语音播报,快搞起来!

    一.档位切换实现 1.档位实现原理 按摩仪共设置15个档位,可以控制按摩的力度,通过BOOST升压电路实现. 通过P8口产生PWM波,调节PWM输出的正占空比来实现升压,详细的硬件原理可参考硬件部分关 ...

  5. 基于WT588F02B语音芯片的智能语音感应洗手液器设计方案

    随着人类文明的进步,人们对健康卫生越来越重视,特别是在当前新冠疫情的情景下,出门戴口罩,回家消毒洗手尤为重要,其中洗手已经成为人们日常生活中必不可少的一个环节.这就诞生了很多与洗手有关的产品,这里主要 ...

  6. STM32F4开发板硬件简介

    参考:STM32F4开发板硬件平台简介 作者:SKY丶丿平才 发布时间: 2021-03-20 10:44:41 网址:https://blog.csdn.net/weixin_48264057/ar ...

  7. 语音芯片排行榜,为何唯创知音WT588F语音芯片如此受欢迎

    随着智能家居.智能玩具.智能机器人等领域的快速发展,语音芯片逐渐成为智能硬件的重要组成部分.在众多语音芯片中,唯创知音WT588F语音芯片备受关注,成为市场上备受欢迎的产品.那么,WT588F语音芯片 ...

  8. ARM Mbed在线IDE编程意法半导体(ST)开发板

    硬件 软件 介绍 STM32F407发现板不直接支持MBED在线IDE. 但是该板上的MCU也用于另一块官方MBED板上(Seeed Studio Arch Max v1.1). 因此,可以通过将发现 ...

  9. STM32F4开发板硬件平台简介

    文章目录 前言 一.ALIENTEK 探索者 STM32F4 开发板资源初探 1.开发板资源图 2.ALIENTEK 探索者 STM32F4 开发板板载资源汇总 3.ALIENTEK 探索者 STM3 ...

  10. STM32F4 | 最小系统设计 | 开发板资源介绍 | 开发环境搭建 | 程序下载

    文章目录 一.STM32最小系统设计 1.什么叫MCU最小系统? 2.STM32最小系统 2.1 供电电路(电源部分) 2.2 复位电路 2.3 时钟电路 2.4 BOOT启动模式选择 2.5 下载电 ...

最新文章

  1. dnf mysql数据库密码,CentOS7使用dnf安装mysql的方法
  2. Git 笔记 上传文件至github
  3. 三种会计科目表:运营会计科目表、国家会计科目表、集团会计科目表
  4. WebView跳转到底部
  5. 怎么禁止浏览器自动保存密码?
  6. dom4j处理XML的一些经验
  7. 1.5W 字搞懂 Spring Cloud,太牛了!
  8. Dialog的半透明背景的灰度
  9. 利用js实现文件上传
  10. Centos7系列各版本镜像合集下载
  11. 既有禀赋上的自然延展:中国移动咪咕进军元宇宙的底层逻辑
  12. 掌握哪些知识,才能被称得上一名合格的前端开发工程师?
  13. 【艾琪出品】-【计算机】《办公自动化基础》-韩伟颖(2002)南开离线作业学习资料
  14. shadertoy 实现简易指南针
  15. matlab中用不同的颜色和形状在图上画出点的位置
  16. 挫败、迷茫、无聊时值得一看的“有点励志的故事和语录”
  17. ACM-ICPC 2018 南京赛区网络预赛 I.Skr(Manacher马拉车+Hash哈希/回文树)
  18. 13.4.2 查询某列数据的总和
  19. pyqt5 日历设计 QSS
  20. 2009年具有高等学历教育招生资格普通本科高职院校名单

热门文章

  1. 关于redis内存分析,内存优化
  2. c语言随机生成算式的对错判断,蔡奇宏软件工程第二次作业--四则运算
  3. Collectors.toMap()
  4. Collectors.toSet()
  5. python oop 实践_Python OOP示例?
  6. keil5图标变成白色_【网上最简单】Chrome安装后打不开任何页面 amp; 改名后图标变成小白块[30秒解决]...
  7. 广东开放大学学习指南
  8. 【sklearn第二十八讲】验证曲线
  9. 操作SSO对象模型时,异常“SSO_E_CANARY_VALIDATION_FAILURE”的处理
  10. 一次排查服务器端接口报500错误的经历