# 555 Timer duty cycle changing formula

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 .

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?

• 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. – Spehro Pefhany May 2 at 12:26
• @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. – Marcus Müller May 2 at 12:47
• @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. – tlfong01 May 2 at 13:07
• @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. – Spehro Pefhany May 2 at 13:58
• @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, ... – tlfong01 May 2 at 14:16

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.

• 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 – Haythem Ltifi May 2 at 13:01

Question

/ to continue, ...

Introduction

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.

References