Advanced

What Is PWM? The Pulse Slider Explained

  • Grades 5-8
  • 10 minute activity
  • NGSS 4-PS3-2

Quick answer

PWM stands for pulse width modulation. Instead of leaving the power on, a circuit switches it on and off over and over, and changes how long each "on" pulse lasts. The pulse slider on the Deluxe Battery Holder and the Power Hub does exactly this: at 0% the power is off, at 100% it stays on, and in between the power pulses so LEDs blink, buzzers beep and motors slow down.

Pulse slider settings from 0% to 100% with the on and off power pattern for each and whether the LED is lit
Tap to enlarge. The slider sets how much of each pulse the power is on. At 50%, the power is on about half the time, pulsing about every half second.

On, off, on, off

A regular switch has two settings: on and off. PWM adds everything in between by switching the power on and off very quickly, all by itself. Each on-and-off is called a pulse.

The part you control is the duty cycle: the share of each pulse that the power is on. A 25% duty cycle means the power is on for a quarter of each pulse and off for the rest. A 75% duty cycle means it is on most of the time.

  • 0%: the power is always off.
  • 25%: short flashes with long gaps.
  • 50%: on about half the time.
  • 75%: long flashes with short gaps.
  • 100%: the power stays on, just like a regular battery holder.

What it does to each part

  • LEDs blink. Slide toward 100% and they stay on longer each time.
  • Buzzers beep instead of sounding all the time, like an alarm.
  • Motors stop and start, so on average they turn more slowly. The fan does not have time to get up to full speed before the power switches off again.

Because the power is off part of the time, the batteries also last a little longer at lower settings.

The Squishy Circuits slider pulses slowly, about every half second at the middle setting, so you can see each blink. Most electronics use the same trick, just much faster: hundreds or thousands of pulses every second.

At that speed your eyes cannot see the blinks, so instead of blinking, the light just looks dimmer. LED dimmer switches, phone and laptop screens, and many motor speed controls all work this way.

Slow pulses make an LED blink while very fast pulses make it look dimmer
Tap to enlarge. The same 50% setting. Slow pulses (left) make the LED blink. Fast pulses (right) make it look dimmer.

Try it with dough

Try the pulse slider

You need a Deluxe Battery Holder or a Power Hub, since both have the pulse slider. Build one simple circuit and try every part.

You need

  • Deluxe Battery Holder with 4 AA batteries, or a Power Hub
  • Conductive (salty) play dough
  • 1 LED
  • 1 buzzer
  • 1 motor with fan

Steps

  1. Build a simple circuit: two pieces of dough a finger-width apart, the red wire in one and the black wire in the other.
  2. Bridge the gap with an LED, long leg on the red side. Set the slider to 100% and switch on. The LED stays on.
  3. Slide the slider slowly down. Watch the LED start to blink, with shorter flashes as you go lower.
  4. Count how many times the LED blinks in 10 seconds at the middle setting.
  5. Swap the LED for a buzzer. What does it sound like at 25%? At 75%?
  6. Swap in the motor. Compare how fast the fan turns at 100% and at 50%.
Pulse slider settings from 0% to 100% with the on and off power pattern for each and whether the LED is lit
Each slider setting and what the power looks like over time.

What happens

The LED blinks and the buzzer beeps. The lower the setting, the shorter each "on" pulse. The motor stutters and turns more slowly. At 0% everything stays off, and at 100% everything stays on.

Not working?

LED blinking when you do not want it to? Slide the pulse slider all the way to 100%. Nothing at all? Check that the slider is not at 0% and the switch is on.

Key words

PWM
Pulse width modulation: switching power on and off quickly and changing how long it stays on each time.
Pulse
One on-and-off of the power.
Duty cycle
The share of each pulse that the power is on, written as a percent.
Frequency
How many pulses happen each second.
Average
The power the part gets overall, once the on and off times are added up.

For teachers

The average voltage a load sees under PWM is roughly the supply voltage times the duty cycle. Real controllers run at high frequency so that motors and lights smooth out the pulses; for example, an Arduino's analogWrite() runs at about 500 pulses per second. The Squishy Circuits pulse slider is deliberately slow so students can see and count the pulses.

Good extension questions: if a 6 volt supply runs at 50%, what is the average voltage? Why might a motor not start at a low setting? Students who want to program PWM themselves can try the RGB LED project in Coding with Squishy Circuits. Find more lessons on our education page.

Pulse slider questions

What does PWM stand for?

Pulse width modulation. It controls power by switching it on and off and changing how long each "on" pulse lasts.

What is duty cycle?

The share of each pulse that the power is on, written as a percent. 0% is always off, 100% is always on and 50% is on half the time.

Why is my LED blinking?

If you are using a Deluxe Battery Holder or a Power Hub, the pulse slider is set below 100%. Slide it all the way up and the LED will stay on.

Which Squishy Circuits power supplies have the pulse slider?

The Deluxe Battery Holder and the Power Hub. The standard battery holder is a simple on and off switch.

Does the pulse slider work with buzzers and motors?

Yes. Buzzers beep on and off and motors stop and start, so they turn more slowly on average.

How do LED dimmers use PWM?

They switch the LED on and off hundreds or thousands of times per second. That is too fast for your eyes to see, so the light looks steady but dimmer.