Forums
LED fade IN - Printable Version

+- Forums (https://www.studioscalemodelers.com/forums)
+-- Forum: Index (https://www.studioscalemodelers.com/forums/forum-623.html)
+--- Forum: General Modelling (https://www.studioscalemodelers.com/forums/forum-680.html)
+--- Thread: LED fade IN (/thread-594.html)



LED fade IN - erospawn - 04-20-2010

So, I've been working on understanding and programming this stuff and have come up with an LED fader..well this one fades in. May not seem like much until you understand how it works.. it uses Pulse Width Modulation.. written as a program.. You write the program such that the frequency is set at about 1Khz.. and remains the same. The trick is, you adjust the duty cycle over so many iterations such that the LED starts as on 1% of the time and ends up being on 60-70% by the end of they cycle. The Led is blinking so fast at 1%, it looks like the LED is barely on. There is still some adjustments to make look just right though. Lots of nice applications!


http://www.youtube.com/watch?v=i9mztIE5kuM


RE: LED fade IN - MonsieurTox - 04-21-2010

Great stuff !


RE: LED fade IN - erospawn - 04-22-2010

It pays to read the manual.. The above video shows the effect...but there was a mistake in my programming. While I had around 150 increments in the brightness, i was only using 20 of them.. so, the lights were quick to go bright.. I fixed that..It now takes longer to reach the spotlight level and it also appears much smooth going from one level to the next in brightness. The other mistake I made was that the pin I was using on the chip for digital I/O also servers as a comparator input and an analogue to digital input... You have to clear those registers before that pin becomes a digital +5 volt or 0 volt input.. thats why it was ignoring my switch. Could have saved some time if I had just read the manual Smile I'm working on these effects so If I want my engine lights to slowly fade in "as in warp power", they can.. and if I want them to do something like pulse in unison, I can.. makes the engines look far more realistic than just pressing a switch and the lights are on...


RE: LED fade IN - JAWS - 04-25-2010

Sweet. We're gonna get some good stuff out of you mate.