We extend the astable mode to build a PWM circuit.
Here’s what the schematic looks like and let’s start by looking at the output section.
We have a transistor Q1 connected to the output pin using a small 10 Ohm resistor. The small resistor value ensures that the transistor is driven into saturation when the timer output is HIGH. We know from BBox 1 that we need to add a diode in parallel to the terminals of a motor or relay coil for safe operation. Without this diode, there would be a large voltage spike when the motor or relay is switched OFF and this would damage the transistor and IC. In summary, the transistor will switch ON when the timer output is HIGH and it will switch OFF when the timer output is LOW.
The RC section has a few components that are connected in an interesting configuration. Capacitor C1 can charge through R1, VR1 and D2 and when the capacitor voltage rise above 2/3rd of the supply voltage, it will cause the output to change its state from HIGH to LOW. Varying the wiper position of VR1 will vary this charge time which is also called the ON time.
C1 can discharge through D1, R2, VR1 through pin 7 and when the capacitor voltage drops below 1/3rd of the supply voltage, it will cause the output to change it’s state from LOW to HIGH. Varying the VR1 wiper position will vary the discharge time, which is also called the OFF time.
In this way, we can control the ON/OFF times of the square wave. Let’s apply power to the circuit and view the timer output on an oscilloscope.
Watch what happens to the pulse width as I adjust the trimpot. Also, notice how the average voltage changes as the pulse width changes.
Let’s now try to understand the relationship between the pulse width and the output voltage. Let’s say we have a 5V DC voltage as shown, it would be a constant voltage of 5V. Now, let’s say that we switch it ON for 1 second and then switch it OFF for another second and we keep repeating this. The average voltage would be half of the peak voltage as it is ON for only half the time. Likewise, varying the ON time will vary the average voltage of the signal. This is exactly what is happening in this circuit.
We adjust the pulse width of the square wave and this switches the load ON/OFF at a rapid rate. The pulse width determines the average value of the output and this will affect the speed of the motor or LED brightness. If the pulse width is 100% then the output will be ON all the time and it will be similar to a steady DC value.
Let’s connect a DC motor to the circuit and let’s adjust the trimpot to see the effect on the motor speed. If the pulse width is 50%, then the output will be at the max voltage for 50% of the time and it will be 0 for the remaining 50%. The average value will be 50% of the maximum output voltage which will result in lower motor speed.
Pulse width modulation has many applications and is widely used for motor speed control. Let’s move on to the next project.