Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Motor/LED control using PWM

Status
Not open for further replies.

vikash23

Full Member level 2
Full Member level 2
Joined
Jul 31, 2012
Messages
133
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
2,676
Hi,

Please have a look at the below link

https://www.circuitstoday.com/pwm-generation-and-control-using-arduino

I am trying to understand PWM working

Two examples are mentioned 1.LED 2.Motor control.

What I dont understand is on the LED control using PWM the PWM output voltage is in the range of 0 to 5V

so it is ON for 387uS and off for 613uS.

From my understanding there will be 5V on the LED for 387uS and 0V for 613uS. in that case the LED switches on and OFF on a uS period.

The brightness can be controlled only by varying the voltage. Where the voltage remains constant for 387uS time period.

Can anyone please guide me on how to control the voltage ?

It's the same case for the voltage to the gate of the transistor to control the motor.

Speed can be varied by increasing or decreasing the voltage across the motor.

Am I wrong in understanding the concept of PWM ?

Thanks.
 

Hi,

so it is ON for 387uS and off for 613uS.
That´s the point.

it is ON for 39% --> therefore brightness is about 39% of full brightness (which is continously ON)
(if a PWM is ON for 39% it is called 39% duty cycle)

***
Imagine it is ON for 613us and OFF for 387us then it is ON for 61% --> therefore brightness is about 61%

********
The brightness can be controlled only by varying the voltage.
Here is your misunderstanding.
The brightness of a LED is almost proportional to the current. Better say average_current.

I recommend to look into a usual LED datasheet.
Here you will see that with 50% current (DC) the led brightness is about 50%, too. But the voltage is almost the same.

But varying the duty cycle from 0% to 100% will change the brightness from 0% to 100%.

But for sure the PWM frequency need to be high enough for your eyes not to recognize it.
Many years ago one said that 50Hz (20ms) is good. But it is only good for big areas, non moving areas and non moving eyes.
Therefore nowadays one uses 250Hz and more. But still with narrow points of light and fast moving one may recognize the PWM (frequency).

In your case it´s 1ms that means 1000Hz. Good frequency.

Klaus
 

Hi,


That´s the point.

it is ON for 39% --> therefore brightness is about 39% of full brightness (which is continously ON)
(if a PWM is ON for 39% it is called 39% duty cycle)

***
Imagine it is ON for 613us and OFF for 387us then it is ON for 61% --> therefore brightness is about 61%

********

Here is your misunderstanding.
The brightness of a LED is almost proportional to the current. Better say average_current.

I recommend to look into a usual LED datasheet.
Here you will see that with 50% current (DC) the led brightness is about 50%, too. But the voltage is almost the same.

But varying the duty cycle from 0% to 100% will change the brightness from 0% to 100%.

But for sure the PWM frequency need to be high enough for your eyes not to recognize it.
Many years ago one said that 50Hz (20ms) is good. But it is only good for big areas, non moving areas and non moving eyes.
Therefore nowadays one uses 250Hz and more. But still with narrow points of light and fast moving one may recognize the PWM (frequency).

In your case it´s 1ms that means 1000Hz. Good frequency.

Klaus

Thanks for your reply.

Yes I am aware that the brightness of the LED depends upon the forward current. But the forward current also depends upon the resistor and the potential applied. hence I=V/R.

So again is that the PWM controls the voltage by varying the on time and off time?

So then what is the difference between controlling the LED blink using a DIO rather than a PWM output.

the DIO can also be used to turn high and low for a specific period of time (mS).

If I program my controller to 1Khz and measure the output voltage on the PWM pin using voltmeter can I able to see the variation on the voltage according to the duty cycle ?
 

Hi,

So again is that the PWM controls the voltage by varying the on time and off time?
Again: It is not.

I thought I explained it already, that you can´t calculate with voltage.

an calculation example:
Imagine you have a clean 0.0V/5.0V switching 30% duty cycle PWM.
you have a LED with forward voltage of 2.2V @ 20mA
--> then calcualte R_V = (5.0V - 2.2V) / 0.02A = 140 Ohms

Now the correct calculation:
30% duty cycle gives 30% of average current which is 20mA x 30% = 6mA.
You may look into the LED datasheet and find brightness for 6mA.
This means a 30% duty cycle PWM´d LED will have almost same brightness as a LED with 6mA DC.
(This is not the very exact method, but it gives a very good estimation)


But you can´t calculate with voltage like this:
5V x 30% = 1.5V.
--> look into the LED datasheet. You will see that a LED will have almost zero current and thus zero brightness if you try to run it with 1.5V.
This means a 30% duty cycle PWM´d LED will NOT have almost same brightness as a LED with 1.5V DC.

Klaus
 

Hi,


Again: It is not.

I thought I explained it already, that you can´t calculate with voltage.

an calculation example:
Imagine you have a clean 0.0V/5.0V switching 30% duty cycle PWM.
you have a LED with forward voltage of 2.2V @ 20mA
--> then calcualte R_V = (5.0V - 2.2V) / 0.02A = 140 Ohms

Now the correct calculation:
30% duty cycle gives 30% of average current which is 20mA x 30% = 6mA.
You may look into the LED datasheet and find brightness for 6mA.
This means a 30% duty cycle PWM´d LED will have almost same brightness as a LED with 6mA DC.
(This is not the very exact method, but it gives a very good estimation)


But you can´t calculate with voltage like this:
5V x 30% = 1.5V.
--> look into the LED datasheet. You will see that a LED will have almost zero current and thus zero brightness if you try to run it with 1.5V.
This means a 30% duty cycle PWM´d LED will NOT have almost same brightness as a LED with 1.5V DC.

Klaus

Thanks again.

So then what is the difference between controlling the LED blink using a DIO rather than a PWM output.

the DIO can also be used to turn high and low for a specific period of time (mS).
 

Hi,

PWM needs no processing power.

"blink" is technically the same as PWM, but usually with lower (visible) frequencies.

Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top