Advertisement

Pulse Width Modulation

Pulse Width Modulation

There are many different ways to control the speed of DC motors but one very simple and easy way is to use Pulse Width Modulation.

But before we start looking at the in’s and out’s of “Pulse Width Modulation” we need to understand a little more about how a DC motor works.

Next to stepper motors, the Permanent Magnet DC Motor (PMDC) is the most commonly used type of small direct current motor available producing a continuous rotational speed that can be easily controlled. Small DC motors ideal for use in applications where speed control is required such as in small toys, models, robots and other such electronics circuits.

A DC motor consist basically of two parts, the stationary body of the motor called the “Stator” and the inner part which rotates producing the movement called the “Rotor”. For D.C. machines the rotor is commonly termed the “Armature”.

Generally in small light duty DC motors the stator consists of a pair of fixed permanent magnets producing a uniform and stationary magnetic flux inside the motor giving these types of motors their name of “permanent-magnet direct-current” (PMDC) motors.

The motors armature consists of individual electrical coils connected together in a circular configuration around its metallic body producing a North-Pole then a South-Pole then a North-Pole etc, type of field system configuration.

The current flowing within these rotor coils producing the necessary electromagnetic field. The circular magnetic field produced by the armatures windings produces both north and south poles around the armature which are repelled or attracted by the stator’s permanent magnets producing a rotational movement around the motors central axis as shown.

2-Pole Permanent Magnet Motor

permanent magnet dc motor

As the armature rotates electrical current is passed from the motors terminals to the next set of armature windings via carbon brushes located around the commutator producing another magnetic field and each time the armature rotates a new set of armature windings are energised forcing the armature to rotate more and more and so on.

So the rotational speed of a DC motor depends upon the interaction between two magnetic fields, one set up by the stator’s stationary permanent magnets and the other by the armatures rotating electromagnets and by controlling this interaction we can control the speed of rotation.

The magnetic field produced by the stator’s permanent magnets is fixed and therefore can not be changed but if we change the strength of the armatures electromagnetic field by controlling the current flowing through the windings more or less magnetic flux will be produced resulting in a stronger or weaker interaction and therefore a faster or slower speed.

Then the rotational speed of a DC motor (N) is proportional to the back emf (Vb) of the motor divided by the magnetic flux (which for a permanent magnet is a constant) times an electromechanical constant depending upon the nature of the armatures windings (Ke) giving us the equation of: N ∝ V/KeΦ.

rheostat motor control

So how do we control the flow of current through the motor. Well many people attempt to control the speed of a DC motor using a large variable resistor (Rheostat) in series with the motor as shown.

While this may work, as it does with Scalextric slot car racing, it generates a lot of heat and wasted power in the resistance. One simple and easy way to control the speed of a motor is to regulate the amount of voltage across its terminals and this can be achieved using “Pulse Width Modulation” or PWM.

As its name suggests, pulse width modulation speed control works by driving the motor with a series of “ON-OFF” pulses and varying the duty cycle, the fraction of time that the output voltage is “ON” compared to when it is “OFF”, of the pulses while keeping the frequency constant.

The power applied to the motor can be controlled by varying the width of these applied pulses and thereby varying the average DC voltage applied to the motors terminals. By changing or modulating the timing of these pulses the speed of the motor can be controlled, ie, the longer the pulse is “ON”, the faster the motor will rotate and likewise, the shorter the pulse is “ON” the slower the motor will rotate.

In other words, the wider the pulse width, the more average voltage applied to the motor terminals, the stronger the magnetic flux inside the armature windings and the faster the motor will rotate and this is shown below.

Pulse Width Modulated Waveform

pulse width modulation waveform

The use of pulse width modulation to control a small motor has the advantage in that the power loss in the switching transistor is small because the transistor is either fully “ON” or fully “OFF”. As a result the switching transistor has a much reduced power dissipation giving it a linear type of control which results in better speed stability.

Also the amplitude of the motor voltage remains constant so the motor is always at full strength. The result is that the motor can be rotated much more slowly without it stalling. So how can we produce a pulse width modulation signal to control the motor. Easy, use an Astable 555 Oscillator circuit as shown below.

pulse width modulation circuit

This simple circuit based around the familiar NE555 or 7555 timer chip is used to produced the required pulse width modulation signal at a fixed frequency output. The timing capacitor C is charged and discharged by current flowing through the timing networks RA and RB as we looked at in the 555 Timer tutorial.

The output signal at pin 3 of the 555 is equal to the supply voltage switching the transistors fully “ON”. The time taken for C to charge or discharge depends upon the values of RA, RB.

The capacitor charges up through the network RA but is diverted around the resistive network RB and through diode D1. As soon as the capacitor is charged, it is immediately discharged through diode D2 and network RB into pin 7. During the discharging process the output at pin 3 is at 0 V and the transistor is switched “OFF”.

Then the time taken for capacitor, C to go through one complete charge-discharge cycle depends on the values of RA, RB and C with the time T for one complete cycle being given as:

The time, TH, for which the output is “ON” is: TH = 0.693(RA).C

The time, TL, for which the output is “OFF” is: TL = 0.693(RB).C

Total “ON”-“OFF” cycle time given as:  T = TH + TL  with the output frequency being ƒ = 1/T

With the component values shown, the duty cycle of the waveform can be adjusted from about 8.3% (0.5V) to about 91.7% (5.5V) using a 6.0V power supply. The Astable frequency is constant at about 256 Hz and the motor is switched “ON” and “OFF” at this rate.

Resistor R1 plus the “top” part of the potentiometer, VR1 represent the resistive network of RA. While the “bottom” part of the potentiometer plus R2 represent the resistive network of RB above.

These values can be changed to suite different applications and DC motors but providing that the 555 Astable circuit runs fast enough at a few hundred Hertz minimum, there should be no jerkiness in the rotation of the motor.

Diode D3 is our old favourite the flywheel diode used to protect the electronic circuit from the inductive loading of the motor. Also if the motor load is high put a heatsink on the switching transistor or MOSFET.

Pulse width modulation is a great method of controlling the amount of power delivered to a load without dissipating any wasted power. The above circuit can also be used to control the speed of a fan or to dim the brightness of DC lamps or LED’s. If you need to control it, then use Pulse Width Modulation to do it.

221 Comments

Join the conversation

Error! Please fill all fields.

  • John Oakley

    I have a pwm controller which runs my N Gauge locomotive perfectly, but when I use the pwm controller on my 009 layout the locomotives run at full speed and I cannot control them why?
    They are both core less motors.

  • Mike Boydon

    I have heard comments re PWM harming motors in model railway locos; is there any confirmation for this, if so is it frequency dependent?
    I am currently using a small PWM unit (from Amazon) which my oscilloscope reads as running at about 14KHz.
    The locos on test appear to accelerate & run smoothly; so far I have not run one for any length of time so have not noticed any excess heat or other problems but owing to the rumours have not done any long term testing (model locos ain’t cheap!)
    Regards MIKE

    • Wayne Storr

      PWM is a common way to control the rotational speed of a DC motor, but must be rated to deal with the locos electrical characteristics as well as any onboard lighting system. As you are aware, PWM rapidly switches the track voltage “on” and “off” at a fixed frequency. The ratio of “on time” to “off time” (duty cycle) determines the average power delivered to the locos motor varying its speed since it responds to the DC average voltage. But if the duty cycle is set too high (full-speed), the average power may also exceed what the motor is designed for causing it to overheat and eventually fail.

      Like many things in life, you get what you pay for. Cheaper low-frequency pwm controllers can cause DC motors to struggle or buzz at low speeds producing extra vibration and heat in the windings and brushes as well as generating voltage spikes due to the motors inductance. Whereas better high-frequency controllers allow the locos motor to run more smoothly with reduced wear and better efficiency with extra built-in protection against high voltage spikes.

  • Kalyansundaram

    If motor current is high say 40Amp will 3055 transistor be good enough. Can ee connect 2 of them in parsllel to increase current capacity

    • Wayne Storr

      A 2N3055 NPN bipolar transistor is rated to pass a continuous collector current of about 15 amperes max, when mounted onto a suitable heatsink. Yes you can parallel transistors, but at 40 amperes you would need at least three. Also if one fails, the others would pass all the current and obviously fail themselves.

      For NPN types, the metal can BUV20, BUV21, BUV22, 2N5686 are rated to pass a collector current of 40 amperes. Again, they would need to be mounted onto a suitable heatsink.

  • Jason Goulegz

    I have few questions regarding PWM and Linear voltage.

    What is the difference (if there is any) between Pulse Width Modulation (PWM) DC Voltage and Linear DC Voltage? (I mean if either voltage applied to a little DC motor is any difference?)
    And does Linear DC current can hurt a small DC motor?
    Also, is Linear voltage too weak comparing it with PWM Voltage?

    Thank you
    Jason G.

  • Prince

    How to install my price sign device

  • greengenesisbd

    Perfectly pent content, really enjoyed examining.

  • Edward Nthala

    Thats good page i like it

  • GowriShankerSharma Sharma

    Very good to learn

  • Muhammad Hamza

    I Hope you are very well and believe me when this website is outstanding and very helpful for every time and I learned in this topic because that is my project in University side.
    Thank you!

  • Miulescu Alexandru

    Excelent,bine explicat
    Multumesc!

  • UMER ALAM

    can you please provide the tutorial of how to trigger IGBTS by using PWM signal for DC motor speed control

  • Jorge Garcia

    I only have a basic knowledge of electronics so my questions may seem naive.

    I would like to use the circuit to control the speed of matched sanding machine infeed and outfeed rollers powered by a geared dc motors (RS 550s which I scavenged from broken appliances over the years).

    I think that the infinitely variable speed control that is provided by the potentiometer is not desirable in my application. I would prefer to provide 2 – 4 discrete and reproducible speeds (eg. 25, 50, 75 and 100%)

    Is it possible to buy potentiometers that “switch” to precise RA:RB ratios?

    Does anyone see a problem with replacing the potentiometer with -say- a 4 way switch that changes the ratio of RA:RB ? Does RA+RB have to be 100k?

    Also, some hand drill triggers bypass PWM when the trigger is fully depressed. Is that necessary or desirable?

    In the circuit above there will always be some pulse modulation because the lowest RA/RB possible is 10/110 – so my motor will never run at full speed (is there something I am not seeing?). Would there be any adverse effects if I replaced the two 10k resistors with 1k or omit them altogether (ie can RA or RB be zero)?

    Thanks in advance for comments, and guidance

    Jorge

    • Wayne Storr

      Potentiometers are variable resistances whose output resistance value can be varied by the movement of a wiper.

      While the restive value of a potentiometer can be continuously varied from 0 to 100%, rotary switches with fixed value resistors attached as you suggested can also be constructed allowing its resistive value to be in defined steps of the values you require, (eg. 25, 50, 75 and 100%). For 100% full speed, the final switch position could be connected directly to the supply voltage.

      • Jorge Garcia

        Hi Wayne,

        Thank you for your reply. I’ve been doing a bit more research and it seems that the device that I want is called a rotary switch potentiometer like this: rotary switch

        The one in the picture has 10 positions but you can get some with less.

  • Richard

    I need to control a 300W 240V DC motor, using Pulse Width Modulation to give good torque at lower speeds.
    I cant find a ready made controller to handle 240V.
    Any suggestions for a robust circuit diagram that I can build this myself.
    Hopefully with thanks.

    Richard

  • KS Bawa

    This is a very good tutorial. Came here looking for PWM circuit to repair my treadmill DC motor control circuit.
    Still learning how to interconnect.
    Thanks very much.

  • Hemashri Thilakarathna

    this looks good.

  • yusuf

    good evening sir,don’t this circuit look exactly like astable? I think pwm should comprise two multivibrator one astable the other monostable,are wrong or confuse? Sir expound on it.

  • martin Lin

    hi i have a DC submersible water pump which is frequency variable with an external control panel. Now i am wondering if i can use it directly with a 24V battery , instead of plugging to the domestic power supply? Thank you in advance for your assistance

  • Randy Slone

    There is a much much simpler circuit that you can use to pulse that electricity and you wouldn’t leave it but a standard old school tattoo machine if you run positive if you if you run your positive line through the tattoo machine input and then on the output side you run it to your electricity and it will adjust your electricity and you don’t have to go through all that bullshit with all these resistors and capacitors and you know all that just simply one little tattoo machine will control the pulse for any amount of electricity up to 30 volts

  • Jyotirmay pramanik

    Hiii

  • Donald Fournier

    how would you connect a reverse flow to that (reverse motor)