Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

10 March 2009
Author: Giorgos Lazaridis
PWM Modulation

Introduction

PWM, or Pulse Width Modulation is a powerful way of controlling analog circuits and systems, using the digital outputs of microprocessors. Defining the term, we can say that PWM is the way we control a digital signal simulating an analog one, by means of altering it's state and frequency of this.




The PWM signal

This is how a PWM signal would look like:






The square wave

The PWM is actually a square wave modulated. This modulation infects on the frequency (clock cycle) and the duty cycle of the signal. Both of those parameters will be explained in details later but keep in mind that a PWM signal is characterized from the duty clock and the duty cycle. The amplitude of the signal remains stable during time (except of course from the rising and falling ramps). The clock cycle is measured in Hz and the duty cycle is measured in hundred percent (%).



Clock cycle and Duty cycle parameters

These are the basic parameters that characterizes a PWM signal. The first parameter, the clock cycle, is easy to understand. It is the frequency of the signal measured in Hz.

The other parameter has to do with the switching time of the signal. Take a look in the following three signals:





All three signals shown above are square wave oscillations modulated as per their oscillation width, so called "duty cycle". They have the same frequency (t1), but they differ on the width of the positive state (t2). The duty cycle is the percentage of the positive state compared to the period of the signal. So:


Period (T) = 1
Frequency (F)

A 10% dudy cycle means that the positive stated remains positive for 10% of the period of the signal.


Example:

Suppose that the above signals have a frequency of 1000Hz. This means that their period is 1/1000 =>


T = 0.001 Sec => T = 1mSec

The first signal has 10% duty cycle. This means that during one full period, it remains positive for 10% of the total period:


t2 = 10 x T
100

And this comes to t2 = 0.1mSec. In the first example, the positive state will remain for 0.1 mSec.

With the same way we can calculate the t2 (positive state) of the other two signals:


Signal 2, 40%:


t2 = 40 x 1mSec / 100 = 0.4 mSec

Signal 3, 90%:


t2 = 90 x 1mSec / 100 = 0.9 mSec


Usage of the PWM

Find bellow the usages that a PWM can have




Voltage and power control

One of the most popular usages of PWM is the control of voltage delivered to loads. Those loads could be for example an LED which would utilize a LED dimmer, or a motor that could be a simple DC motor and would be converted into a controlled speed DC motor, as used for example in the modern PC motherboard fans. But how can PWM control the voltage?

The idea is simple. A PWM signal with 100% duty cycle would deliver 100% of the voltage. It would be like a DC power supply. But by altering the duty cycle, the result is to reduce the area of the power delivered to the load as shown bellow:





The total power delivered to the connected load each time, is the area under the positive state of the PWM (the drawn area shown on the above drawing). It is clearly seen that by altering the duty cycle, we can alter the power delivered by the supply. And because the wave form is a square wave, the power supplied each time is calculated by:


PDELIVERED = PSUPPLIED x DutyCycle

Suppose now that the frequency is high, and at the output of the PWM generator a capacitor is connected like the following schematic:





Following, you can see the resulting output voltage, when the above circuits operates with duty cycle 10% (left waveforms) and with 90% (right waveforms)






The above example is the principal of the operation for the switching power supplies.




Signal transmission
Digital signal transmission

Very common use of the PWM is the digital data transmission. And because the generation of a PWM signal is easy to be implemented and can also be generated by digital electronics, the data transmission using this modulation is becoming very popular.

Here is a simple way to transmit digital data using PWM:





As can be seen from the above time chart, by altering the duty cycle we can distinguish the two different states, 0 and 1. Thus, a 10% duty cycle corresponds to bit 0 and a 90% duty cycle corresponds to bit 1.

One of the great advantages using this method is that using two wires as data transmission, we can also produce from those two lines the appropriate power to supply a remote low power drain device! Take a look at the following schematic circuit:






The logic states of the probe points of the circuit on the left

The micro controller will generate the PWM signal with the information as described before. This signal is driven to the base of a switching transistor. This transistor will copy and invert the signal up to 15 volts. This voltage will allow the signal to drive over higher distances through the wire and supply the next device efficiently. The receiver device has another transistor that does exactly the same job as before. Will invert and copy the signal but this time back to 5Volts peak, capable to drive TTL inputs if needed.

The whole trick here is the diode with the capacitor. This arrangement will act as the power supply described above, and will produce a smooth DC waveform. The zener diode will stabilize this voltage down to 5.1 volts, capable to supply with power the receiver IC.




Analog signal transmission

PWM is also widely used to modulate - transmit and demodulate analog signals. The modulation is mainly done using a method called intersective PWM. According to this method, the input analog signal and a sawtooth waveform are driven in a comparator. Each time sawtooth waveform voltage is less than the input signal, the PWM output is driven high and vice-versa.

Watch the following drawing:





The analog signal (orange) is compared to the sawtooth waveform (blue). The comparator will generate the PWM modulated signal ready to be transmitted.




More usages of the PWM

Due to the efficiency and simplicity of PWM, as well as the flexibility of this modulation type, there are numbers of applications that it can take place. Using PWM someone can modulate transmit and/or storage analog signals like audio/voice telecommunications and music.

Switching power supplies that uses this technology are much more energy efficient than the classic power supplies, reaching up to 60% power saving! The output power and/or voltage can be controlled either digitally using a micro-controller or with the old classic potentiometer.

Stepper motors can be easily controlled using PWM, as well as DC motors. The torque and speed of a DC motor can be controlled by altering the voltage or the duty cycle of the PWM easily.

PWM is widely used in dimmer circuits that could control a variety of lamps including LEDs.

Notice that using PWM, dimmer circuits and other circuits like motor controller that would normally require AC voltage to operate, can be handle with DC voltage directly with no conversion whatsoever.





Relative pages
  • 555 timer basic circuits
  • 555 theory of operation
  • Learn how dimmers work
  • Basic transistor circuits
  • Peltier coolers (TEC) theory of operation
  • Learn how the PS2 keyboard protocol works
  • The SCR (Silicon Control Rectifiers) theory
  • How to make a MAMME arcade machine controller without the use of a keyboard
  • Dr.Calculus: 555 Astable multivibrator calculator





  • Comments

      Name

      Email (shall not be published)

      Website

    Notify me of new posts via email


    Write your comments below:
    BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


          

  • At 12 November 2015, 23:20:34 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Luiz Antonio Vargas Pinto Of course!


  • At 9 November 2015, 20:24:54 user Luiz Antonio Vargas Pinto wrote:   [reply @ Luiz Antonio Vargas Pinto]
    • Hello,
      Congratulations about your website and your work about PWM.
      I'm teacher in FATEC Tatui in Brazil, industrial automation. Do you allow I translate this page to my students ?
      Thank you
      Best Regards
      Luiz Antonio


  • At 26 September 2012, 21:39:17 user Stenvar wrote:   [reply @ Stenvar]
    • @Giorgos Lazaridis Thank you for your reply, and the valuable information. Im planning on using around 30 mosfets, maybe I need to do a little research into the mosfet gate capacitance, it will be interesting to find out.

      Regards,

      Stenvar


  • At 26 September 2012, 20:57:13 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Stenvar ideal mosfet draws 0 current, real mosfets draw current in the scale of micro-amperes... so... unless you plan to use hudreds of mosfets, a single 555 is sufficient. Only problem will be with the capacitance of the mosfet gate at high frequencies. Maybe the parasitic capacitance becomes too large and it adds some sort of turn-on delay, which will eventually cause them to overheat due to extended operation in the linear area. But for 5-6 mosfets or so i don't think this will even be a measurable situation.


  • At 26 September 2012, 19:23:18 user Stenvar wrote:   [reply @ Stenvar]
    • @Giorgos Lazaridis yes, that's what I thought. Do you think the 200ma or so from a 555 timer would be enough when using mosfets on the drivers, or maybe needs to be a bit more?

      Appreciate your thoughts,

      Stenvar


  • At 26 September 2012, 17:50:17 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Stenvar a lot, depending on the PWM current source and the driver's current requirements. If you use mosfet for drivers, then you can really use A LOT


  • At 24 September 2012, 16:53:25 user Stenvar wrote:   [reply @ Stenvar]
    • @Giorgos Lazaridis

      Ok, but if I was using several drivers, each driving their own string of leds, and I used the pwm signal to switch a transistor located on the drivers, how many drivers do you think the signal would stretch to?

      Kind regards,

      Stenvar


  • At 24 September 2012, 16:36:39 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Stenvar as much as your driver (transistor or other mosfet) can carry


  • At 24 September 2012, 9:11:38 user Stenvar wrote:   [reply @ Stenvar]
    • Hi Giorgos,

      I have a question, if using a 555 based pwm generator to dim leds which are being driven seperately, how many strings of leds could you control with a single pwm signal?

      Hope you can help,

      Stenvar


  • At 23 July 2012, 19:35:12 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @rabbit check my circuits with the STK chips (go to circuit pages)


  • At 23 July 2012, 9:30:35 user rabbit wrote:   [reply @ rabbit]
    • can any one tell me about controlling a stepper motor using pwm generated by microcontroller.. the main theory about it


  • At 28 April 2012, 9:22:55 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Maya i have a related theory page here:
      http://www.pcbheaven.com/wikipages/How_RC_Servos_Works


  • At 28 April 2012, 8:02:08 user Maya wrote:   [reply @ Maya]
    • Very Nice description!!!
      want to know about the pwm of servo motor and how servo work on the phenomenon of PWM????


  • At 2 August 2011, 6:19:57 user Mahaprabhu.S wrote:   [reply @ Mahaprabhu.S]
    • crisp and smart explanation. Plz try to add interactive animations. Thanking You.


  • At 28 August 2010, 21:21:07 user Zelimir Krokar wrote:   [reply @ Zelimir Krokar]
    • Please check web site: www.pwm-theory.com


  • At 25 July 2010, 14:29:55 user abi wrote:   [reply @ abi]
    • hmmmmm it,s very usefull to me... upload more information regrading pulse width modulation and its uses



    delicious
    digg
    reddit this Reddit this
    Faves



     HOT in heaven!


    NEW in heaven!



    New Theory: AC electric motor working principle



     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy