top of page

Duty-Cycles; Electronics & Everyday Life

Updated: Feb 3, 2022

Duty cycles are an important part of electronics; anyone who has dabbled with circuitry has come across it. For me, it was the ‘AnalogInOutSerial’ sketch in the Arduino IDE, the one that dims LEDs using the concept of duty-cycles, that prompted me to read about duty-cycles.


What are duty cycles? Quite basically, it is the ratio of the time the circuit is ON compared to the time ratio is OFF.

Digital electronics consists of 1s and 0s; 0 volts or 5 volts; on or off; anything that consists of merely two states. Digital circuits, like the Arduino, can only output two states out of their pins: 0V or 5V. Nothing in between.

But then what if we want to acquire a voltage in between those values? Suppose we want to dim the light of an LED, or slow down the speed of a DC motor that has a max capacity of 5V.


One method is to use a voltage divider. That, however, wastes a lot of power, which is particularly concerning in high power devices. A more efficient method is something known as pulse-width-modulation.

If we can somehow switch on(5V) and switch off(0V) the output really fast…

The average perceived voltage is the average of these two voltages. In this case, it's 50%(since it's on for x seconds and on for x seconds).

The appliance too, LED or motor, perceives this as 50% of the voltage, in this case, 2.5 volts.

Similarly, if we could somehow vary the proportion of the on and off time, we could get different voltages.


Switching on 25% of the time; the average voltage becomes 5/4 * 1 = 1.25 V

Switching on 75% of the time; the average voltage becomes 5/4 * 3 = 3.75 V

By literally modulating the pulse, we get different results.

Duty cycle can be represented as a number or percentage. When represented as a number, the average voltage is simply the (Maximum voltage * duty cycle).


This looks as if pulse-width-modulation is a gateway between digital and analog electronics.


It was with this knowledge that piqued my intrigue about how my microwave worked. Using different modes like defrost, or even adjusting the power setting to different percentages now made me think that microwaves too may use duty-cycles.

The main component of the microwave, the magnetron, the device that produces the…microwaves, could work with duty cycles. And why wouldn’t it? It is a high-powered device that needs to be used in different levels of intensity, and has only ONE input voltage: ~240V.


And that was my hypothesis which I firmly believed was true until I found something interesting about my microwave. While heating my morning coffee as I always do, I realized that heating it once for 40 seconds makes it hotter than heating it for 20 seconds twice(with negligible interval of time in between). Hmmm. Something wrong with the microwave? I tried it two more times. Same result. I finally brought a thermometer and a glass of water to the test and sure enough, it was about a degree or two higher when I heated it for 40 seconds once.


I assumed for the moment that there was nothing wrong with my microwave and wondered why such a thing could happen. My only theory was that the microwave ‘took some time to get started and heat’, whatever that may mean. After a bit of research, it was clear that my theory was right. The magnetron takes about 1-1.5 seconds to warm up from while turning on because it's a vacuum tube.


But if it takes that long to switch off and back on again, how could it possibly use duty-cycles, switching on and off several thousand times a second, to vary its power? It doesn’t.

As it turns out, my microwave(older models) use the concept of duty-cycles but in a much more crude way. Instead of switching off and on thousands of times a second to produce an average heating effect, it switches off and on in 10-15 second intervals. It heats up my milk in full power for 10-15 seconds, and then stops for 10-15 seconds if I’ve set it to 50% power. That's a little unexpected.

This kind of microwaves can be problematic; I’ve heard people on the internet complain that some foods get a little cooked because of the prolonged intense heating, rather than just getting warmed up.

In fact, this is true in refrigerators too! It’s the same, except that a high-powered magnetron doesn’t warm the food, but a high-powered condenser cools it. As it takes time to switch on and off, the condenser switches on for 5-10 minutes and then switches off for another 10-15 minutes. This too can be problematic as it results in constant alternating of cooling and warming of food(I’m no culinary scientist, but that could cause some changes in the food).


However, not all microwaves and refrigerators are like this! Almost all the newer model appliances use something called an inverter that comes in between the mains supply and the magnetron/condenser, to solve this very problem. An inverter is simply a DC-AC converter.

The power of the magnetron(and condenser) can be controlled by changing the frequency of the AC power supplied to them by something called variable frequency drive variable frequency drive. However, changing the frequency of AC power from an AC source is much more difficult and results in more power-losses than changing the frequency of AC power from a DC source. So that's where an inverter comes in - it both converts DC to AC power and can modulate the frequency of that converted AC power, thereby controlling the intensity of the magnetron.

With this addition, a 50% power setting wouldn’t mean ‘on for 15 seconds, off for 15 seconds’ but a constant 50% power indefinitely.


So if you’re serious about cooking, spend some extra money and get an inverter refrigerator and microwave; I’m sure it would make a difference.


But this inverter concept and its benefits seems pretty straightforward…why has it come about only now in the newer models? I think that’s because technology in AC-DC and DC-AC conversion has advanced greatly over the years to minimize power losses. Touch your phone or laptop charger…it doesn’t get very warm, which means power losses from AC-DC conversion are brought to a minimum. This wasn’t possible 20 years ago.


There was an instance when I used duty-cycles to solve a problem of mine. My newly bought table lamp was extremely bright. I would have to take a short walk outside my room every 5 minutes to ease my eyes from the strain. I couldn’t move it further away in my small table, and it didn’t come with a brightness adjuster, so I decided to make one myself. I opened up the lamp and saw a rather simple circuit; the plug went through an AC-DC converter where the 240V AC to 50V DC, and that went into the LED strip.

Now the first thought I had in mind was to simply add in a resistor that acts as a voltage divider so that the brightness is reduced. However, that could waste a lot of energy! And I’m all for conserving energy. How much energy would be wasted?

Let’s say I want the brightness halved. And since light energy is converted from electrical energy, that would mean the power consumed by the LEDs would have to be halved.

P = Power, I = Current, r = resistance of LEDs, R = external resistance



Since power has to be halved, the current flowing through the LED has to become



So if we add in a series resistance and solve for (ii), we get



With R in series, the new power consumption would be



This shows that 70% of the original power would be used by getting brightness halved.

However, If I somehow used duty cycles, it would use only 50% of the original power(because it's on half the time, off half the time).

That 20% may not be much(1 Watt in my 5 Watt lamp), but considering that my lamp is on from 8am to 11pm, it saves quite a bit of energy.

So, I used a 555-timer IC to vary the duty-cycles(pulse-width-modulation) and now I have a brightness-regulated lamp that saves energy(I’d probably show this in another blog).


Duty-Cycles in Music:

I was surprised to see that duty cycles are used in music too! I’ve always been excited about relationships between math and music…be it fourier synthesis or harmonic series. Turns out, duty-cycles are widely used while making electronic music.

I’m sure you’ve seen synthesizers before; they come in many shapes and forms. A DJ uses a synthesizer with turntables. I bet you’ve also seen a keyboard-synthesizer.

A basic synthesizer consists of a waveform generator, filters and processors, and a speaker or amplifier. The waveform generator produces a sound; this can be anything from a single tone to a pre-recorded piece. This sound is then passed through various filters and processors; this is where the music is created. And the final signal is then passed through the amplifiers for the crowd to hear.

As I mentioned, the waveform generator can produce different sounds for the DJ to start with. Combinations of different sine-waves are often produced to make sounds of varied timbres. Quite commonly, DJs start with square and rectangular waves. They have a nice characteristic sound that I’m sure have been used in many popular songs we hear.


Watch this short video demonstration of the role PWM plays in electronic music...its pretty damn cool.


An interesting fact about these square and rectangular waves is that the duty-cycle can be related to the absence of specific harmonics. A square wave, duty cycle 0.5, or ½, is missing every second harmonic. A rectangular wave with duty-cycle 0.25, or ¼, is missing every 4th harmonic. The same is try for rectangular waves with duty cycles ⅛, 1/16, etc.


Using audacity, I generate a square wave:

I then plotted a frequency vs amplitude graph using the 'plot spectrum' feature(more on this in my 'Bass'ics of Audio Recording blog') to inspect the harmonics.


The first harmonic is 440 Hz. My cursor is actually hovering over first peak you see pointed to, but while screenshotting my screen the cursor isn’t shown


The second harmonic is supposed to be 440*2 = 880, but it skips to the third harmonic is 440*3 = 1320Hz.

The fourth harmonic is supposed to be 440*4 = 1760, but it skips to the fifth harmonic, which is 440*5 = 2200 Hz.

Similarly, the third, fourth, fifth…nth harmonic will be missing in rectangular waves with ⅓, ¼, ⅕ duty-cycle(Audacity cannot generate rectangular waves so I can’t show you all of them). I do not know why this happens; perhaps in a year or so when I learn all the math behind fourier analysis I will update you on that information.


Hopefully you learnt a few interesting things about duty-cycles today. I will see you all in my next blog!




bottom of page