Jump To:
Adding A Logrithmic Filter
           A logarithm is a type of reverse exponential function, but all we need to know is that light intensity increases in a logarithmic way. So, how do we use this information? Well, let's suppose we want a linear set of 32 points that represent everything from the LED being fully off and the LED being fully on. To do this we use the logarithmic function with base 32, which yields the following values (note I used excel):

(Remeber: Our LEDs Are Active Low, 0% PWM = Fully On)

           Even though the final numbers output that we should use for the duty cycle seem one-sided, they actually correlate to even steps from one LED brightness level to the next. If you needed a larger set of values, for example 20, you could simply use a logarithmic function with base 20 to get those values.

New LED Lighting Via PWM
           Let's take one final step now and look at how we should expect the signal to look and the LED to react to our input pulse. The animation below should give you a good Idea of what we are expecting:

           The LED now has the full fade-in and fade-out effect without any one-sidedness. Everything appears to transition smoothly without any choppiness. This is what we were looking for, and what we want to do with the actual system.