Skip to main content

PWM Microcontrollers: PCB Layout Tips and Configurations

Key Takeaways

  • The problems with conventional power modulation systems.

  • How PWM can be a better solution for power modulation.

  • Layout tips for PWM circuits.

3D rendering of the Wright brother’s flying machine for an analogy about PWM microcontrollers

To power their flying machine, the Wright brothers needed a better engine, so they built it

The Wright brothers faced a lot of problems that had to be solved in order to achieve the first successful powered flight. Chief among those was finding an engine that would produce at least 8 horsepower and weigh less than 200 lbs. As there wasn’t anything available from the automotive market that met those specifications, they decided to invent and build their own. The result was an engine that produced 12 horsepower and weighed 180 lbs, which was better than their initial expectations. And the rest is history, as they say.

“There’s got to be a better way,” is the phrase that inventors thrive on; a perfect example of this is Pulse Width Modulation (PWM) which is used to produce variable levels of power, as opposed to other less effective methods of modulation. The principles of PWM are used in many applications, such as telecommunications, audio effects, and lighting, as well as in electronics where a PWM signal can be generated by a microcontroller. Let’s take a look at the electronic effects of PWM and how best to lay out the circuitry of a PWM microcontroller.

The Problem with Turning up the Power

Traditionally, variable power has been controlled using a rheostat connected to the motor or whatever device is being operated. In the case of a motor, the rheostat adjusts the amount of current flowing through the motor to produce different speeds. Although this has worked--as in the case of older appliances such as a sewing machine with a foot pedal--it was also inefficient. The rheostat would waste the power that was being restricted by converting it to heat.

This type of control is typical of analog systems.  For instance, take linear power supplies, which can create a lot of heat in their operation due to the amount of current that is being controlled. With the need to operate digital systems, such as small fan motors, lights, and other devices, another method of modulating power was needed that was more efficient. The answer is PWM, which has proven to be an excellent solution for these applications.

3D layout of some power components on a circuit board

Power components and their routing on a circuit board.

How Pulse Width Modulation Can Be the Better Way

Pulse width modulation is a method of modulating power by changing the width of the pulse instead of changing the frequency of the signal. This produces variable voltages using digital circuitry instead of analog. Digital circuits typically produce just two voltages: the high and the low, or the ON and the OFF. To create the PWM power from a digital signal, the signal is broken up into ON and OFF pieces. The duration of the pulse period is constant, but the amount of time that the pulse is either in the ON or OFF state is changed.

The ON or high state of the pulse is called the “duty cycle,” and it is important in how variable power is produced. For example, a 50% duty cycle means that half of the pulse is at the high state while the other half is at the low state. If the high state of the signal is 5 volts and the low is 0 volts, then the output voltage will be at 2.5 volts. Since the total pulse time is constant, a 25% duty cycle will result in one-quarter of the pulse being at the high state while three-quarters of it will be at the low state. This will give you an output of 1.25 volts. By varying the duty cycle, you can vary the voltage output.

PWM is a very effective method of controlling power digitally. Although many PWM circuits are built using different timing chips, there are also PWM outputs in microprocessor chips as well. The PWM capabilities built into CPUs in computers can be extremely helpful in controlling variable-speed fan motors or LEDs. In the case of LEDs, for instance, they are nonlinear when current is applied to them and will not produce 50% of their light with only 50% of the current. This makes an LED more difficult to control by changing the current, whereas using a PWM, instead, will give a more linear control to the light level. Next, we’ll look at some ideas on how to lay out a microcontroller PWM circuit.

The constraint manager menu in Cadence software showing power nets

Using a constraint manager to control your power routing widths is a big help.

PWM Microcontroller Layout Considerations

Laying out a PWM circuit from a microcontroller is similar to laying out other types of power circuitry on a printed circuit board; the load devices should be located close to the PWM output to minimize impedance. Floorplanning the placement ahead of time is important to make the best use of cooling fans and make sure that larger components do not block the flow of air to the controller or other low-profile components. Also make sure to isolate the PWM circuitry from other sensitive circuitry and, as much as possible, avoid routing other circuitry underneath the PWM circuits. Using internal ground planes as a shield to other signal layers is also a good idea.

Perhaps the most important thing is to make sure that you are using the most advanced PCB design system available when designing PWM or other intricate digital power circuitry. OrCAD PCB Designer has the schematic, layout, and SPICE tools you will need to get the job done right the first time. In addition, with OrCAD’s constraint management system, you will have even more control over your design for routing the power nets of your PWM circuitry. 

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