I am making a PWM motor speed controller.

I used the Astable mode thinking it would work; it did not. Using an oscilloscope I noticed that I am only changing the frequency not the duty cycle by varying R2 enter image description here.

After more investigation I found this second schematics that used diodes and it works.

  • why the first one did not work?
  • what is the role of the diodes?
  • is there a formula for this?
  • what is this mode called?

enter image description here

  • 1
    \$\begingroup\$ You should provide a proper schematic of the "1" circuit. For example, you have not described what you changed in the first circuit to attempt to alter the duty cycle. And 47uF is hardly a practical value for PWM of most motors. \$\endgroup\$ May 2, 2021 at 12:26
  • 1
    \$\begingroup\$ @HaythemLtifi why exactly are you agressive here? Spehro very sensibly pointed out that you said something didn't work, but never explained what that was. There's very many places that you could have a resistor "R2", and your picture is so compressed I can't tell which resistor is which, so it's totally unclear what you did. But, OK, now that we know you're not planning to improve your question, let me vote to close it as lacking necessary detail. \$\endgroup\$ May 2, 2021 at 12:47
  • 1
    \$\begingroup\$ @Haythem Ltifi, your investigation leading to the diode version is very good. I read about the diode version which is an improvement over the standard version, which is not used in the cheapy 555 modules, therefore annoyingly not easy to set frequency and duty cycle. #Rohat Kılıç gave a very good explanation. \$\endgroup\$
    – tlfong01
    May 2, 2021 at 13:07
  • 1
    \$\begingroup\$ @tlfong01 It's unrelated to the question, which already has a selected answer. More to your comment about "cheapy 555 modules", ones like this, which I am using to dim my office fake plant lighting, and I gave another to a friend for some of his boat lighting. The diode version doesn't allow frequency to be adjusted easily but it doesn't matter much with a PWM. \$\endgroup\$ May 2, 2021 at 13:58
  • 1
    \$\begingroup\$ @Spehro Pefhany, (1) I know there is already a selected and very good answer. I am hoping my answer can complement the selected answer, (2) I understand you are using the NE555 astable output as a PWM signal to a light dimmer. However, the OP is using it to control the motor speed. (2) I always think that if the OP asks a question, we can (a) guide the OP to improve his question, (b) if there are things that the OP does not know that he does not know, otherwise he might consider other ways to do the job (controlling motor speed). / to continue, ... \$\endgroup\$
    – tlfong01
    May 2, 2021 at 14:16

2 Answers 2


For a simple astable oscillator \$\mathrm{T_{hi}=\ln2\cdot (R1+R2)\ C}\$ and \$\mathrm{T_{low}=\ln2\cdot (R2)\ C}\$, and \$\mathrm{T = T_{hi}+T_{low}}\$.

why the first one did not work?

If only R2 varies, Thi varies but also the period, T does. And the amount of change may not be enough to rate it as a duty-cycle change. Or at least, it may not be that distinguishable.

what is the role of the diodes?

is there a formula for this?

For the modified circuit (the one with diodes), the diodes determine which portion of R1 will be taken into account during charging and discharging of the capacitor, C:

  • During charging, D2 will be forward biased and D1 will be reverse biased. So only the left-side portion of R1 (let's call it R1a) will be used: \$\mathrm{T_{hi}=\ln2\cdot (R2+R1a)\ C}\$.

  • During discharging, D1 will be forward biased and D2 will be reverse biased. So only the right-side portion of R1 (let's call it R1b) will be used: \$\mathrm{T_{low}=\ln2\cdot (R1b)\ C}\$.

The period is:

$$\mathrm{T = T_{hi} + T_{low}=\ln2\cdot (R2+R1a)\ C + \ln2\cdot (R1b)\ C \\ \Rightarrow T= \ln2 \cdot (R2+R1)\ C}\ $$

And the duty cycle is:

$$\mathrm{D = \frac{T_{hi}}{T} =1-\frac{R1b}{R_{total}}\ \ \ \ \ \ ;\ R_{total}=R1+R2 }$$

As can be seen from the last two equations above, the duty cycle varies with the position of R1's wiper because T remains constant.

what is this mode called?

I don't know if it has a specific name. But still, it's an astable oscillator.

  • 1
    \$\begingroup\$ My friend , thanks a lot , now i get it . its a very clever trick , and this makes sense for why the duty cycle can goes below 50% wish is not possible in a simple astable mode \$\endgroup\$ May 2, 2021 at 13:01


/ to continue, ...



  1. The OP is not happy of the standard NE555 astable, because it is not easy to independently adjust frequency and duty cycle.

  2. There are two types of NE555 modules in the market. The expensive one uses different sets of resistor pair values for different range of frquencies. The cheap one uses minimal resistors and only a narrow range of frequency can be set.

  3. Actually both of the above two version does not use the improved versions using two diodes.

  4. And all version using NE555 are analog devices and therefore not precise compared to digital PWM controller/signal generator (I will talk about it later)

  5. My main aim here is to explain why the OP's improved diode version is good. I read about a variety of improved diode versions. Below is one by Electronics Tutorials. This version has an explanation. So I am mentioning it here, to complement the already selected, very good answer, make answers of this question more complete.

555 astable with two diodes


(1) How to wire a Rpi, a relay, a DPDT and a PWM module to a DC motor, allowing to control its direction and speed? - EESE, Asked 2020feb16, Viewed 757 times

(2) How to control DC motor speed by motor driver with PWM input? - EESE, Asked 2020jul16, Viewed 998 times


Your Answer

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

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