Something that a project that I'm working on has me doing is using a serial to parallel IC (think 74HC595) to control leds. However, rather than drive the leds directly from the pins, I opted for the use of transistors. After testing this out, it became apparent to me that perhaps the leds might be too bright, so I went in search of a simple PWM generator.
Of course, there are a couple of instructables that already feature such a circuit, but I was unable to get them to work correctly for whatever reason. This being the case, I will now present the circuit that I came across and works very well.
Step 1: Yet Another Overview
PWM stands for Pulse Width Modulation, which is a simple way of efficiently supplying varying amounts of power.
For example. Say that you wanted to control the brightness of an led (note: there are many ways to do this, but for the sakes of an example, I'll only note two). The first way would be to put a variable resistor in series with the led. This would alter the amount of current that went through the led, while holding the voltage constant. If you put the variable resistor at 40%, the led would be 40% as bright as it could be.
The second way would be to connect a led in series with a resistor and a power supply that could be turned on and off really quickly. Let's say that you were able to turn on and off the power supply quick enough to the point where 40% of the time it was on, and 60% of the time it was off. This would be reflected by the led being on full brightness, but only for 40% of the time, giving the illusion of being 40% as bright as it could be.
Two different methods, for the same result. What's the difference? About 60% of the energy gets burned off as heat in the resistor in the first circuit, while in the second circuit, almost all of the energy supplied is used.
This is why PWM is useful. It allows a signal to range from completely off to completely on. If a signal is turned on and off quick enough, given a certain ratio, a signal can appear to be that ratio, without suffering from much power loss at all.
Step 2: What Will Be Needed
The schematic that this circuit is based on is so general, that instead of giving hard values for each component, the author gave relations that would allow for any combination of parts.
However, for the sake of getting it right the first time, I'll list the values that did work.
* 1 - Generic 555 IC (NE555 was used)
* 2 - 1K Resistors (R1, R3)
* 1 - 100K Linear Potentiometer ( R2 = 100 * R1 )
* 1 - 1n4004 Diode (Pretty much any diode will do)
* 1 - .1uF Ceramic Capacitor (Unsure about the relation of the value of this to the resistors)
Step 3: Build It!
There's nothing much else to this circuit except for just going for it and building it.
Know of the proverb "Measure twice, cut once"? The same thing applies. Build the circuit, check the circuit, then apply the power.
Using the circuit is simple! Your PWM signal will be coming from pin 3. From there, make the standard led circuit, except route the voltage to pin 3. Play with the pot and enjoy!
Step 4: Credits / Sources
Article discussing the schematic: http://electronicdesign.com/article/analog-and-mixed-signal/wide-range-pulse-width-modulator-uses-555-timer110.aspx
chinmayj made it!