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.

How exactly do you “know” what herz the LED should PWM to be at 50% brightness

Status
Not open for further replies.

Bracer

New Member
In PICBasic, we have this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.

Now all is well, I assume that PICBASIC knows somehow [which is pretty incredible which I will explain later] how to PWM the LED so that it is at 50%.
So that line basically say PWN the LED so that it reaches 50% brightness and keep it that way for 1 second.

That is all fine...until I start thinking about it and start asking this.

Why can't PICBASIC allows for this ?
PWM PortB.0, 127

Yes, why don't they allow this ?
This would allow other operation to continue if it's not for the original command that entails a need to put a time behind it hereby stopping everything else in its track.


And Since PICBASIC don't allow:
PWM PortB.0, 127

and instead make it like this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.

I have to assume there is some "magic" going on here.

Like....how the hell could PICBASIC knows what many time to turn on and off in a sec for it to "look" like it's at 50% ?

Is there a chart that says if you turn on and off LEDs at a specified amount of times a sec it will be at 25% brightness ? 50% ? 70% ? etc...
Where is that "chart" ?

Or is that "chart" a secret ? he he he
 
Last edited:
In PICBasic, we have this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.

Now all is well, I assume that PICBASIC knows somehow [which is pretty incredible which I will explain later] how to PWM the LED so that it is at 50%.
So that line basically say PWN the LED so that it reaches 50% brightness and keep it that way for 1 second.
...

Nope, it says absolutely NOTHING about the Led's Brightness. All it says is that the average current through the led will be 127/255 of what the current would be if the PWM were loaded with 255 instead of 127.
 
Last edited:
No magic. The duty cycle is simply the relative amount of time the output is high versus low. Thus for 25% duty cycle, the output waveform would be high 25% of the time and low 75% of the time. It has nothing to do with the frequency of the waveform. See this for further info.
 
1) From a light source like a LED, If the light is on 50% and off 50% then the total light is 50%. Your eye is non linear and will see a small change in brightness.
2) I use PicBasicPro, It ths two different PWM sommands. PWM is done in software on any pin. The computer is only doing the PWM command and nothing more. There is a HPWM command that used hardware. It can only function on a pin that is connected to the "counter-PWM" pin(s). When started it will continue while the CPU does other chores.

This is much like the serial out and Hserial out commands. One can be on any pin and uses CPU power to do the job while the other uses hardware and only the RX & TX pins, and uses little CPU power.
 
No magic. The duty cycle is simply the relative amount of time the output is high versus low. Thus for 25% duty cycle, the output waveform would be high 25% of the time and low 75% of the time. It has nothing to do with the frequency of the waveform. See this for further info.

That's just it, according to your:
"the relative amount of time the output is high versus low.", the magic question is, what amount of time ?
How many time must an LED turn on and off within WHAT amount of time [this is where you "relative" amount of time comes in] to make it look like it have a brightness of 50% ?

By using the word "relative" here, your answer become just another way of restating my question :(

Where is the chart that says how many time you must turn on and off the LED within WHAT span of time to constitute a certain amount of brightness ?
One big round and back to ground zero.
 
Last edited:
...
Where is the chart that says how many time you must turn on and off the LED within WHAT span of time to constitute a certain amount of brightness ?
One big round and back to ground zero.

You asked the wrong question the first time... ;)

Your answer will be primarily be found in a text book that deals with visual physiology. You should also be looking for application notes on the LED maker's web sites.

Google search for "Apparent brightness of LED vs PWM duty cycle"
 
Last edited:
Do you want to know......50% power as measured in watts?
Do you want to know......50% power as seen by the human eye?
You have asked about time. Time on, Time off, over span of time. ????
(Time on = 1mS, Time off = 1mS) and this happened for 1 week of time, then you will send 1/2 as much power out in light compared to 100% on for the same week. (on,off,on,off,on,off,on,off,on,off,on,off,on,off,on,off,-------for 1 week) 50% of a week, 50% of a day, 50% of a second is 50%.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top