Circuit Skills: PWM (Pulse Width Modulation)

Arduino Technology
Circuit Skills: PWM (Pulse Width Modulation)
YouTube player

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!

26 thoughts on “Circuit Skills: PWM (Pulse Width Modulation)

  1. Christopher Gosnell says:

    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.  

    1. Collin Cunningham says:

      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 :/

    2. Collin Cunningham says:

      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 :/

  2. Christopher Gosnell says:

    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.  

  3. Christopher Gosnell says:

    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.  

  4. Tim Southwick says:

    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.

  5. Tim Southwick says:

    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.

  6. Tim Southwick says:

    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.

  7. Tim Southwick says:

    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.

  8. T W says:

    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!

  9. Benjamin Daniel says:

    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

  10. Benjamin Daniel says:

    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

  11. Lyle Bjornson says:

    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.

  12. N8 says:

    the Make podcast link is toast. does anyone know of a good link to the make podcast URL?

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK