Simple (and dirty) Pulse Width Modulation (PWM) For Motor Speed Control



This is possibly the simplest PWM circuit design out there. Suitable for low power DC Motor speed control (fan speed control, light dimming and etc) and is based on the 555 timer. Also a good starting point for novices wanting to get their hands dirty with the 555 timer IC. Some would argue that this is not the most efficient approach, but hey (read the title), it's simple, and it works.

Some attribution is appreciated.



click image to enlarge



click image to enlarge

Introduction

Those of you modders, tinkerers, makers at one point or another would have encounter the need to have a finer control of DC motor speed, be it for robotic projects, RC, case mods etc. The simplest, no-brainer approach to that is by adjusting the voltage supply to the motor using a potentiometer. The higher the voltage, the higher the speed and vice versa.
Might be a good option for some cases, but the potentiometer approach doesn't perform too well when a much more stable and refined control is needed.


Pulse Width Modulation (PWM)

Put simply PWM is the process of switching power ON and OFF to a device in pulses at a specific frequency. Same approach used in commercial light dimmers, DC motor speed controller, CPU fan speed controllers and etc.

The fundamentals. Imagine your everyday incandescent light bulb. When you turn the power ON, it doesn't lights up to it's full brightness instantly, instead it will take (approximately) a couple of seconds to do so. Similarly when you turn the power OFF, it will take a couple of seconds for the bulb to die off.

Now, imagine you're able to flick the power switch ON/OFF fast enough. If you can time your ON/OFF flicking just right (of course it's difficult), the light bulb will actually dim instead of flickers.

The ON/OFF cycle is known as the duty cycle. Below are the visual representation of 50%, 80% and 20% duty cycle.




The 555 Timer IC

The 555 timer is arguably one of the most popular IC ever made. There are thousands of resources online if you're interested to delve deeper into the subject. I'm just going to give the simple description directly relevant to the build.
You can get the 555 at any electronics supply store, just ask for 555 IC (or IC tiga lima in Malay) from the auntie and you're set. If you can't seems to find it, check out the Amazon link for 555 timer below.




PIN 1 - Ground
DC Ground

PIN 2 - Trigger
When LOW, it causes the Output pin to go HIGH. Activated when voltage fall
below 1/3 of +V.

PIN 3 - Output
Output is HIGH when Trigger pin is LOW. Output is LOW when Threshold pin is
HIGH. Output is LOW when reset pin is LOW.Output pin is able to source or sink
current.

PIN 4 - Reset
Short to +V when not in use.

PIN 5 - Control Voltage
Grounded through a 0.01uF capacitor when not in use.

PIN 6 - Threshold
When voltage reaches 2/3 of +V, this pin will cause Output to be driven LOW.

PIN 7 - Discharge
Grounded when Output pin goes HIGH.

PIN 8 - +V
DC Power



How the circuit works



When the circuit is powered up, the C1 capacitor will initially be in a discharged state. Thus, the Trigger (pin 2) will be LOW, driving the Output (pin 3) to go HIGH. Discharge (pin 7) goes HIGH and shorts to ground. The cycle begins.

The HIGH Output will cause C1 capacitor to be charged through the R1 and D1 path. Upon C1 voltage reaching 2/3 of +V, the Threshold (pin 6) will be activated and drive the Output (pin 3) LOW. Discharge (pin 7) goes LOW. The time it takes for C1 to charge depends on the position of R1.

Since Output (pin 3) is now LOW, capacitor C1 will start to discharge through the D2 and R1 path. When the voltage of C1 drops below 1/3 of +V, Trigger (pin 2) will be LOW, driving Output (pin 3) to go HIGH, and Discharge (pin 7) to go HIGH and shorts to ground. The cycle repeats itself.

You've probably noticed by now that the circuit is using Discharge (pin 7) to drive the motor, simply by shorting to ground in each cycle. You can add some amount of protection if you're concerned about back EMF from the motor.

Pin 4 and 5 are not used, and pin 1 is simply tied to ground. The circuit can take between +3v to +18v. The Frequency is around 144Hz. Do note that, doubling the value of C1 will reduce frequency to half, tripling will will reduce frequency to 1/3, and so on.

NOTE: The circuit, as is, can safely pass current of up to 200mA (max) .



Parts list

1) 555 timer IC - 1
2) 100K variable resistor - 1
3) 1N4148 Diode - 2
4) 100nF capacitor - 2


Further readings

If all the above seems too much to take in and you feel the need to brush up on you basics in electronics, then I highly recommend the book by Forrest M. Mims below. Regarded by many as the quintessential easy read for electronics beginners. I started my foray in electronics (many year ago) guided by this book and it still proves useful till this very day.



And of course, other electronics read to get your hands dirty in electronics. Enjoy!

  



So that's it

Any input, comments, suggestions are welcomed.

49 Comments:

Zana said...

ooh, so this is what you do when *she's* not around eh? hehe.

anyway, congratulations on finally getting the www.easterngeek.com domain name working :)

looking forward to reading about your laser thingy project, though i think i've seen it first hand.

how lucky is that :)

oOFooi said...

Congratulation! You hard work finally paid off. :)

Anonymous said...

Couldn't get it working... :?(

I've got a 1.5 to 3V small DC motor hooked up to two 1.5v batteries.

Do I need a battery or motor with a larger voltage rating?

Please... help!
Tom

Chein said...
This comment has been removed by the author.
Anonymous said...

Hiya,

may I know that what duty cycle will be there for this circuit. If I place a fan there in the output instead of a motor, with all the values of capacitors and resistors same, what will be the duty cycle for it.

Regards.

Chein said...

Hi,

To the above question:

The duty cycle depends on the position of the variable resistor R1.

If you turn R1 halfway through(its midpoint) then it will be 50% duty cycle. One tenth of the way, then it's around 10% duty cycle.

Sergio said...

Thanks for posting this. Very nice and clear. My question is: how many amps will this circuit take? I need to control a 12 V motor that draws a max of about 7 amps. I am currently using a purchased pwm, but after about 4 amps the digital ammeter fluctuates wildly and becomes unreadable. Thanks.

Anonymous said...

What about using a cmos 7555? I have a whole bunch of them and I tried to get one to work with a 9v an a resistor and got it to I think? modulate but only with my finger shorting the leads of the led together?

Anonymous said...

This is a great and simple PWM circuit. I was wondering if their is any other way to decrease the voltage drop than to in increase the voltage? Right now I can only light up 3 LEDs with 12v.

Anonymous said...

Hi There nice circuit! My question is that I want to use a 500k pot with a "click off" mechanism (the only one I have) so what value do I need to change C1 to if I want to drive a 12 cm,12V computer fan with a 500K pot? My power supply is 12V which can supply 1A.
Thanks!

Chein said...

Using 500K pot:

My guesstimate, the current rating of your cpu fan is around 100mA - 200mA, if that's the case, then the setup you've just mentioned should work.

The only difference in your case is the drop in the frequency of the pulses.

Since your pot is 5x higher, it will take 5x longer for C1 to charge and discharge.
Thus the frequency of the pulses will be around 1/5, that's around 29 pulses per second (28.8Hz).

If insist in getting the 144Hz using the 500K pot, then you will need to reduce C1 value to 1/5 of 100nF.

Hope that helps. Cheers

Anonymous said...

Thanks! Using a 20nf cap now but the circuit is only putting out 4V. Tried using a 2n3904 npn to drive the fan but I cant get it to work. I have no idea what im doing wrong? Emitter to ground,collector to -ve from motor and base to pin 7 on 555.I think thats right? Would using an even smaller cap raise the average voltage?
Thanks
Rich

Anonymous said...

thanks for your nice tuturial.

I am not an expert, but I could reply the wiring of the PCB, but the image is not clear, could you a more clear picture?

Anybody could help me with the PCB scheme?

mlerei said...

Chein,

I teach an electronic communications class and I was wondering if you would mind me using your circuit in one of my laboratory lessons on PWM.

Thanks!
-Emily C.

Chein said...

Emily C,

Sorry for the late reply.

I have no problem with that, by all means, go ahead.

Some "attribution" to this blog would be nice though ;)

riley said...

Hi, i came upon your video and was wondering if the pot controls the speed of the motor, provided that the voltage is kept constant at some point.?

Chein said...

Riley - FYI,the voltage supplied to the motor is always at max, but in pulses.

The pot controls how long each pulse is (the pulse width).

Anonymous said...

your circuit gives me the speed control i want. can it be modified it to run a motor in burst or pulse on and off?

Vernon Fabe said...

Thank you for your clear and sound explanation. I've worked with 555 timers before but this is a better aproach to making a variable astable oscillator. Not only is the circuit easier to calibrate but it also has fewer parts than the traditional low duty cycle astable configuration.It can also go below the 50% mark without extra parts. Thanks for posting this and keep up the great work. I'm looking forward for more innovative projects in your site!

Anonymous said...

Hi Chein, I was wondering how powerful was the motor you were using? I have a 6-12 volt dc motor. Will it work with this circut?

Thanks.

Billdan said...

The photos are very clear and the breadboard approach is nice. I want to add a reed switch/magnetic sensor or something simple to provide input to the trigger/pin. I tried a Hall sensor but smoked it. Any ideas?

Nitin said...

Hello,

Can you please suggest the modification for controlling the brightness for a 40/60 Watt bulb, working on 230v AC,
or a CFL bulbs brightness?

can i use the same ckt? or will there be any modifications.
and how do i connect the bulb or CFL?

Please help.

Thanks in advance

Anonymous said...

Hi Chein, I made this circut with all the parts you metioned. I used a 9v battery and a 1.5v-3v dc motor. It didnt work :(

I'm just wondering what voltage your motor was.

Thanks.

Anonymous said...

Love it! Nice and simple. So, how would one add a level indicator to this? Such as 5 led level or something similar? Thanks!

-MLF said...

Hello Chein,
I built your circuit to run a small DC motor to work as an electric telescope focuser. It should work fine once I am finished but I hit a snag.

When run by a 6v (four AA batteries) it worked fine, but the motor didn't seem to have much tourque in slow mode so I connected it to a 12v computer power supply I use as a 12v source.

Trouble is it didn't work and hasn't worked since even going back to 6v. I used a CMOS 555 chip and everything was rated above 12v so I'm not sure what happend. I don't belive it is the diodes so I assume it would either be one or both of the caps or maybe I hosed the 555 chip. Since it worked before I tried the 12v, I'm not sure what it would be. I was hoping you might have a suggestion for me to trouble shoot before I desolder things.

Thanks in advance!
Michael

Chein said...

MLF - I think your 555 is fried. For your purpose, should add a current limiting resistor or a FET at the output pin instead.

Anonymous said...

Hello guys.I have tried the circuit with a pot which I think is 10k.It didn't work.Could this be the reason.Everything else is the right component.I used a motor from a toy which I think is a standard one.Thanks.

WilliamS said...

Hi,
I am wanting to use three of these (I have already made and tested them) to control multiple RGB LEDs.
The LEDs have a common negative and therefore these will not work as the currently stand.
How can I change the output to +ve?
Would you suggest using a transistor to do this and link it with the source +ve?

Cheers

Alisdair said...

Hi Chein

Thanks for sharing this with us!

Can you advise whether this can be used with a DPDT switch between motor and circuit for a reversible motor?

If this is not possible can you please suggest a way to introduce a reversible switch?

Apologies for my ignorance on this!

Thanks in advance
A

Chein said...

Alisdair

Yes you can use a DPDT switch to reverse the spin.

jim said...

HI CHEIN

NICE JOB MAKING PWM SIMPLE.
CAN I ASK YOU HOW MANY AMPS CAN IT TAKE? AND CAN IT BE USED FOR HHO'S?

robertthred said...

Ok, not sure how old this post is (i really didn't look) but was hoping to get one question answered. I have been looking for a cheap reliable PWM design, you have supplied that (and THANK YOU!) but could you rig two circuits, one on each side of the pot two control two separate motors at inversed speeds?

Suraj said...

That's so simple PWM circuit..

working nicely..

BTW,, can u make one for RF ie wireless speed control(PWM)..

thnx

Anonymous said...

hi ' i try to build it but it bont work can u help me... i use a simple motor like that of playstation controll pad shock .. and also a led... completly out of of work... help me

BT said...

Hi Chien,

I built the circuit following your instructions and thought I'd built it properly but now (two days before the presentation for my project) I have found out that I am only able to control my motor speed in a very narrow range. Could I have damaged the pot? The video you posted shows I should be able to control the speed all the way down to zero. What am I doing wrong?

Your help is greatly appreciated.
Thanks,
BT

Chein said...

More likely the 555 ic is fried. As noted in the post, the circuit can pass max 200mA. In your case, think you should replace the ic and add a limiting resistor to your circuit.

As for the value of the resistor, Google for "current limiting resistor", there are many guides on how to calculate the right value.

Lokmotiv said...

Hi Chein, thx for the schematic!

I got it working with a LED and a small motor but I want to implement a transistor to control a motor that needs more amps.

Where in the schematic do I connect it?

Thanks again!

David said...

Hey
Couple of questions.
My 555 does not have a notch or markings on it. How do I know what side is what? Also does the diode number matter that much? I can not seem to find 1N4148 anywhere.
Thanks
David

pim said...

I have tried this with pnp transistor and rgb led strip, I have noticed it never reaches 0%, the leds are never fully off, even adding resistors. Is it possible with your circuit ?
Another question, when running a motor, if I use PNP to PWM ground, it can control very low speeds, when PWM positive, not so low. I am beginner, and this is a nice experiment.
Thank you for sharing.

Lokmotiv said...

Pim: How did you connect the PNP transistor? I am trying to control a bigger motor with PWM signal using NPN Transistor, it dose not work. Did you connect pin 7 to base?

Chein said...

@lokomotiv

It needs a PNP transistor (TIP30 or TIP32 series works well). NPN doesn't work

Connect the PNP transistor base pin to pin 7 through a resistor to limit the base current/voltage.

Anonymous said...

i DID IT AND IT WORKED!!!

This is my first electronic project like this in 38 years.
I built an amplifier and a synth when I was 12.

I am so happy and proud of myself.
It actually worked and it works perfectly. Really really nice.
Thank you so much for posting the circuit and making the video, and showing the love. Gracias!!

Anonymous said...

Just out of curiosity, can this circuit control a 12vac syncronus motor?

Anonymous said...

can i use a TORQUE - TUNED MOTOR (e.g. TAMIYA motor..) ? thank you !

Oz said...

I want to run a .3 Amp 90mmx90mm case fan with this. What changes do I have to make so it can pass the current? My input voltage is 12-18 Volts. I am running the fan with 8 AA batteries. Would a more complicated circuit draw less current so my batteries would last longer. I like this simplicity and would like to use it on a product that I developed. http://uralica.com/biomass-stove.htm

Pete said...

About Potentiometers:

I have 500(Ohm)0.5KOhm Pot.met.
- 5W...What does Watt mean? I have 1w,2w,5w.(What is correct?)

+ Do I need exactly the 100KOhm one ???(What if it's lower\higher will it explode?)

Chein said...

@pete

put simply watt is how much power that the pot can take, if u exceed the rated wattage, it'll burn, doesnt really explodes :)

Using 500ohm will increase the frequency 200 folds (ie how many times the LED flickers per second, as in the video). 100k pot yield 144hz, a 500ohm will yield 28800hz.. I doubt you will see any visible result at that frequency, but it's worth a try.. alternatively you can also replace C1 with a larger value cap (say 10uF) to bring the frquency back down.

Pete said...

OK
Different Pot == Different C1

Pot connection:"circuit diagram"
---------------
I suppose the pot's center pin is the one lined horizontal(and the two in vertical are the pot's left and right pin.) ?

If I succeed:(making this PCB)
--------------
Please make the PWM-unit guide more advanced so I can add more Amperes to the circuit.(I believe I need ONLY resistors+transistors but don't really know wirings.)

Like this:
http://dx.com/p/dc-6v-90v-15a-pwm-motor-speed-control-switch-governor-green-black-160094

Anonymous said...

I just couldn't depart your site before suggesting that I actually loved the usual
information a person provide to your guests? Is gonna be again
regularly in order to check up on new posts

Here is my web-site :: google api php

Related Posts with Thumbnails