PWM is widely used in various applications like motor speed controllers, LED intensity controllers, Wireless Communication, Robotics, Audio effects, and many more applications where Supply regulation is required.
What is PWM ?
PWM is the acronym for Pulse Width Modulation, It is a square waveform generator in which the pulse width or duty cycle can be varied.
Why PWM is used ?
PWM is a technique of Providing regulated power to the Load by switching ON/OFF the input supply and controlling the duty cycle to provide the average resultant power to the peripheral.
The advantages of using PWM is low power consumption, less space, high reliability, wide Input Voltage, reduces the heating of electronic components.
so the next question arises, What are the criteria to select the PWM frequency and duty cycle for efficient Motor Control ?
A Motor can be represented by the equivalent electric circuit Model as shown below :
The R represents the coil windings resistance, L represents the inductance formed by the primary and secondary circuit and is greatly affected by the winding and core construction. E is the back EMF(Electro magnetic force) due to the induced voltage from the secondary circuit and is proportional to the speed of the motor.
The equation governing the interaction between the voltage, current and inductance is as follows : V = L * di/dt , where
L = Inductance, Henry
V = Voltage, Volts
i = Current, Amps
t = time, Sec
This implies that the current rise with time depends upon the Voltage/Inductance. As the Inductance decreases the current rises faster and the PWM induced ripple current grows.
The aim should be to reduce the ripple current less than 5% of the rated current of the motor at 50% duty cycle. It is observed that at 50% duty cycle the current ripple is at maximum, so its recommended to run the motor away from 50% duty cycle zone.
The higher the frequency, the lower the ripple, however the tradeoff is the linear control. It is important to find an acceptable balance between linear behaviour, noise and unwanted vibration.
It is also recommended to keep the PWM frequency higher than the human audible range (20 Hz to 20 KHz) as a current ripple in that frequency range may introduce noise during motor operation.
PWM in Microcontrollers :
Many Microcontrollers include the PWM function, the firmware should implement the following basic steps :
- Set the period in the on-chip timer/counter that provides the square wave.
- Set the on-time in the PWM control register.
- Configure the direction of the PWM output, which is one of the GPIO pins.
- Enable the PWM controller.