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 were 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.

213 Comments

Join the conversation

Error! Please fill all fields.

  • Jigar Gamar

    Best pwm circuit board diagram circuit d

  • Gabriel Bing

    I am a third year college student of Don Bosco Technological Institute studying Bachelor in Instrumentation Technology and am taking this unit of motor control, pl,c and microcontroller which I am so interest to study this unit but we have limited resources therefore, I am seeking any assistance from you.
    Thank you.

  • Poppyb

    Thanks for sharing the helpful information. I bought a servo motor not long ago, but it seems like a stepper motor is a better choice.

  • someone

    why u waste time

  • fanis raptis

    If I increase the frequency to 13khz it will work properly

  • Mohamed

    Good knowledge

  • Basilde

    PWM

  • Eshteyak Ali

    Name the 3 wheel alingment
    Angles which commonly adjusted
    on most vihicles
    Thans sir

  • Eshteyak Ali

    automotive devices that are controlled by pulse width modulation pwm

  • Ahmed Rabiaa

    Thank you for this article. I found it very helpful.

  • Freddy

    So it looks like a rheostat is still being used in the circuit, while the stated objective seemed to be to get away from variable rheostats. I guess the distinction may lie in the I²R power loss being lower across this rheostat vs the similar loss across a rheostat in series with the motor. Is there any way to compute and contrast this loss?

    Thanks for this tutorial. It certainly made the concept of PWM easier to comprehend.

    • Wayne Storr

      Its not a Rheostat its a Potentiometer. Rheostats and potentiometers a very different devices.

      • Freddy

        I get that. My point is that they’re both variable resistance elements, and subject to power loses.

        Let me ask my question a different way. I could use a potentiometer in series with the motor (instead of a rheostat) to vary it’s speed. I’d like to understand what the difference would be (in terms of power) if I simply did that, versus using the potentiometer across a voltage divider to drive the PWM as explained in the article.

  • Tom O'Sullivan

    Hi, I have 12v dc motor consuming between 7 and 9 amps. Could you recommend a motor controller
    ( potentiometer) suitable for this motor. Thank you. Tom.

  • Nasiru idris

    Thank you so much, pls,i have a solar ceiling fan 12v 30w have’n no driver circuit ,which suitable circuit diagram will you help me on it.

  • Nikolai Kondrashov

    Thank you for sharing the circuit and for the explanation. However, if/when the potentiometer fails (open as usual), the output could get stuck high, supplying the motor with a constant current, possibly over-speeding or burning it out. I’m trying to find an alternative circuit which would preserve the frequency and wouldn’t fail in this mode and am failing so far.

    • Ian j robinson

      Arduino

    • Wayne Storr

      “if, when, possibly, could” are speculative words. Any component in an electrical circuit could fail so any motor used should be rated for maximum possible conditions

      • Nikolai Kondrashov

        > Any component in an electrical circuit could fail so any motor used should be rated for maximum possible conditions

        Sure, and I’m in no way trying to criticize the solution. It’s neat and it solves a problem.

        In my case, however, I’m trying to modify a device designed by someone else and to reproduce the PWM signal it’s already sending, but allow shortening the pulses and make it run slower. I don’t know what either the motor or the motor driver is rated for, so I’m trying to be careful. The potentiometer would be the only mechanical component (apart from the motor), and thus much more likely to fail. It doesn’t help that it’s ebay-sourced either 😀

        For now I just went with a basic astable configuration and am ignoring the slight frequency changes within the duty cycle range I need, for the sake of predictable and safe failure mode.

        Thanks for the answer!

  • Gabriel

    I’ve simulated a T-C-R driver to convert the PWM into DC for a small 5V DC motor here’s the tested circuit: http://prntscr.com/tlzu22
    and here are the results
    1st test, 70% duty cicle: http://prntscr.com/tlzwdx
    2nd test, 30% duty cicle: http://prntscr.com/tlzxhw
    these are just simulations, but I have a real model too I’ve used a dsPIC16F887 to generate and adjust the PWM signal I do agree that it could be easier with a NE555, but in my code I included a software freq-meter and a EUSART transmitter block to monitor the circuit from distance

  • Ibrahim abdalelah Ibrahim Ahmed

    Very good information

  • J.C.Mukherjee

    I am a 81 year old retired electrical engineer thinking of converting my bike to an e bike by myself to spend time gainfully in tiring covid 19 pandemic.The current article was very informative and useful.Thanks

    • PAtrick

      Hey,
      Thank you for the full article. I hadn’t read the whole of it prior to replying initially. I will try out the 555_oscillator and let you know once done. I appreciate.

    • Patrick

      Thank you for your response.
      Would you have a schematic diagram of a 12v pulse width modulater I could construct? I’ll appreciate any leads to one.
      Thanks.
      Patrick.

  • Sanjaya

    How can we measure pwm in servo motor

  • Patrick

    Hi.
    I’m glad to have found this article. I have been looking for a way to convert 12v D.C current coming from a car battery into 12v A.C to be able to power a magnetic fuel pump I’ve made. The D.C. Doesn’t allow for the pump plunger to function rather it is static… I believe the plunger will perform suction function if the power source is A.C.
    Will the circuit above work for my purpose?
    Thanks.

  • Samer

    By mistake pwm 12 volt was connected to 220 AC and fuse blown up . Have changed but pwm does not regulate any more

    What could be?

    Thanks