Another clever trick from the world of electronics – Pulse Width Modulation is a simple method for controlling analog devices via a digital signal. It’s also a very efficient way to drive motors, lamps, LEDs, & more.
If you’ve ever faded an LED with an Arduino – you’ve used PWM. But you don’t need a microcontroller to generate a PWM signal. The ever-versatile 555 timer chip can be configured to modulate its output duty cycle in response to a potentiometer – with the help of some relatively simple circuitry. Or for a more robust solution, consider the DC to Pulse Width Modulator kit suitable for sending up to 6.5A of current and built around the Motorola SG3525 – a chip dedicated to the art of PWM.
Oh and – I’d be denying my own nature if I didn’t mention at least one audio-related application. Indeed, PWM comes in very handy for generating simple sound from a microcontroller – melodies too!
Subscribe to the MAKE Podcast in iTunes, download the m4v video directly, or watch it on YouTube and Vimeo.



Good demonstration. I was a bit confused initially that the power supply voltage was powering the motor. After reading the kit docs, I understand that the power supply voltage shown was only used as a variable reference to change the duty cycle, and the power for the motor was from a different supply. Possibly this could be given more emphasis.
you raise a good point – I intended to explain that third connection powering the board and also show the reference voltage as a second trace on my scope. Unforch, plans went astray when I noticed my second probe was busted :/
you raise a good point – I intended to explain that third connection powering the board and also show the reference voltage as a second trace on my scope. Unforch, plans went astray when I noticed my second probe was busted :/
Good demonstration. I was a bit confused initially that the power supply voltage was powering the motor. After reading the kit docs, I understand that the power supply voltage shown was only used as a variable reference to change the duty cycle, and the power for the motor was from a different supply. Possibly this could be given more emphasis.
Good demonstration. I was a bit confused initially that the power supply voltage was powering the motor. After reading the kit docs, I understand that the power supply voltage shown was only used as a variable reference to change the duty cycle, and the power for the motor was from a different supply. Possibly this could be given more emphasis.
I’ve used this before. Interesting ideas:
:can be used in CRT or digital monitors to have more than 6 colors, or 2 if monochrome, through rapidly turning (sub)pixels on or off.
:can dim a florescent light. Make sure the PWM output voltage is equal to the necessary input voltage for the light! My PWM driver takes out a third of the voltage to internal resistance, so 9V into the PWM driver is needed for a 6V light.
:reducing the oscillation of a line follower, thermostat, or other difficult-to-maintain outputs.
:I would appreciate it if someone were to post instructions for a 120V, home outlet-style PWM driver. Maybe someone could have the electronics in their house dimmed by an Ardruino based upon how close they are to the appliance, or use a simpler relay to shut off appliances like mircrowaves, and turn them back on before anyone can reach them.
I’ve used this before. Interesting ideas:
:can be used in CRT or digital monitors to have more than 6 colors, or 2 if monochrome, through rapidly turning (sub)pixels on or off.
:can dim a florescent light. Make sure the PWM output voltage is equal to the necessary input voltage for the light! My PWM driver takes out a third of the voltage to internal resistance, so 9V into the PWM driver is needed for a 6V light.
:reducing the oscillation of a line follower, thermostat, or other difficult-to-maintain outputs.
:I would appreciate it if someone were to post instructions for a 120V, home outlet-style PWM driver. Maybe someone could have the electronics in their house dimmed by an Ardruino based upon how close they are to the appliance, or use a simpler relay to shut off appliances like mircrowaves, and turn them back on before anyone can reach them.
I’ve used this before. Interesting ideas:
:can be used in CRT or digital monitors to have more than 6 colors, or 2 if monochrome, through rapidly turning (sub)pixels on or off.
:can dim a florescent light. Make sure the PWM output voltage is equal to the necessary input voltage for the light! My PWM driver takes out a third of the voltage to internal resistance, so 9V into the PWM driver is needed for a 6V light.
:reducing the oscillation of a line follower, thermostat, or other difficult-to-maintain outputs.
:I would appreciate it if someone were to post instructions for a 120V, home outlet-style PWM driver. Maybe someone could have the electronics in their house dimmed by an Ardruino based upon how close they are to the appliance, or use a simpler relay to shut off appliances like mircrowaves, and turn them back on before anyone can reach them.
I’ve used this before. Interesting ideas:
:can be used in CRT or digital monitors to have more than 6 colors, or 2 if monochrome, through rapidly turning (sub)pixels on or off.
:can dim a florescent light. Make sure the PWM output voltage is equal to the necessary input voltage for the light! My PWM driver takes out a third of the voltage to internal resistance, so 9V into the PWM driver is needed for a 6V light.
:reducing the oscillation of a line follower, thermostat, or other difficult-to-maintain outputs.
:I would appreciate it if someone were to post instructions for a 120V, home outlet-style PWM driver. Maybe someone could have the electronics in their house dimmed by an Ardruino based upon how close they are to the appliance, or use a simpler relay to shut off appliances like mircrowaves, and turn them back on before anyone can reach them.
At time 1:41 you say “The amount of time our pulse wave is on vs. off.” The red line is 4 units and the blue line is 4 units. However, the duty cycle is 50%. I think it should be “the amount of time our pulse wave is on vs the length of time for the entire pulse.” or some such.
from: http://www.its.bldrdoc.gov/fs-1037/dir-013/_1849.htm
duty cycle: 1. In an ideal pulse train, i.e. , one having rectangular pulses, the ratio of the pulse duration to the pulse period.
pulse period: The reciprocal of the pulse repetition rate.
pulse repetition rate: The number of pulses per unit time.
I *think* I have that right. I’m not an electrician. If I’m wrong, let me know.
Also, I love your vids. Keep ‘em comin!
I’m quite sure T W is correct about the definition of a duty cycle.
This also leads into playing sounds. I’m almost positive that you can’t use only PWM to create a tone. Try it with a pezio buzzer. I did and it wouldn’t change the sound based on a potentiometer I had connected to my Arduino. This is because sounds are based on frequency/period of a signal/pulse: how often it repeats. A PWM pulse always repeats in the same amount of time, so it will only make one tone. For example, on Arduino’s PWM code page*, it says that the frequency of the PWM signal is 490Hz. When you change the PWM value, you change the duty cycle, which is like the makeup of the signal, but not how long the signal (pulse) itself lasts.
*http://arduino.cc/en/Reference/AnalogWrite
I’m quite sure T W is correct about the definition of a duty cycle.
This also leads into playing sounds. I’m almost positive that you can’t use only PWM to create a tone. Try it with a pezio buzzer. I did and it wouldn’t change the sound based on a potentiometer I had connected to my Arduino. This is because sounds are based on frequency/period of a signal/pulse: how often it repeats. A PWM pulse always repeats in the same amount of time, so it will only make one tone. For example, on Arduino’s PWM code page*, it says that the frequency of the PWM signal is 490Hz. When you change the PWM value, you change the duty cycle, which is like the makeup of the signal, but not how long the signal (pulse) itself lasts.
*http://arduino.cc/en/Reference/AnalogWrite
Did a similar experiment in college. Instead though we used a microcontroller that sent an adjustable duty cycle square wave to a FET that used a built in LED and a light effect transistor, which in turn amplified the signal and drove a motor at different speeds. Neato man.
// What's Trending
Raspberry Pi Design Contest
Maker Faire: Day Two
Maker Faire: Day One
Seventeen Sneaky Secret Hides
10 Things to Connect to Your Raspberry Pi
DIY Hacks & How To’s: Swiss Army Key Ring
A Photo Tour of Maker Faire
Adam Savage Exhorts the Makers to “Work Hard and Work Smart”
// What's Shared
A better way to slice a pumpkin
DIY Nerf Darts
In the Maker Shed: Minty Boost USB Charger
100 Dollar Store Organization Ideas for Craft Rooms and Beyond
Mad’s Mouse House
Lace Princess Crowns
I Have a (Puzzling) Dream
Play the Rings of a Tree Trunk Like a Record
// Most Commented
DIY Hacks & How To’s: Get Emergency Power from a Phone Line
Resin Casting: Going from CAD to Engineering-Grade Plastic Parts
Ten Tips for Screws and Screwdrivers
Ten Tips for Better Measurement
Makers on TV: Big Brain Theory
Arduino Announces New Wireless Linux Board
Grow: A Portable CNC Router System
Pitches with Prototypes: Solar Tracker
Trending Topics
Get our Newsletters
About Maker Media
Subscribe
to MAKE!
Get the print and digital versions when you subscribe