Is PWM AC or DC? | 2 Easy Ways of Generating PWM Signals!

Once you dip your feet into practical electronics, it is only a matter of time before you hear pulse width modulation.

Pulse Width Modulation is a crucial concept to learn and apply in electronics. 

PWM is a way to provide variable power to an output load.

So, with a PWM signal, you can dim your LEDs, control the speed of a motor or a fan, or make LED strips put on a light show if you are creative enough.

In this article, let us discuss what exactly pulse width modulation is in addition to some common questions that beginners have.

As we proceed, I will even teach a couple of methods you can use to produce PWM for your projects.

So, without further delay, let us get into it by starting with the basics.

Is PWM AC or DC?

Talking strictly in low-voltage electronic applications, PWM can be called pulsating DC at best. For a signal to be AC, it needs to change polarity or direction. Also, the signal value doesn’t remain constant throughout, like DC. Therefore, PWM is neither AC nor DC.

The PWM technique has varied applications. One good example is your PC fans. For quieter operations, you would want your PC fans to run at full speed only when required.

Without PWM, your fans will never slow down and operate, depending on how much cooling is needed.

Not having PWM fans wastes energy and results in noisy operation.

By the end of this article, you will have a much more comprehensive understanding of pulse width modulation.

What Is Pulse Width Modulation?

Pulse Width Modulation, or PWM, effectively reduces the power delivered to a load/output circuit by continuously switching on and off the source of power/voltage at a very rapid rate.

Now there are easier ways to deliver variable power to the load, so why go through such a complicated process?

That is a good question and something I had when I first learned about PWM.

So, before I answer that question, let us learn about the relatively basic ways of varying power to a load.

Once we learn about the basic ways and the drawbacks associated with them, understanding PWM will become easier.

  1. Controlling Power at Source

One of the most obvious ways of varying the power at the load is by controlling it at the source.

It’s not even a method, really, just a general sense. All you need is a good quality lab power supply like this one.

NICE-POWER DC Power Supply Variable: 30V 10A Adjustable Switching Regulated High Precision 4-Digits LED Display 5V/2A USB Port Test Lead Output & Input Power Cord Bench Lab Power Supplies
  • 【High Precision, Low Ripple, LED Display, Auto Switch C.C/C.V Mode】NICE-POWER 30V 10A DC power supply is a professional power supply regulator with high accuracy of 0.01V and 0.001A, low ripple of DC power supply. The backlit 4-digits LED display has the advantage of high resolution, which can be easily viewed even if you are in low-light conditions . Adjustable power supply has C.V/C.C indicator, constant voltage and constant current mode can automatically complete the switch.
  • 【CE & FCC Certification, Multiple Protection, Various Application】Lab power supplies have passed CE & FCC Certification. 30V DC power supply has multiple protections: overvoltage protection, overcurrent protection, overheating protection, over power protection, short circuit protection, leakage protection. DC power supply is suitable for LiFePO4 battery charging, arduino project, anodizing, laboratories, schools, electronic maintenance , electrolysis, electroplating, lamp test, DIY, etc.
  • 【Stable Vertical Design, Lightweight and Portable】Bench power supply adopts stable vertical design, DC power supply has shock absorber rubber feet at the bottom, so it will be safer and more stable during use. DC power supply is very light and portable, with a size of only 3.3 x 9.4 x 6.1 inches and a weight of only 2.6 pounds. You can easily take the DC power supply to work.
  • 【5V/2A USB Port, Intelligent Cooling Fan, High-quality Materials】The DC power supply is equipped with a 5V/2A USB port, you can charge your mobile phone, tablet or other devices. When the working temperature of the DC power supply exceeds 122℉/50℃, the cooling fan is turned on intelligently, which can effectively dissipate heat. , Reduce working noise and prolong the service life of equipment. High-quality materials make our DC power supply more durable.
  • 【Quality Check and Terms of Service】You will get DC Power Supply*1, Output Power Cord*1, Input Power Cord*1, User Manual*1 by purchasing DC power supply. We will inspect all DC power supply and accessories before shipment to ensure that the quality of the products received by each customer is good. We provide a 12-month warranty policy. If you have any questions about our DC power supply, please feel free to contact us, we will response back within 24 hours.

You connect the load (LED, motor, etc.) to the appropriate cords and control the power by rotating the knob to a value within the load’s capacity.

So, for instance, if you have an LED as a load, as you increase the voltage, the current through the LED will increase, and so will its intensity.

You must ensure that you do not provide power greater than the load’s rated value. 

You can dim and brighten the LED within the rated value using the power supply’s power control knob.

Simple, yes, but you can sense the apparent flaw in the arrangement.

For testing purposes, a simple arrangement like this does work well. But there are better ways to create a standalone unit with automatic control.

  1. Voltage Division using Potentiometer

The second way to provide variable power at the load is by using a simple voltage divider circuit/unit.

[insert image potentiometer with load]

You can easily create a circuit that provides a variable voltage at the load.

And depending on what voltage value you subject them to, different potentiometers are also available.

This method is more practical when compared to simply controlling the voltage from the source.

As you continue developing electronic projects, you will use a potentiometer to vary the applied potential in many circuits.

As you will see, PWM is very effective in applying variable power to a load, but you will not need something so complicated in many circuits.

Electronics is all about getting a suitable unit for the job. And in most cases, a simple potentiometer will be enough.

So, gauging what is required is a vital skill in electronics. You will learn it with time.

Advantages of PWM

Controlling power from the source is impractical. 

If you are creating a stand-alone project, you need automated control. 

For instance, if you wish to light an LED automatically, depending on how much light falls on an LDR(light-dependent resistor), you need a standalone processing circuit.

The potentiometer method is suitable and viable for many use cases but has limitations.

First off, it is a very passive way of delivering power. 

The power that doesn’t reach the load is dissipated at the resistor of the potentiometer. 

Secondly, if you want to vary power in powerful devices such as LED strips, power motors, etc., you will need a powerful, not to mention a chunky potentiometer.

A big potentiometer means more power loss.

Pulse Width Modulation addresses all these disadvantages of fundamental methods.

It takes a simple circuit to generate PWM, and in the next section, we will learn how to generate a PWM signal.

I will discuss the two most common methods of generating PWM signal, which are;

  • PWM using a 555 Timer
  • And PWM with Arduino

But before we learn how to do that, there are just a few more things that you need to know.

What is a Duty Cycle?

Now how does a PWM circuit or system work?

With PWM, we still apply a fixed voltage to the load circuit, but only for a certain period dictated by the duty cycle.

So, for an LED circuit rated for a maximum of 5V, a PWM signal with a 50% duty cycle means the source voltage will be ON half the time and closed for the other half.

You may think, won’t this create a flickering LED?

No, it won’t because the switching happens too quickly for the naked eye to notice.

So for a 50% duty cycle circuit, the average power delivered to the load (LED or motor) is only half of what it would have received if PWM was not there.

Therefore, the LED will glow with half its maximum intensity for a 50% duty cycle signal. And if the load circuit is that of a motor, it will run at half the speed of its rated maximum speed.

Similarly, a 75% duty cycle will ensure that the motor runs at 0.75 or ¾ of its maximum speed.

How to Create a PWM Signal?

With PWM, you control how much power to provide to the load in a very active sense. There is no energy dissipation involved.

Once you learn how to create a PWM signal, you can provide variable power to any load circuit, like motors, LEDs, power LEDs, circuit fans, etc.

So, how to create a PWM signal?

As I mentioned in a previous section of this article, we will learn two ways of generating PWM signals.

It’s the perfect time to mention this. As you get into practical electronics and get more experienced, you will realize there are specific circuits you need everywhere.

When I started, I created a motor driver circuit, a custom-made Atmega8L pin board, an LCD module, and a PWM circuit.

Your handy circuits will differ, but I am sure you would want a PWM circuit, given how much it is used. 

Here is how you can create it.

Creating PWM Signals Using Arduino

The digital pins of Arduino give either 5V(high) or 0V(low) on their output. So, you cannot dim your LED by providing a voltage between 0V and 5V.

But by changing the ON and OFF times, we can create a PWM signal out of the Arduino pin.

To generate a PWM signal out of the Arduino, we will be using the analogWrite() function of the Arduino IDE.

In Arduino Uno, the PWM pins are 3, 5, 6, 9,10, and 11. The PWM signal frequency on pin five and pin six is 980Hz; on the remaining pins, it is 490Hz.

These pins have a ~ sign which tells you they can generate PWM.

We can use the analogWrite() function to map the frequency to a value between 0-255.

So, analogWrite(0) will mean 0% duty cycle, analogWrite(127) 50%, and analogWrite(255) will mean 100% duty cycle.

You will need an Arduino Uno, a 220 ohms resistor, a potentiometer, an LED bulb, and some jumper cables.

Connect everything as shown in the schematic below.

generating PWM signals using Arduino

Next, upload this code in the Arduino IDE, and upon moving the potentiometer knob, the brightness of the LED will change.

int led_output = 6; 
int pot_input = A0;
int output;
int ledmapped_value;

void setup() {
  pinMode(led_output, OUTPUT);
}

void loop() {
  //Reading analog value from the potentiometer
  output = analogRead(pot_input);
  //Mapping the analog value from the potentiometer to 0-255
  //0-255 value will act as the duty cycle value
  ledmapped_value = map(output, 0, 1023, 0, 255);
  analogWrite(led_output, ledmapped_value);
  delay(1);
}

Creating PWM Signals Using 555 Timer

Building a PWM Circuit using an Arduino is fun, but if you want a more compact setup, you can create a PWM module using a 555 timer.

Many loads will require a PWM input. You don’t necessarily need a microcontroller to generate it all the time, especially if you can develop a relatively cheaper and just as effective circuit.

It’s along the lines of the phrase; you don’t need a sword to do a needle’s job.

If you are already doing a project with Arduino, then it’s perfect. But a custom circuit with a 555 timer will do just fine for simple circuits that demand PWM.

And as I said previously, in electronics, for specific tasks, you need to have a custom circuit ready to deploy when needed.

You can use the following schematic to create a PWM circuit using a 555 timer IC.

pwm with 555 timer IC
PWM Generating Signal Using 555 Timer

The duty cycle will again be controlled by a potentiometer, as shown.

Pin 3 will output the PWM signal, and you can drive any load you want.

Pulse Width Modulation FAQs

You now have a comprehensive insight into PWM, why it is valuable, and how to create it.

So much more can be said about PWM, but I wish to keep the topic tight and easy to digest.

That said, here are a few more questions that beginners usually have. The comments section and my email are always open if you wish to know more about PWM.

How to use PWM for High Power Circuits?

You will need more current to drive high-power circuits like power LEDs and motors. To accomplish high current demand, you will need a MOSFET. The output from the PWM circuit goes into the MOSFET’s gate, the drain terminal connects to the LED’s negative terminal, and the source gets grounded. 

In that way, the excess current demands are met from an external power source, and our PWM circuit operates independently of the load circuit thanks to the high impedance offered by the MOSFET’s gate.

What are PWM Controllers?

PWM controllers are discreet units that can generate PWM signals. You can easily create one using Arduino or a 555 timer, but industrial and military-grade PWM controllers are also developed for more rugged use.

Also, not all of you would want to create your own PWM controller, and that’s fine. As a matter of fact, for big projects, you would want smaller modules ready to deploy.

So, if you go to an electronics store or search online, you must use the term PWM controller to get what you need.

Here are some of my favorite ones.

What are PWM Fans?

Fans whose speed can be modified using a PWM signal are termed PWM fans. There is a good chance your PC uses a PWM fan(uses a 4-pin connector). The temperature regulates the speed of a PWM fan in a PC. So, instead of running all the time, causing energy loss and noise, PWM fans slow down or turn off when they are not needed.

I hope you enjoyed this discussion on pulse width modulation as much as I enjoyed creating it.

PWM is one of the beginner concepts that you learn when you first start dabbling into practical electronics seriously. And the reason I created this article by covering varied facets is because you cannot afford to make mistakes with the basics.

If your basics are strong you will see that perceiving advanced concepts becomes easier.

And as I said, this is a vast topic, and there is so much we can still discuss on it.

But I don’t want to bore or burden you with too much knowledge.

If you have any further questions, you can email me or write your question in the comments below.

Remember to subscribe to the blog so that you can contact me anytime regarding any tech query.

You can find the subscription box below. 

Take care of yourselves, and I will see you around!

Electronics Engineer | Former Deputy Manager | Self-Taught Digital Marketer.Owner & Admin Of A Network Of Blogs and Global E-Commerce Stores

Pin It on Pinterest