# What is my microcontroller power duty cycle?

Say I have a uC active for 1s every 100s, sleep otherwise. This will lead to 1% duty cycle.

But what if it is active ones every ten seconds, and once every 100 seconds, and then once every week? Over what period of time do I calculate the duty cycle?

If I read your question correctly then you have a wakeup at three different intervals simultaneously:

• Once every ten seconds and
• Once every 100 seconds and
• Once every week

In this case you have to calculate the duty cycle over the longest interval, in this case one week. Then calculate all the smaller intervals in terms of the larger one.

A week is 7 days, each day is 24 hours, each hour has 3600 seconds, so your week is 7*24*3600 = 604800 seconds. During this interval you will wake up:

• 60480 times (for the once / 10 sec interval), plus
• 6048 times (for the once / 100 sec interval), plus
• 1 time (for the once / week interval)

In other words, in 604800 seconds you will wake up 60480+6048+1 = 66529 times. Calculate the wake time for each wakeup (in seconds, even if it is fractional), multiply it by 66529 and divide 604800, then multiply by 100%: this is your duty cycle.

Duty cycle = $\dfrac{66529 * seconds_{awake}}{604800}*100\%$

• Very specific answer to my question, thank you very much. – chwi Apr 24 '13 at 8:36

The duty cycle indicates how long your uC is on, relatively to the period ($T$) of the signal. Typically, it is $\frac{t_{on}}{T}\cdot100\%$. You have to calculate the duty cycle over one (or more) full periods. That is, you can only calculate the duty cycle of a periodic signal.

Let's do an example:

In indicated the active time with $a$ and the inactive time with $i$. You can see this signal repeats after $t_a+t_i$, so one period, $T=t_a+t_i$. You calculate the duty cycle over one period, so it is:

$$\frac{t_a}{T}\cdot100\%=\frac{t_a}{t_a+t_i}\cdot100\%$$

Now for a more advanced signal:

It isn't a very good photo, but I gave the first on-time $a_1$, the first off-time $i_1$, the second on-time $a_2$ and the second off-time $i_2$.

Again, you have to take the full period of the signal. You see the signal repeats itself after $T=t_{a_1}+t_{i_1}+t_{a_2}+t_{i_2}$. You can now calculate the duty cycle with:

$$\frac{t_{a_1}+t_{a_2}}{T}\cdot100\% = \frac{t_{a_1}+t_{a_2}}{t_{a_1}+t_{i_1}+t_{a_2}+t_{i_2}}\cdot100\%$$

So, to answer your question: calculate the duty cycle over one full period. This means you can only calculate the duty cycle of a periodic signal. If your uC wakes up due to, for example, an external signal, it doesn't make sense to calculate the duty cycle. You can of course estimate how long it will be on and how long it will be off, to see how much energy it will consume.

• Great answer, but @angel answered my specific question a bit better, would have accepted yours otherwise. – chwi Apr 24 '13 at 8:35
• @Wilhelmsen perfectly fine, but please do not accept an answer too fast. That discourages others from answering it, whilst there might be even better answers out there! Just wait one or two days and then pick an answer. I'm perfectly fine with it if that isn't mine. – user17592 Apr 24 '13 at 8:37
• Oh, okey. I will wait a couple of days then =) – chwi Apr 24 '13 at 8:38

The duty cycle for a microcontroller is just a figure that helps calculating the average power consumption. If the duty cycle is not fixed, like for example when it's woken up by an asynchronous signal, it doesn't make sense to express it in terms of duty cycle.

You could have an estimate if you could have the average period at which the event happens.