Apologies for poor phrasing and structure, this is my first post.

I am trying to learn how to implement 555 to create a PWM with variable duty cycle (for control of LED brightness)

Rather than the usual potentiometer route, I would like to use length of button press to control the duty cycle. Eg. While Button pressed duty cycle increases (maybe 20% per second) .

I have tried searching forums to get a starting point. I had hoped there is a way to use another 555 to generate a regular pulse when a trigger is held high, and the pulse to trigger an increase in duty cycle. But so far I am unable to understand how to work it out, or where to search.

Ps. As an added extra, I would like to implement a latch so that alternate button presses increase/decrease duty cycle.

So far I have only microcontroller experience, but would love to implement this with 555 or other specific IC.

Many thanks

  • 1
    \$\begingroup\$ The only practical way of doing this would be to use a microcontroller to read the buttons and control the 555. This, of course, would be ridiculous as the microcontroller would provide all the required functions without the 555 and be much more stable / accurate / repeatable. You just might be able to use a digital potentiometer of some sort but again ... \$\endgroup\$
    – Transistor
    Commented Aug 21, 2022 at 15:44
  • 2
    \$\begingroup\$ Anyone with microcontroller experience shouldn't consider using 555's for anything. What you propose for a user-interface is reasonable, but is far easier with a microcontroller's PWM than adapting a 555 circuit. \$\endgroup\$
    – glen_geek
    Commented Aug 21, 2022 at 15:48
  • \$\begingroup\$ what should happen when the duty cycle reaches 100%? ... you could use the button to increment a counter ... use a DAC to generate a voltage trom the counter value ... alternately, a free running counter could be used, its value compared to the first counter \$\endgroup\$
    – jsotola
    Commented Aug 21, 2022 at 15:49
  • 1
    \$\begingroup\$ @glen_geek, Anyone with microcontroller experience shouldn't consider using 555's for anything (1) If you really meant, 'using 555's for this' then I completely agree with you. (2) If you do mean 'for anything' then that's a bad recommendation because it ignores the sizeable development/manufacturing/support overhead costs for doing even something really small with an MCU. They dwarf the 1-off part cost. In professional engineering and manufacturing, a single 555 with 3 passives is a far cheaper and beneficial choice than a single MCU . \$\endgroup\$
    – TonyM
    Commented Aug 21, 2022 at 19:49

3 Answers 3


Your design requires state-based control of an oscillator and PWM generator.

Two 555s can give you the oscillator and PWM generator. However, they're the much smaller part of your total circuit. The state-based control is the IC-hungry part if done with conventional circuitry.

Using an MCU makes for a far simpler circuit, with just the one IC to do the part you describe. That'll have fewer components in it than the 2x 555 you'd need for oscillator and PWM on their own.

As an aside...

There's an irony that you've looked for an MCU-free circuit to build but picked one that an MCU is particularly good at. It's great that you're looking beyond MCUs and into conventional circuitry. In professional engineering (development costs), manufacturing (programming costs) and support (field service), the cost of using MCUs (in costed hours) can quickly push the total cost of a board design far beyond the parts cost for a conventional circuit.

Consider 10,000 boards using a £1 MCU doing a very simple task that carries £30,000 of dev/manf/support costs - that's actually £4/board, not £1/board. A conventional circuit with £3 in 10 components is cheaper and likely to have a much higher calculated reliability. Plus, a sizable part of the £30,000 has to be found in the first year's engineering budget.

This is just one example. Other situations can easily require adding £100s or £1000s to board costs.

These immediate and lifetime costs are often ignored in MCU suggestions on the site but a business can't ignore them. They must be part of any design proposal.


What gave you the idea that you can build this using 555s only? I mean: yes, a 555 is good enough to implement a NAND gate, so theoretically you could build MCU using those, and run whatever code you'd want to - but that's not what you had in mind, right?

A 555, used as an analog building block, has rather ephemeral memory: it does have some state, but this state is constantly changing, and can't be stabilized to form long-term memory.

I presume that you want the duty cycle to be stable over long periods of time. For that purpose, analog means of storing the duty cycle won't work - unless you went really overboard, like using an extremely low leakage capacitor-based storage with the "pick-up" circuit using ultra low bias current op-amp and Teflon standoff on the PCB, or a mechanical gyro as analog memory.

Instead, you'll need to store the duty cycle digitally.

Typically, you'd have a clock source that runs at the PWM frequency times the number of levels of brightness adjustment, an adjust clock divider so that pressing a button will adjust the duty cycle at a reasonable speed, an up/down counter storing and adjusting the duty cycle, and a toggle latch to store the direction of adjustment (since you want it to alternate with just one button).

The output section can be:

  • "analog", where a DAC converts the duty cycle value to voltage, and a classic analog PWM section converts that voltage to a PWM waveform, or
  • digital, with a magnitude comparator or a down counter to convert the duty cycle to a PWM waveform.

If you only need a few levels, then it'd be OK to cycle through them, and then the problem is slightly simpler: a Johnson counter could be used to select the brightness level, a simple resistor DAC would convert that to a voltage, and then your favorite voltage-driven PWM could convert it to a digital PWM waveform.

Now, don't misunderstand any of the above as discouraging an MCU-free approach. If your specs will be reasonable, then it's clearly possible to put it together using a few dirt-cheap 40xx or 74HCxx series chips. But that'll only work if you keep the specs aligned with what's easy to implement without an MCU. Most modern "pushbutton dimmer" circuits use a low pin count MCU that costs much less than a dollar. On price alone, you can't beat that. But if that MCU goes on back-order for half a year, what then? A more discrete design is less likely to suffer from supply chain disruptions, since with some care you can make it so a variety of substitute chips could be used in each position on the board. For some functions you can even use 40xx and 74HC as alternates, since they share pinouts.


While I agree with the other answers that a microcontroller is the easiest solution, you explicitly asked for something using the 555 (and I think using a microcontroller to drive the 555 would be cheating :-). There is an easier way, using just the 555 and an opamp (plus a few discrete components). Use a capacitor to contain a reference voltage, charge/discharge the capacitor with two separate pushbuttons and resistors, and then use the approach described here: https://forum.allaboutcircuits.com/threads/555-timer-set-duty-cycle.74036/#post-520007, with the capacitor instead of the resistor bridge. 555 with opamp


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.