PWM fade
It has a PWM control... which i am trying to use to FADE in (and out eventually) a high powered LED (LUX III to be specific).. the problem I having is that at a certain point (say at 50-60%) of full brightness I see a VISUAL jump in brightness..
Im trying to get it to be smooth the whole way through to 100%
more or less the code is like:
PWM = PWM+2
which I then wait 10 mSecs and loop it again...
I have tried to put in some conditional checking to check to see if the current level of PWM is at a certain threshold..and then only loop it again after a longer delay (say 300mSecs) or something..
I tried to search.. ut Im not sure on how to get a CONSISTANTLY smooth fade...ot smooth to say 50-60%..then a visual jump in brightness and then smooth to 100%..
any ideas or links on the subject are appreciated.
Thanks
11
comments
|
Add Comment
|
the micro controller has specific PWM pins..... and the API has set functions to set the PWM.. I can fade in & out... however when I get to a certain point in fading in a high powered LED, such as a LUXIII or a P4 LED.. I see a visual JUMP in brightness as a certain point..
when asking around... I was told I need to code a 'curve' type stepping to make things more 'smooth' during my fade in/out..
this is the chip Im using:
http://www.replicantfx.com/FXOrion.html
and here is a link to the documentation for the API: (page 22)
http://www.replicantfx.com/files/FX_Orion_Jan09.pdf
thanks
for(mark=0; mark++; mark == 100){ //Start for loop
space = 100 - mark; //Calculate the off time
out(0) = 1; //Turn on the output(0)
wait(mark); //Stay on for mark-time
out(0) = 0; //Turn off the output(0)
wait(space); //Stay off for the space-time
} //End for loop
This will increase from off to on at a rate of one brightness level per 0.1seconds. To make it change from on to off, invert the for statement.
i.e. for(mark = 100; mark--; mark == 0){
I 'do' believe this to be a 'human eye' thing..where I see a visual jump in brightness at a certain PWM value..and not much more visual increase in brightness
example of code (linked to as site wont alow posting the code)
http://dmstudios.net/misc/MODULE.TXT
There's no conditional to check if the PWM variable =< 0, so an integer would just roll over. I.E., if byte A=0, A-1 yields a value of 255.
![]() |













Vancouver Mini Maker Faire 2012
Rebuilding NordicTrack ski machine drive rollers
Looking for New Zealand-based Instructables authors for conference on August 27 in Wellington
Call to makers - Brighton Mini Maker Faire
Milk Crates - not as green as you think
TEDxBaghdad - Iraq - violence, dust storms and open sourced manufacturing
UK Mini Maker Faire - The Derby Silk Mill - New Poster to Share!







