How and Why to Convert Analog Signals to PWM Signals

Key Takeaways

  • Understand the difference between analog and pulse width modulation (PWM).

  • Learn how to convert analog signals to PWM signals.

  • Pick up design tips for analog to PWM converters.

I have never been a good photographer. Yet, I can clearly remember the first time I took a picture with my old Kodak camera. That was almost two decades ago, and in 2012, Kodak filed for bankruptcy as it failed to transition quickly and effectively enough into the era of digital photography. 

I’m no longer fiddling with film (analog) cameras, as I’ve become comfortable with a smartphone and its various filter apps. Still, Kodak’s downfall as an industry leader is a lesson on flexibility—particularly in moving from one technology to another. Somehow, this all reminds me of how important it is to be able to convert an analog signal to its pulse width modulation (PWM) counterpart. Because doing so requires—and affords—a similar flexibility to circuit design, and that is going to be the focus of this article. 

Analog vs. PWM

A graph showing a pulse width modulation PWM signal

Example of a PWM signal.

Analog to PWM conversion can be confusing for those who are not familiar with the two technologies. PWM can be used to produce analog signals. However, analog signals are not PWM signals. Does that make sense? Let’s dive a little deeper. 

An analog signal is a continuous signal where there seems to be an unbroken continuity of its waveform over an infinite time period. A sine wave is an example of an analog signal. When you’re turning a dimming knob, you’re changing the voltage supplied analogously. 

Meanwhile, PWM is a technique that changes the duty cycle of a digital signal. The duty cycle is the ratio of the signal’s active interval against the time of a complete cycle. A 50% duty cycle PWM signal is where the waveform has a balanced interval of lows and highs.  

PWM is usually sent as square waves and is commonly used for power transfer, servo motor control, and as a communication protocol. It can also be used to generate analog voltage by altering the duty cycle accordingly to the desired value. A capacitor is then used to smooth the PWM waveform. 

How to Convert Analog to PWM Signals

A microcontroller for converting analog to PWM signals

A microcontroller converts analog to PWM signals.

Occasionally, you’ll need to convert analog to PWM signals. For example, an analog signal wouldn’t work for a servo motor. To rotate a servo motor, a specific PWM pulse must be transmitted. LED lights are also commonly driven by PWM, as it’s more efficient in terms of power.

So, you’ll need to work on a circuit that takes in the user input in analog form and turns it into the correct PWM signal. A low-cost method to convert analog to PWM signals is to use a specialized IC, like the LT6992. It is a PWM generator where you can control the duty cycle by feeding in an analog signal of 0-1V.

While using the LT6992 IC is the simplest method, it isn’t suitable for complex algorithms or the non-linear relationship of analog and a PWM output—for example, mapping a 360° knob to a servo motor, which turns from 0°-180°. A servo motor’s maximum rotation is usually achieved at a 10% duty cycle. Therefore, you’ll need to convert the full analog range of the knob to scale within the 10% duty cycle limit of the PWM output.

In such cases, you’ll need to use a microcontroller with an ADC input and a PWM generator. The ADC will sample the input and convert it into a digital value. Then, a function is written to generate the corresponding duty cycle and feed it into the PWM register. 

Hardware Design Tips for an Analog to PWM Converter

A green printed circuit board sitting atop a paper circuit schematic

Keeping analog and PWM signals apart to prevent noise coupling is crucial.

Whether you’re using a single chip or a microcontroller, you need to be aware that you’re working with analog and digital pulses. It’s always a good practice to keep both types of signals separate. Digital pulses, particularly when transmitted at high-frequency, can result in EMI radiation. 

You’ll want to prevent the PWM output from interfering with other components, particularly if it’s driving a high-frequency component. Also, the analog input should be protected from EMI to ensure signal integrity. Therefore, it is crucial to ensure proper ground separation and the shortest return path for both signals.

Designing an analog to PWM converter isn’t difficult if you’re using the right PCB design and analysis tools. OrCAD PCB designer allows you to plan the component placement and enforce strict design rule checks, which makes less work for you and makes sure things get done right the first time. 

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
Three Key PCB Heat Dissipation Techniques
Three Key PCB Heat Dissipation Techniques

Designing reliable electronic products is contingent upon implementing PCB heat dissipation techniques to h...

Next Article
The Key Questions to Ask a PCB Manufacturer
The Key Questions to Ask a PCB Manufacturer

This article outlines key questions that design and engineering teams should ask PCB manufacturers.

OrCAD Free Trial

Try OrCAD Today