PWM Digital to Analog Converter Considerations for PCB Layout

December 3, 2020 Cadence PCB Solutions

Key Takeaways

  • The conversion of digital circuits to analog signals.

  • Using a PWM as a digital to analog converter.

  • Layout considerations for PWM converters.

A bunch of old ADC0804 DAC components in a container

Save PCB space and expense by using PWM outputs to convert digital to analog instead of these DACs.

One of the advantages of buying the deli meat I use for sandwiches is that its reusable plastic container is perfect for storing leftovers from other meals. And while that is a great tip for food preservation, the main point here is that, instead of spending money on an expensive container, I simply repurpose something that I already have. Finding ways to be thrifty like this is not only a handy skill in the kitchen, but it can be helpful in the electronics we design as well.

Take the conversion of digital data to analog signals. Usually, this is done with a digital to analog converter component, but that means placing another part and its related circuitry on your board. By using the PWM functionality that is already in the components you are using in your design though, you can convert the signals without adding another multi-pin component to your design. Here’s some more information on how you can design a PWM digital to analog converter on your next printed circuit board.

The Problem: Converting Digital Circuits to Analog Signals Without Using a DAC

With a good portion of the average circuit board composed of digital circuitry, it is a fairly simple matter to connect those signals to interface devices that are digital in their operation. Take a simple switch for instance. Toggling a signal on or off is about as digital as you can get. But when the devices that digital signals must connect to are analog in nature, the digital signals must be converted to analog signals first. This is usually the job of a digital to analog converter, or DAC. The problem, though, is that you may be working with components in your design that don’t already have a DAC built into them.

If you have the time, space, and budget, you can easily add an external DAC component to your design to handle the conversion. There are many to choose from that come in a variety of package styles. But if you don’t want to add another component to your design, and you also don’t want to change the circuitry you already are using, you will need to find another option. Fortunately, there’s an alternative that is probably already built into your existing circuitry, and that is using the pulse width modulation (PWM) outputs on the microcontroller.

Since most microcontrollers come with at least one PWM peripheral, it is simply a matter of using a resistor and a capacitor to create a low-cost digital to analog converter. These converters will not have the most accuracy though, and an external DAC should be used if that is a concern. But for general purposes, the PWM could be the alternative you’ve been looking for.

A 3D layout from OrCAD PCB Designer

Power circuitry on a printed circuit board

The Benefits of Designing for a PWM Digital to Analog Converter

Pulse width modulation produces variable voltages by changing the width of the signal pulse instead of its frequency. To vary the voltage, the high and low of the digital signal is broken up into ON and OFF sections. The duration period, or pulse, of both the high and low states, remains the same, but the amount of time the signal is either ON or OFF will change to create different voltages. For instance, a signal with a high and low state at 10 and zero volts respectively will be reduced to five volts if the ON state or “duty cycle” of the pulse is 50%. Likewise, if the duty cycle of the same pulse is at 25% while the low state is at 75%, then that signal will produce only 2.5 volts.

The PWM can also use this same process voltage creation to generate the analog signal that is needed. The desired voltage is created by the PWM and then transmitted by a digital carrier wave to the RC circuit. There, it is filtered through the resistor and capacitor to smooth it to its average value. The PWM can be programmed to create multiple voltages to create the complete analog signal.

One of the parameters for selecting which digital to analog converter to use is its resolution value in “bits.” In a conventional DAC component, the resolution is based on how many distinct output voltages it can generate. Since each duty cycle of a PWM signal corresponds to a particular output voltage, the PWM can also be identified by its resolution just as conventional DAC is. There is obviously more to using a PWM as a DAC than what we’ve covered in this simple explanation, but this will give you an idea of what is possible with the PWM outputs of a microcontroller on your design.

OrCAD PCB Designer’s constraint management system

A constraint management system in the PCB design tools is essential to a good component placement

Layout Considerations for PWM Digital to Analog Converter Circuits

When you are determining the resolution of the PWM on your design, you must consider the effects of output voltage ripple. This ripple occurs when the PWM charges and discharges the resistor and capacitor. The effect can be mitigated by increasing the values of the RC circuit, but that can also increase the amount of time that the ripple voltage will take to settle. To compensate for that, you can add a second RC filter circuit, but the additional components will take up more room on your layout.

As with any power circuitry, you should keep your RC filter components close to the PWM outputs. Also, make sure to keep your digital and analog components separated, and use separate ground planes to isolate the analog and digital return paths.

Another thing that will be helpful is to use a PCB design system that has features built into it for helping you to design circuits like PWM digital to analog converters. OrCAD PCB Designer has functionality, like its constraint management system, that allows you to set up specific component-to-component placement rules to ensure that your analog and power circuitry is laid out correctly.

If you’re looking to learn more about how Cadence has the solution for you, talk to us and our team of experts

 

About the Author

Cadence PCB solutions is a complete front to back design tool to enable fast and efficient product creation. Cadence enables users accurately shorten design cycles to hand off to manufacturing through modern, IPC-2581 industry standard.

Follow on Linkedin Visit Website More Content by Cadence PCB Solutions
Previous Article
The Circuit Simulations You Need in VLSI Layout and Design
The Circuit Simulations You Need in VLSI Layout and Design

Circuit simulations are an integral part of VLSI layout and systems design.

Next Article
What Causes Thermal Hysteresis in a Voltage Reference?
What Causes Thermal Hysteresis in a Voltage Reference?

Thermal hysteresis creates permanent changes in the output voltage from a precision reference voltage circuit.