# The Duty Cycle For PWM Voltage in Electronics

February 26, 2020

Explaining that a beautiful butterfly is once a helpless caterpillar to toddlers is intriguing. You’ll be barraged by questions as they try to comprehend the life cycle of a butterfly. I’m still struggling to convince my 8-year old son that the butterfly was once a caterpillar.

I was thinking of getting a real caterpillar as an example but decided that searching for Youtube clips is a better solution. While watching a simple video clip helps to paint a clearer picture on a butterfly’s life cycle, understanding the duty cycle in electronics takes more than that.

## What Is Duty Cycle

To understand the duty cycle, you’ll need to be familiar with a square wave. A square wave is unlike the sinusoidal waveform. Instead of having curved lines, a square wave is made up of vertical and horizontal lines such as the image below.

The square wave is commonly produced in digital electronics, where logics are represented by voltage levels indicating ‘1’ and ‘0. In a square wave, the voltage level rises and falls almost instantly to form squarish shapes on the chart.

Depending on the application, logic 1’s and 0’s of the waveform may have different ratios of duration. The term duty cycle refers to the duration of the positive cycle against the total duration where the waveform completes a single cycle.

For example, the waveform depicted above has a 50% duty cycle, as the positive cycle occupies half of the entire duration. The duty cycle is also applicable for the triangular and sawtooth waveforms.

## PWM Duty Cycle And Applications

In electronics, square waves with varying duty cycles are produced in a method called pulse width modulation or PWM. The PWM is the digital electronics answer to their analog counterparts of controlling analog devices. For example, an LED can be dimmed by decreasing the voltage that falls across it.

Dimming is often achieved by a variable resistor, where the voltage is scaled down. In digital electronics, the only possible voltage levels are those that of logic 1 and 0. However, by varying the duty cycle of a square wave signal, the process of dimming can be achieved. In actual applications, the frequency of the square wave is equally important as the duty cycle. That’s because the squarewave needs to be sufficiently fast to ensure the dimming does not result in flickers.

PWM is also commonly used in servo motors, where the duration of the pulse and duty cycle becomes more important. Servo motors usually specified the required duty cycle and duration in order to move its shaft in a certain direction. In some servo motors, a 20% duty cycle of a 20 ms square wave will rotate the shaft in 180 degrees while a 10% duty cycle will reset it to its original position.

PWM duty cycle determines how the servo motor rotates.

The beauty of PWM is that it’s far more efficient than applying analog voltage. As a comparison, the same brightness on an LED can be achieved with lesser heat by using PWM. However, PWM signals can lead to noisy circuits on the PCB, which means you’ll need to be diligent with EMI prevention in the design.

## How To Generate PWM Signals With The Required Duty Cycle

There are a few ways to go about generating PWM signals in your design. A cost-effective method is to use the classic 555 timer IC as a PWM generator. A variable resistor is used to adjust the duty cycle of the PWM produced by the PWM generator.

In more complicated circuits, where auto-tuning of the duty cycle is required, PCB designers often turn to microcontrollers. Most microcontrollers have PWM functionality built on where the registers can be configured for the pins to produce the desired duty cycle. In some cases, the functionality of PWM is introduced in the firmware by manually clocking the pin on a specific interval.

Regardless of your choice, it’s important to ensure that the PWM doesn’t introduce electrical interference to adjacent signals. To be safe, the suite of PCB design and analysis tools at Cadence will be sure to augment any necessity for your designs. Furthermore, OrCAD PCB designer is capable of any layout flexibility you need to ensure your designs go off without a hitch.