Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

changing the period of PWM

Status
Not open for further replies.
Hello.
I would like to ask a question regarding PWM

We all know the theory of PWM, that through changing the duty cycle we can provide something akin a analog value through only digital outputs. For example I can change the brightness of a LED by connecting it to a digital pin outputing PWM and controlling its duty cycle. No problem there.

But what happens if I change the other parameter: the period of the PWM signal??? What effect will it have on the load??

(Say for example I change Fosc from 1MHz to 16 or 48MHz)
 
What effect will it have on the load??
It depends what the load is. IMO, if purely resistive it shouldn't make much difference. But at those sort of frequencies parasitic capacitance and wire inductance become significant. What are you driving that needs such a high PWM frequency?
 
But what happens if I change the other parameter: the period of the PWM signal??? What effect will it have on the load?? (Say for example I change Fosc from 1MHz to 16 or 48MHz)
If you are simply changing the PWM frequency without changing the PWM value (i.e., the ratio of ON time to OFF time), then the answer is "probably not much."

I say "probably" because it all depends on the load and how it responds to that frequency change. An LED, for example, probably isn't going to care very much if you increase the PWM frequency 16X or 48X because they turn on and off in a matter of nanoseconds or, at worst, a few microseconds.

On the other hand, if you decrease the PWM frequency to below the eye's flicker fusion rate, the on/off behavior of the LED becomes visible and you end up with a blinking LED.

It all depends on the load.
 
Hello.
(Say for example I change Fosc from 1MHz to 16 or 48MHz)

At 16Hz it will flicker, at 48MHz it won't but you may get other problems at such a stupidly high frequency.

They say there are no stupid questions but your's come close.

Mike.
 
While it is theoretically true about stupid questions, there is no doubt about stupid answers.

Back to post #1, Is Fosc the clock frequency of a stand-alone PWM, or the clock frequency of a microcontroller that has an internal PWM? If the latter, then there probably is a pre-divider that can bring the PWM clock back down to its original value with the lower speed clock. And as mentioned above, there probably will be issues with a 48 MHz PWM carrier that were not present at 1 MHz, including radiated and conducted noise.

ak
 
PWM is used for buck or linear reduction if average.
With fixed Ton time PFM is used for boost regulators.
Most Buck/boost types use both or a hysteretic mode with valley switching or use PWM for med-high current and PFM to improve stability for light loads by reducing f.
 
While it is theoretically true about stupid questions, there is no doubt about stupid answers.

Back to post #1, Is Fosc the clock frequency of a stand-alone PWM, or the clock frequency of a microcontroller that has an internal PWM? If the latter, then there probably is a pre-divider that can bring the PWM clock back down to its original value with the lower speed clock. And as mentioned above, there probably will be issues with a 48 MHz PWM carrier that were not present at 1 MHz, including radiated and conducted noise.

ak

Thank you for your reply. Yesterday I found a way to reduce the frequency. It can not go all the way to 1MHz but will go to 16MHz and then by using prescaler dividers I have calculated that I can achieve the same effect of the original 1MHz...

So I guess with 48MHz there will be issues... thanks for the warning
 
It depends what the load is. IMO, if purely resistive it shouldn't make much difference. But at those sort of frequencies parasitic capacitance and wire inductance become significant. What are you driving that needs such a high PWM frequency?

It is a strip of LEDs that work with 12V.
Umm, it actually does not "need " that frequency. It is just that before I have used the internal oscillator of my PIC (which is at 1MHz) but now, since I am using a crystal oscillator of 48MHz the internal circuitry is also at 48MHz.
I was wondering what would be the effect of this change. (so far the ADC part of the system hasnt changed anything in its behavior)

I have found though a way to decrease the frequency of the PIC to 16Mhz. And then using some prescaler I think I can lower the PWM frequency even more...
 
Simple PWM uses LED > 300 Hz for flicker free can use Hysteresis inverting oscillator such as logic gate or comparator.

It depends on your output needs. Try sim. here
upload_2015-7-7_21-22-23.png
 
Well I ve tried it and so far no issues. The Period of course is greatly changed from 1024μs to 21μs but other than that, everything works as usual.
I was fearing some increase in heat or something...

I also tried using timer2 prescaling to lower the period of my PWM and good results so far
Thanks for the help
 
Last edited:
How are you generating that PWM signal? Software? What micro?
 
I have found a useful guideline for switches and diodes.

The RdsOn of MOSFET or Rce.sat of BJT's should be much less than ESR of load for low heat.
The ESR of diodes is related to thermal resistance and body size and thus power rating.
-use ESR = 1/ Watt max continuous [Ohms] as a close approximation. THus a string of n is n* ESR and switch ESR should be much less such as <10% of load ESR or 1% for cool operation.

some power LEDs are an array such as 6S2P so calc S/P accordingly as 3/W=ESR for incremental V/I when saturated.

Thus in the end ESR ratio of source/load will help in I^2R power loss distribution of source/load between 1~10%

Dynamic losses are caused by cap dump currents or eddy currents where again ESR ratio is important as capacitance loads drivers with Ic=Cdv/dt and becomes a short at very high f thus ESR ratios dominate at high F.
 
How are you generating that PWM signal? Software? What micro?

Oh sorry. I am using a PIC18F2550 and I am using its PWM module. The reason of my increase of frequency is I changed clocks from internal oscillator to 24MHz crystal.

Hey Kansai,

This article and video got me wondering:
https://www.foxnews.com/tech/2015/07/08/us-and-japan-set-for-epic-giant-robot-battle/
Video URL:

National pride is at stake. Do you happen to work for Suidobashi Heavy Industry? :joyful:

Enjoy.

John

Yes:nailbiting: and my reason for asking about PWM is I want to beat giant robots!!!:eek::rolleyes:
hehe [/joke]
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top