[Theory] Pulse Width Modulation (PWM)

 Hi,

in my last tutorial about making pulse a led (fade in/fade out effect) with arduino i talked about the Pulse Width Modulation (aka PWM).

What is the PWM?? 

It is a way to allow a digital system to pilot analog devices by continuosly varyng the power output.




For example, you have a DC motor and you want to impress more speed to it, you need to increase the voltage. The same, if you want to decrease speed, you need to reduce voltage. 

In this case you are tryng to give to the motor 9V and you have two states, On and Off:



  |
9V|-----------------|
  |                 |
  |                 |
  |                 |_________________
  ------------------------------------
         On                 Off


now if we repeat this continuosly we will have an average voltage 


  |
9V|----|    |----|    |----|
  |    |    |    |    |    |
  |    |    |    |    |    |
  |    |____|    |____|    |____
  ------------------------------
                        

that means that if we turn on 50% of the times and we turn off 50& of the times the average voltage will decrease to 4.5V


    |
9V  |----|    |----|    |----|
    |    |    |    |    |    |
4.5V|----|    |----|    |----|
    |    |____|    |____|    |____
    ------------------------------
     50%  50%        

if we turn on 80% of the time and we turn off 20% of the times our voltage will be 7.2V (so we will have an higher voltage and an higer speed).

So we can control the speed (or the light intensity of a LED for example) increasing/decreasing the width of the wave in witch we are in a on state (that is know as Duty Cycle).


In this way, with our digital system we are able to increase/decrease intensity or speed for our analog devices.

Should be almost simple!

Commenti