How to Make a PWM Circuit without a Microcontroller

Pulse-width modulation is a digital technique for varying the amount of power delivered to an electronic component. By adjusting the amount of power delivered to a motor or LED, the speed or brightness (respectively) can be controlled.

To me, the simplest and most flexible PWM is generated by a microcontroller. However, some people aren’t comfortable programming a microcontroller. So, the electronic circuits in this article use only off-the-shelf, readily-available components such as logic chips, diodes, resistors, transistors, and capacitors.

This article begins with a schematic of an inverter-based circuit that outputs a variable duty-cycle square wave. Additional schematics take that output wave and control a sample DC motor driver and an example 7-segment LED display.

The resistor-diode-capacitor combination that generates the PWM has been around for a while. Personally, I first ran across it a couple of years ago on Eddy Wright’s website. And, I recently noticed that DPRG includes it in their motor driver tutorial by Rick Bickle.

Creating an Adjustable PWM

A pulse-width modulation signal begins with a voltage that goes up and down repeatedly. The classic method of creating the oscillation is with a resistor-capacitor (RC) circuit. This circuit uses RC timing with a diode twist to alter the ratio of the on-pulse time versus the off-pulse time (called “duty cycle”).

Schematic of a variable duty-cycle PWM circuit based on a 74AC14 inverter logic chip.

Schematic of a variable duty-cycle PWM circuit based on a 74AC14 inverter logic chip.

IC1: A 74AC14 Hex Inverter with Schmitt-Trigger Inputs.

C1: A 0.1 µF capacitor smooths the power supplied to IC1. If this capacitor were missing, the chip would probably still work, but there might be intermittent glitches on the inputs or spikes on the outputs.

C2: This 0.1 µF capacitor is going to be filled up (charged) and drained (discharged) repeatedly to make the pulse wave. Increasing the capacitance decreases the frequency of the wave. Decreasing the capacitance increases the frequency of the wave.

R2: A 10 kΩ variable resistor (trimmer potentiometer). This is variable resistance (rather than fixed) to alter the on/off times of the output wave. Increasing the total resistance value increases the frequency of the wave. Decreasing the total resistance value decreases the frequency of the wave.

D1 and D2: Two diodes. 1N914 or 1N4148 diode is preferable. D1 creates the charge path. D2 creates the discharge path. Without these diodes, the pulse wave would still appear, but the on and off times couldn’t be varied since the capacitor would be charged and discharged using the same path through the resistor. (An in-depth explanation appears on the next page.)

Implementing the PWM Circuit on a Solderless Breadboard

You probably already have many of the parts for the pulse-width modulator. However, unless you purchased and implemented the 38-kHz object detector from my book, Intermediate Robot Building, you'll probably need to pick up a 74AC14 from DigiKey or Mouser Electronics.

(A 74HC14, 74LV14, 74AHC14 would probably work, but none will exactly match the voltage ranges or output strength of the 74AC14. Other versions of this chip are even less compatible. Stick with the 74AC14 to save yourself grief while you’re learning.)

Variable duty-cycle pulse-width modulation circuit board implemented on a solderless breadboard.

Variable duty-cycle pulse-width modulation circuit board implemented on a solderless breadboard.

The solderless breadboard circuit looks slightly different than the schematic, but it is actually the same. Capacitor C1 is installed, but outside of the photograph. The trimpot (R2) is a little bit high on the board so that you can see all of the wires and connections.

Notice in the photograph and in the schematic that the final pulse output wave comes from the second inverter, not the first. The output of the first inverter is fed into the second inverter to make a clean copy.

Attaching a load (LED, motor driver transistor, etc) to the copy will not alter the operation of R1, D1, D2, C2. However, if we hadn’t made a copy, and we had attached a load to the output pin of the first inverter, than the frequency and duty cycle of the PWM would be altered by the load.

Put more simply, we made a copy of the signal so that we wouldn’t mess up the original signal when we connected the wave to other circuits.

Free Circuit Board File and PCB Editing Software

Below is the printed circuit board file for this project.

Click on the file and save it.
Download Copper Connection, the PCB layout software.
Free to display, edit, and etch at home.

Next, let’s learn how the heart of the circuit works...