LDR -> Linearize values

Hello everybody,

I use an LDR to measure the brightness in the room.

The LDR and voltage divider are finished and give me good values ​​between 0 and 4095 (relatively dark and very bright).
The values ​​are known to be non-linear. I do not need a perfect solution but a reasonably linear course of values.

I would like linear values ​​of e.g. 0% -100% is enough to cover the sensor range. Does anyone know about the calculation (i currently dont have test values ​​here)?

could this article help?


"Hardware Required: Commercial lux meter (for characterizing your LDR)"

i dont have... :confused:

Could you maybe extemporise using a camera's light meter?

You could use a look up table.


I have already tested with log10 but was not completely satisfied.

In the article, which J-M-L has linked, but also worked with log10 to get good relatively linear values.

I will try log10 again, using a smartphone app to get lux comparisons.

When using a LDR with a single resistor, the range is limited anyway. I suggest to just give it a linear percentage and work with that. They are so inaccurate, it is not worth spending more time with it. The human eye also has a log scale for brightness.

Do you know that you can not put them in direct sunlight ? And if they get too hot in the sun, they get damaged ?

To extend the range, you can put the LDR at the lower side (GND) and power it with two digital pins. One pin with 1k and one pin with 100k. Power it first with one pin, and then with the other and combine the results. You will get much better values for darkness. They are slow in darkness, so you need to add some delays.

For the amount of lux, you can use the cheap BH1750. It can measure 1 lux to 65k lux and it is 20% accurate. It is possible to extend its range from 0.11 lux to 120k lux.

For linear intensity measurements over a very large range, use a luminosity sensor like this one.

Keep in mind that the eye has a nonlinear, logarithmic response to intensity.