Introduction: 555 Timer : Universal PWM Controller
Please visit my Kickstarter to purchase the assembled board or kit :
Within this instructable the 555 timer is used to create a variable PWM signal that can be varied from ~5% to ~95% of the power supplied using a variable resistor.
PWM is a technique used everywhere within electronics to vary the power supplied to devices and components such as motors, LED's and fans.
Controlling the ratio a component is high (on) to the time its low (off) can vary the overall power supplied to it. For example if a motor was powered from a 12v power supply and 50% of the time the power supplied was low and 50% was high then the average voltage the motor receives is 6v making it run half as fast. The ratio of the time a component is high to low can be expressed as a percentage as in the example above and the percentage a component is high compared to low is called the duty cycle. These percentage correspond to actual times for example a 50% on to 50% off can correspond to 500ms on to 500ms off and this would create a frequency of 1 hertz. When using PWM the frequency supplied to a component needs to be high enough to where its not noticed. For example a motor is typically over a few thousands hertz as anything below and the motor wouldn't rotate smoothly. This would mean the percentages of 50% on to 50% off would correspond to say 0.25ms on to 0.25ms off which would supply 6v from 12v and a frequency of 2000 hertz which is high enough for the motor to run smoothly. The PWM signal from this board can be varied from 1hz all the way to 10khz giving it a range of possible uses from LED's to motors.
Step 1: The Circuit
The circuit diagram above doesn't contain the option to use an external power supply for the output and just uses one to keep it simple.
This circuit uses the common 555 timer to create and vary the PWM signal. The circuit uses a potentiometer to vary the output PWM signal from around 5% to 95% of the power supplied and uses a jumper to vary the frequency from around 1hz to 10khz. The jumper is used to connect the potentiometer to a different capacitor which changes the frequency of the PWM signal. The change in frequency is marked beside each capacitor and shows how it multiples by 10 as you move the jumper from left to right.
The output of the 555 timer is connected to a high current MOSFET transistor which is used for switching heavy loads such as a motor. The STF7N60M2 can switch up to 600v at 5A however any alternative can be used.
You could connect your output straight from pin 3 of the 555 however you are limited to 200mA which is why its best to use a transistor. You can control fans, motors or LED's just remember to choose the frequency that's high enough so its not noticed by the output, for example a frequency of 10hz would be noticed as a flicker when controlling LED's which is why a few hundred hertz is suitable. When controlling fans and motors you can sometimes hear a whistling sound which is the coils inside vibrating at a frequency we can hear, it causes no damage to the motor however can be annoying so an increase in frequency would remove the noise.
Step 2: How It Works
Reference to components in the circuit diagram above are mentioned to help with understanding.
This circuit uses the typical 555 timer astable arrangement to create and vary the PWM signal.
See here for a simple guide of the 555 astable arrangement : http://www.electronicsclub.info/555timer.htm
The 555 timer astable arrangement creates a square wave with time high and time low. The ratio of these times can be varied by changing R1, R2 and C1 in a typical 555 astable arrangement or R1, VR1 and a change of capacitor via the jumper (C1) within this PWM circuit.
The typical astable arrangement has two resistors R1 and R2 in series connected to a capacitor C1 to ground.
The time the square wave is high can be calculated by 0.7 x (R1+R2) x C1
The time the square was is low can be calculated by 0.7 x R2 x C1
The difference in calculations is to do with the charge and discharge time of the capacitor which triggers the output to be high or low. The link above describes this in detail.
Within the PWM circuit R1 has been picked to be a low value and for the sake of calculations is not existent.
Updating the calculations we have :
Time high : 0.7 x R2 x C1
Time low : 0.7 x R2 x C1
With the arrangement of R2 being a potentiometer the ratio of time high to low can be changed without effecting the overall frequency of the signal. For example if the potentiometer was set in the middle with 5kohms either side and C1 being constant then you end up with the time high and time low exactly the same creating a 50% on to 50% off. This would half the power supplied to a component or device. If the potentiometer was changed to 1khoms to the left and 9kohms to the right then its 10% on to 90% off.
So the potentiometer allows you to vary the width of the pules and the jumper allows you to change the capacitor from 100uF to 0.01uF allowing you to change the frequency of the output from around 1hz to 10khz.