fbpx

Pulse Width Modulation using Arduino Uno

Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a modulation technique that conforms the width of the pulse, the pulse duration, based on modulator signal information.

  • Although this modulation technique can be used to encode information for transmission, its main use is to allow the control of the power supplied to electrical devices, especially to inertial loads such as motors.
  • The term duty cycle describes the proportion of ‘on’ time to the regular interval or ‘period’ of time.
  • A low duty cycle corresponds to low power, because the power is off for most of the time.
  • Duty cycle is expressed in percent, 100% being fully on.
  • By changing the width of the pulse applied to the DC motor we can increase or decrease the amount of power to the motor and increase or decrease the motor speed.
  • The voltage have fixed amplitude but variable duty cycle.
  • If the pulse is wider then the speed will be higher and if the pulse is smaller then the speed will be lower.
  • If the PWM circuitry is embedded in the chip, we have to load the registers with high and low pulses then microcontroller will take remaining controls.
  • If the PWM circuitry is not embedded in the chip, we have to create various duty cycle pulses using software.

Pwm Wave Form

Code

 Int pwm=2;
 void setup()
 {
 pinMode(pwm,OUTPUT);
 }
 void loop()
 {
 analogWrite(pwm,0);
 delay(1000);
 analogWrite(pwm,64);
 delay(1000);
 analogWrite(pwm,127);
 delay(1000);
 analogWrite(pwm,191);
 delay(1000);
 analogWrite(pwm,255);
 delay(1000);
 }

Leave a Reply

Your email address will not be published. Required fields are marked *