# Dividing 0 to 100% exponetially for dimming light

#### Vindhyachal Takniki

Joined Nov 3, 2014
583
1. I need to dim a light 0 to 100% depending upon user input 0 to 100.
Have a driver to which when I pass value 0 to 100% by microcontroller it dims the led accordingly.

2. I was reading below image from this datasheet: https://www.ti.com/lit/pdf/slvaef3

3.Page 6, says "Human perception of brightness is not linear with luminance of the LEDs and is more sensitive at low
luminance, which is approximated to a logarithmic curve. So if the linear dimming control method is used,
the final perceived brightness is not linear in human perception. That is why exponential dimming is used."

4. Now have to divide 0 to 100% exponetially? How do I divide the number 0 to 100% exponentially when user input comes 0 to 100?

#### MrChips

Joined Oct 2, 2009
23,507
Use a look-up table in the MCU.
User inputs a value from 0 to 255. The look-up table contains 256 values of your choosing.

#### Tonyr1084

Joined Sep 24, 2015
5,966
Not only is light perception non-linear, so is audio. They sell "Linear Taper" pots and "Audio Taper" pots. The audio taper pot is exponential or inverse of exponential, depending on how you hook it up.

#### wayneh

Joined Sep 9, 2010
17,152
The equation for an exponential curve is:
Brightness y = C•((exp^a•x) - 1)​
where C and a are constants and x is duty cycle.

Since brightness y is zero at x=0 and 100 at x=100, a is forced into being a function of C:
a = ln((100+C/C))/100.​
Changing the value of C gives a family of curves with different degrees of curvature, all passing through zero and 100. C=1 is highly curved while C=100 is nearly linear.

The inverse function gives x required for a given brightness.
x = 100 • ln(y/C + 1) ÷ ln(100/C + 1)​

Last edited:

#### AlbertHall

Joined Jun 4, 2014
11,306
Where is the control signal coming from - a pot, a micrcontroller, or... ?

#### MisterBill2

Joined Jan 23, 2018
8,725
We do not have any hint as to what type of light it is, and different kinds have different relations between drive and brightness.
And why does the relationship need to be uniform? In reality it is very seldom uniform.

#### Vindhyachal Takniki

Joined Nov 3, 2014
583
1. I am reading this site: https://jared.geek.nz/2013/feb/linear-led-pwm

It has below formula:

Attached is excel for it also/

2. But I think instead of 119 on line 2 in formula , it should be 116, otherwise at 100% input, I dont get value of 100.

#### Attachments

• 19.5 KB Views: 2

#### Ian0

Joined Aug 7, 2020
2,178
According to the relevant standard BS EN 62386-102, the brightness should vary logarithmically over 3 orders of magnitude, i.e. from 0.1% to 100%, so you need at least 10 bit resolution for the PWM.

#### wayneh

Joined Sep 9, 2010
17,152
Last edited:

#### Vindhyachal Takniki

Joined Nov 3, 2014
583
i tried values as in last post, led intensity seems bit linear, but not very good.

#### wayneh

Joined Sep 9, 2010
17,152
i tried values as in last post, led intensity seems bit linear, but not very good.
Linear but not good? I don't know what that means. Wasn't linear perceived light the goal?