The easy or hard way to build a PWM dimmer


From what you would gather from Hackaday’s immense library of builds and projects over several years, the only way to do PWM is with a microcontroller, some code, a full-blown IDE, or even a real-time operating system. To some readers, we’re sure, this comes naturally and with an awesome toolchain it can be as easy as screwing in a light bulb. There is, of course, an easier way.

[Jestin] needed to vary the current on a small 12 Volt load. Instead of digging out an in system programmer, he turned to the classic 555 chip. With a single pot, it’s easy to vary the duty cycle of the 555 and connect that to a MOSFET. Put a load in there, and you have a very easy circuit that’s a fully functioning PWM dimmer.

If all you have are a few scraps in your part drawers, this is a very, very easy way to set up a dimmer switch. We’re also loving [Jestin]‘s improv aluminum tube enclosure, as seen in the video below.


  1. hipcatcoolcap says:

    Its easy to overlook analogue parts in today’s world of microcontrollers. But learning about timers, op amps, and regulators, you can really extend the possibilities of your uC. IMHO of course.

  2. darko31 says:

    I’m sure this looks weird to more software oriented people, but world existed before MCUs. Nice little aluminium case.

  3. Tom the Brat says:

    Used a 555 and a 3055 NPN power transistor to run a motor in the 70s. But I used the 555 the usual way ’round with a resistor in series with out driving the base and the pot varying charge time. These days, why mess with all those parts when a Tiny45 costs next to nothing. It was convenient that a 555 would work at 12v.

    • Matt says:

      The main reason I can see is simplicity. If you want manual control with a knob like that, you would still need the mosfet and the rheostat (or and encoder). Add in the mcu and you still have the same number of components.

      Then you have to write firmware to translate the input from the knob to output PWM. While this *can* give you more flexibility in the design (you could program different gain settings, or add in slew rate limiting, etc…all of which could be easily modified in code or on the fly with another connection) , if you don’t need that flexibility, it just introduces complexity and creates holes for bugs to hide in.

      • hipcatcoolcap says:

        Right, but if you connect a k type thermocouple to A0 you aren’t going to see much. Run it through a halfway decent op amp and blam! Your fireball throwing arduino powered yatzee predicting coffee mug reads the temperature of its glass kiln

      • Styx says:

        Not to mention, this is a great beginner circuit for learning electronics the old-school way.
        Although I prefer the variant where the output pin of the 555 is used to drive the mosfet.
        It seems to be better suited to drive a wide variety of mosfets.

    • ColdTurkey says:

      ‘coz I don’t have a Tiny45, nor a programmer, nor a want to program an extremely simple function and have to write code when i can just swap a component. Also, to some people, mcu’s are intimidating, and also learning analog electronics is kinda key, no matter what you’re doing.

      • Garbz says:

        Honestly these days I beg to differ. I have colleagues who are chemical engineers who’s experience in electronics consisted nothing more of making a lightbulb light up in highschool physics who are playing with Arduinos due to their braindead ease of use. I would argue conceptually to someone who isn’t an electrical engineer it would be easier to setup and program an Arduino to do PWM than it would be to understand how the above 555 timer works. Hell even if you do understand how a 555 timer works an antiparallel diode circuit with resistance and capacitance is an incredibly daunting circuit.

        And that’s one of the keys to getting something out of a hobby, an understanding. Any idiot can copy a circuit off the internet, many an idiot do and get horrendously stuck when it doesn’t work first go. In this case an Arduino is an all mighty all powerful black box where you plug in power in one end, and a mosfet ehh I mean switching thingy in the other and you have a full understanding of what is happening to easy to follow code.

        Now this doesn’t necessarily apply to an ATTiny45 that you program yourself, but for a lot of the newbie crowd microcontroller = Arduino = very bloody simple.

        • John U says:

          When any idiot can do it, any idiot will do it. And then before you know it we’ll have retarded arduino code running safety-critical machinery where three transistors would have done it and never crashed because of an idiot mistake.

          The guy who designed the three-transistor solution had to really know his shit to get it that elegant and robust, and the guy who wrote 8kb of arduino code to flash one LED and switch a relay is not to be encouraged.

          If the guy that designed the 3 transistor solution comes to me and says “well, an AtTiny is cheaper in production” I’ll trust him and go with his solution.

          I’m all for people hacking away and learning, expanding their horizons, whatever… but it’s important to know the difference between a hack that mostly works and something that’s right for the job.

  4. Chris C. says:

    Heh, I like the title. All viewpoints accounted for. :)

    I noticed the same thing [Tom the Brat] did, the 555 is not being used “the usual way ’round” here. I’d think the output pin would be more suited to efficiently switching the MOSFET’s gate capacitance. Is there some other advantage to this configuration?

  5. UltimationEE says:

    You could get a simple comparator IC to do it, IMO would be a simpler circuit.

  6. KillerBug says:

    I think the ‘backwards’ way he used is the method shown in the datasheet.

  7. fiveseven says:

    Wow, what a coincidence! I just built one of these things today, before reading the article.

  8. sparkygsx says:

    If the load is even slightly inductive, a freewheeling diode across it would be a good idea, otherwise the MOSFET will be forced into avalanche breakdown every time you turn it off. Charging the gate through a 10k resistor is horrible, it causes huge switching losses, why not use the output instead? One of the great features of the 555 is that the output can source and sink 200mA! In any case, a resistor in series with the gate is required to limit the current to protect the output transistors of the poor 555, and it will dampen gate oscillations (wires are inductive, you know).

    As a final note, it’s better to place a diode in series with 555’s power supply, and give it a dedicated buffer capacitor and decoupling, to prevent the transients caused by the switching from falsely triggering the 555.

  9. A Bryant says:

    I once had a 240V dimmer that used a 555. It was old and was the only dimmer switch that I have ever seen that had its own fuse holder!

  10. Abhi says:

    Here comes the most stupid comment, (pardon me for that) However, I do not understand, why can he use a little higher (power) rated pot. directly in load path and do away with all the reg/cap/diodes/FET and 555? Since its just 12v and load does not seems to be too heavy and control is a simple knob??

  11. boot says:

    look here it extensive explains including inside of the 555, shame hackaday already drops posting ease by stupid credentials/ loging before posting.

  12. andrew says:

    I had to add a dimmer to an LED controller once. The LEDs were already PWM’d from a microcontroller but it had no brightness control. I ended up making a similar circuit to the above and just used AND gates to connect the controller and the 555. I expected to see some warbling in the brightness but with the 555 frequency set up about 3-4x that of the PWM controller it ended up working really well.

  13. Big-j says:

    knew i had seen something like this before……


  14. kitsune361 says:

    555’s are so underrated these days. When I was on the staff for a LARP I whipped up a few dim-able glowing costume pieces, all driven by a humble 555 driver circuit.

    For every AVR I used in props, I probably had 2 to 4 simple effects I drove w/ discrete parts.

  15. shady reda says:

    I need to use a similar circuit to control 220V AC lamp throw a full wave rectifier. Actually I don’t know if the AC ground (which is the source of the MOSFET) and the DC ground (which is the ground of 555 or a micro controller) have to connected to each other or not??

  16. richfiles says:

    I built a custom PC case from a 1939 Philco radio cabinet. I wanted to use a large 24 volt PWM reverse impeller blower as a primary fan, but the PWM standard it uses is not compatible with the PWM used by PC case and CPU fans.

    My solution was to feed the PWM from the mobo through an optocoupler, to isolate it from my 24 volt circuit, and generate a DC voltage off the PWM. I then created a triangle wave generator with a pair of pots to set the upper and lower peaks of the triangle wave. I feed the triangle wave (set to the blower’s PWM frequency) and the PWM derived analog voltage into a comparator. The higher the voltage, the higher on the triangle wave the output switches. The lower the voltage, the lower on the triangle wave the output switches.

    This gives me a voltage controlled PWM generator that has pot adjustable upper and lower PWM range limits!

  17. Inventable says:

    Hi, the original circuit diagram is in:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,380 other followers