So What Is PWM ?
If you are an electronic enthusiast like me, sooner or later you are going to come across this question as to what is pwm and what is its use ?.
This very need for this question will arise because you would want to provide variable power supply to your output components.
Let’s say you want to brighten or dim your LEDs or maybe you want to control the speed of a fan or motor.
Or maybe you want to make those LED strips dance with varying intensity.
In this post we are going to discuss everything that you would possibly want to know about Pulse Width Modulation.
Not Only we are going to understand what PWM is.
In this post , I am going to tell you TWO SIMPLE METHODS that you can use to produce PWM signals.
In one method you will be generating PWM WITH AURDUINO and in the other method you will be generating PWM using a simple 555 Timer circuit.
And don’t worry all the schematics associated with the project will be provided to you for download.
So I got you covered.
PWM Full Form : What Does PWM Stand For ?
PWM stands for pulse width modulation.
Pulse Width Modulation is the method of effectively reducing the power delivered to a load/output circuit by continuously switching on and off the source of power/voltage at a very rapid rate.
So why would someone want to do that right ?.
Well, the simple answer is that is how you control the speed of a motor in an electronic circuit. Or intensity of an LED or LED strip in your home decor.
Still doesn’t make sense as to how PWM does it ?
Don’t worry. I have been in your place.
So in order to have more clarity into what pwm is and how to use it, let’s discuss the more traditional ways in which you can control power delivered to the load.
So once you know what are the various ways in which power delivery is done, you will have a clear idea as to how pwm is effective.
Plus it is a lot of fun.
Method 1 : Reducing Power At The Source
So this is one of the easiest ways of controlling output voltage to the load.
It’s so simple I feel silly telling you this. Well, I am silly so who cares.
So you connect the load or led or motor or whatever you want to an lab test bench power supply and you then control the power delivered by rotating the knob to whatever value you want.
So for example, if you have an LED on the output and as you gradually increase the voltage at the source.
The current through the LED will increase and if you keep the voltage level to the value your LED is rated for you can see it dimming and brightening in proportion to the voltage value you are letting loose.
Simple isn’t it.
But this arrangement won’t be applicable everywhere will it ?.
Yes, if you are just testing something out for a larger project or just testing the device in general this is a quick and dirty way to do it.
But an embedded system is generally a stand alone unit and will be far away from you to control all this manually plus talk about tedious ways of using tech.
Method 2 : Using Potentiometer
So if you are not like me chances are you paid attention in your high school.
And if you did, this segment will be very easy to understand.
Remember this ?.
Ofcourse, you don’t.
Don’t worry, here is what it means by varying the knob on my potential divider or potentiometer I control the voltage that is being delivered to my load circuit.
If still this isn’t clear to you do not worry. Very soon I am going to create a DIY project in which I will clear this in elaborate details so that you can get clarity about it.
For now just understand the theory and basis behind this.
What Are The Problems In This Arrangement And How Does PWM Solve It ?.
Now as we discussed this earlier the problem with method 1 is its not practical.
If you are creating a stand alone project you simply can’t deploy a test bench power supply.
And the problem with method 2 is two folds.
First off, it is a very passive way of delivering power. In the sense in order to vary power at the output, you have to dissipate the power that you don’t want delivered at the potentiometer.
That power just converts into heat and flows off.
Secondly, if you want to vary power in powerful devices such as LED strips, power motors and the likes.
You better make sure that the potentiometer that you are using is a beefy one.
Because it must be capable of endearing a lot of resistance and therefore the heat generated.
Because that is what a potentiometer at the end actually is. A Resistance.
Advantages Of PWM
So I feel this is something that you will have a clear idea about.
Advantages of PWM are that it takes car of all the disadvantages of other methods that we just discussed.
It actually takes a very simple circuit to generate PWM and we are going to discuss that in just a moment.
But just so that you are aware the two methods that we are going to see are one in which we generate PWM with Arduino and the other where we generate pwm using 555 timer.
How Does PWM Work ?.
So how does PWM work and what does a pulse width modulation circuit does different.
Alright, in case of pwm we are still going apply the fixed voltage levels to the load circuit.
It’s just that the applied voltage level will be applied at its peak value for a certain period of time dictated by this word called duty cycle.
For example, let’s say you have want to control the speed of a motor. And 5 V is the peak value that motor is rated for. Generally, its more but just for example consider this.
Understanding Duty Cycle
And in pwm we will be applying a pulse of 5 V for a fixed interval of time. This fixed interval of time expressed as percentage for which we are going to apply 5 Volts is called duty cycle.
So if the PWM signal is generating pulses at 50 percent duty cycle. It means that 5 V will be applied for 50 percent of the time and for the remaining time time 0 V will be applied.
Now I know what you are thinking.
Won’t this lead to LED flickering ?.
Absolutely not. Perception of time in electronic world is so quick that you can’t notice it with your eyes.
An the result is that the average power delivered to the LED or motor in this case is just 50% of what you would expect if you applied full power from the source.
So if a PWM signal has a duty cycle of 50% you can expect the LED to brighten up to half of its highest capacity.
Or in case of pulse width modulation motor control, the motor will run at 50% of it’s highest rated speed.
Now, you can discern what would happen if the duty cycle was say at 75%.
See, I knew you were smart. Don’t doubt yourselves.
Pulse Width Modulation Circuit : How To Create One ?
So ultimately what is happening is this whole process takes place really really fast and at the end the output you will be seeing is an LED whose power or gets elevated or depreciated depending on what kind of Duty cycle is being applied.
And once you master this technique of pwm where you actually regulating the duty cycle of the signal applied, you can use this technique to apply variable power supply to virtually any output load.
Motors, LEDs, Power LEDs, LED Strips the list is endless and dictated by your creativity.
So, if we summarize the whole process, we are providing voltage in an regulated chopped fashion which ultimately results in controlled output power delivery.
Let’s go ahead now and discuss how to go about creating a PWM circuitry.
So what are the possible reasons you would want to create one.
Well, if you are an electronic enthusiast like me you need to have these basic circuits on the go.
And not to mention if you are beginner, these are probably the ideal circuits that you should look forward to make and get your feet wet with practical electronics.
Plus, I don’t need to reiterate how controlling power via PWM results in increasing the overall effectiveness of the circuit.
Because here instead of dissipating power in a passive element like a resistor or potentiometer. You are switching power delivery OFF from the source and only letting in what is needed via the signals duty cycle.
This was the basic theory behind what pwm actually is.
Now let’s go ahead and see how to actually create this variable signal that you can use to power down your LED or any electronic component that you want to provide variable power to.
PWM With Arduino
Sothe first method that we are going to discuss to generate PWM is with arduino.
Don’t worry, if you do not have an arduino or for some reason you cannot arrange one for yourself because we are going to look into how you can do it without arduino too.
But if you are electronic enthusiast like me.
I am sure going to have a one. It’s fairly cheap also. You can get one from here.
I have one in my house and I am going to use that to show you how to produce a pwm signal from arduino.
In order to accomplish this task we are going to use our Arduino’s AnalogWrite function.
In your coding console for aurduino your code will look something like this.
All we have to do now is feed this parameter “potentiometervalue” a value between 0 to 255.
Where 0 will be equal to 0 V.
And 255 will be equal to 5 V.
The analog input in this case can be provided with a potentiometer and this analog input can be used to vary the AnalogWrite() function.
Here is the schematic that you can refer.
So let me explain the whole idea behind this.
Analog Input is caught from the potentiometer which is mapped to an output value in between 0 to 255 which in turn corresponds to proportionate voltage output at the arduino output pin, where our LED or motor can be connected.
I understand that some of the terms that I am using may not be too beginner friendly, but I am constantly updating yantraas with new tutorials that you can refer for clarification.
If any doubt still persists you can always find me in the comments section.
PWM With 555 Timer IC,
While building a PWM circuit with arduino can be quick.
You may not always want to waste an arduino or a microcontroller IC on such a simple task.
Especially if you are working on a big project and you want your project upfront cost to be low.
Or maybe a module of your project already uses arduino and you want PWM to be handled by a create and forget PCB.
Whatever the case maybe if that is what you want, you need to call upon the grandfather of all electronic ICs, 555 Timer IC.
Oh, the fun I have had with this baby.
The fun and not to mention the pull my hair out session when after doing everything right the circuits still didn’t work. :P.
Now it’s very easy to work with once you know what each pin does.
Here is the schematic you ought to use for creating a pwm circuit using 555 timer IC.
The duty cycle again will be controlled by a potentiometer as shown.
The pin 3 as you can see will output the PWM signal that can be used to drive any load that we may want.
What About High Power Demanding Circuits
That’s a good question.
One thing that we need to understand while working with electronics is that most of the time we work with low voltage demanding devices.
But what is also true how to extrapolate these projects or work to high voltage application scenarios.
In this case, for example we may want to vary the power delivered to an LED strip or high power motors.
We accomplish that by using a MOSFET. I don’t want to go into the details of MOSFET as of now.
Just understand what is the practical significance of MOSFET in hobby and practical electronics and how it is deployed here in PWM circuits.
If you paid attention in my circuit schematic for 555 timer pwm circuit you would have noticed I applied a MOSFET there.
And that is how you are going to incorporate it in your projects as well.
But just so you are not confused here is how you connect various pins.
The PWM signal from the arduino output or pin 3 of 555 timer circuit goes to gate, the short leg/negative side of your LED goes to drain and source of the MOSFET is going to be connected to the common ground pf all devices or in other words, your battery’s negative terminal.
What is A PWM Controller ?
Believe it or not I am including this segment after I have already completed this post.
What happened was I was receiving a lot of queries from our readers asking what is a pwm controller.
Umm guys, we just built one. Lol :D.
Yes, this PWM generating device or circuitry that we just built is actually a PWM controller. A circuit that provides or controls A PWM signal.
But truth be told these electronic terminology can get quite confusing so its good that you asked this question and I am including this segment to clarify the confusion any other reader possibly might have.
Another thing people asked is.
Well Rajput, All of this is fine but what is I don’t want to make this stuff. I just don’t have the time and I need a PWM controller fast for my projects where can I get one ?.
So for all those people I scouted the online world and came with some of the best pwm controllers that I could find that you can buy right now.
NOTE : This isn’t an exclusive list. The product will depend on what your needs are please check the ratings and wattage before you buy as to whether it fulfills your requirements.
- RioRand 7-80V PWM DC Motor Speed Controller Switch 30A
- DC 10-50V 60A High Power Motor Speed Controller PWM
DROK DC 6-90V 15A DC Motor Controller
What Are PWM Fans ?,
Just as it was for PWM controllers please do not get confused when you see the word PWM fans. PWM fans are just fans that are being regulated using PWM.
Now PWM fans find primary reference when you are working with computers. In our build your own PC guide we discussed how to build your own computer in elaborate details and there we discussed importance of fans for properly cooling your system.
PWM fans and pumps can alter their speed and airflow based on the component’s temperature.
To use this feature, you’ll need a motherboard with a PWM header.
So when you deploy PWM fans in your computer can you guess what’s is going to happen.
Yup, regulating the speed of your PWM fan can be done using the temperature of the entity it is deployed to cool.
What will Be the benefit ?.
So instead of having a fan that is continuously running and dissipating energy you have an intelligent mechanism that turns off when no cooling is needed.
Isn’t that fantastic ?.
I hope you now understand how incredible this neat little technique of pulse width modulation is.
That kids was my simple and quick way through which you can produce PWM signals and express your creativity as far as practical electronics is concerned.
I understand it very well that although some guys who have fair bit of experience with electronics would have understood everything.
There might be people who would want more clarity regarding itty bitty details here and there in our discussion.
Well, that why we have comments section now don’t we.
Feel absolutely free to ask or suggest anything that your heart says and I will make it a point to clarify or reply to the best of my understanding.
And whatever is not in my domain of understanding I will refer you to someone or something that knows better.
I hope you are enjoying everything here at yantraas.
I will be back with awesome posts like this.
Till then enjoy expressing your creativity and don’t forget to share that with us just as you will share this post amongst your friends and loved ones 🙂 🙂 :).
Cya soon. Lots of Love.
Namaskaram _/\_ 🙂