# 4 LDR Solar tracker - Uneven reading when exposed to even light

Hello:

I am building a 2 axis solar tracker. In order to measure light intensity I am using 4 LDRs (up, down, left, right). Light sensing part is built on an independent stripboard (my future intention is placing this part on the front of the panel and Arduino on the back to protect it from direct sun exposure).

Program and circuitry seem to be working well, but when I point to an even light source, readings from the 4 LDRs are not the same. To be sure that light is even on the 4 LDR, I surround sensing piece with white cardboard and then I use a white area on my LCD monitor as light source.

On my code, I take several measures from each LDR and average them, to remove noisy readings. Unfortunately, readings keep being different.

``````4 LDRs (2-axis)
``````

``````Light readings. Notice cardboard to avoid other light reaching LDRs. On the screen, the number of "U,D,L,R" is proportional to light reading (kind of bar graph). Number at the end of line is analog reading (0-1023).
``````

``````Complete setup
``````

Has anyone experience designing this kind of solar tracker?
Can the problem be originated by the components themselves?
How can be this problem worked out in order to have a precise sun tracking?

Components, in data sheet for LDR what I have, distribution area on log scale covering 50 - 300 (left side fig.3), it's about 600%. You can easily trim sensitivity in software, setting different thresholds. Or, make the separator planes longer, to increase angular resolution

PHOTOCELL10-14.pdf (260 KB)

I have tried a correction. By means of a pushbutton you can tell the arduino to calibrate LDRs. You must be pointing to an even light (such as the white LCD area).

``````    int average = (ldrU + ldrD + ldrL + ldrR) / 4;
coefUp = (float)(average) / (float)(ldrU);
coefDown = (float)(average) / (float)(ldrD);
coefLeft = (float)(average) / (float)(ldrL);
coefRight = (float)(average) / (float)(ldrR);
``````

And then, measures are corrected by that factor:

``````  ldrU   *= coefUp;
ldrD   *= coefDown;
ldrL   *= coefLeft;
ldrR   *= coefRight;
``````

The problem is that this coefficients level measurings at one light level, but if afterwards I measure another even light weaker o brighter, readings are not leveled.

Can anybody suggest another correction method more advanced?

Are you sure that you need high precision? LDR isn't desigh to be accurate, you may approximate each of the sensor individually using higher degree polynomial, let say now you have half of one (first degree should be a * x + b, where b is offset and "a" is slope). I have a project where I used 2-nd degree approximation, all coeff. calculated by arduino, all you have to do is set 10 pre-defined levels (in your case brightness, in my frequencies) .
Have a look, least squares method:
As you probably, don't have calibrated lux meter, I'm not sure if would work right with your monitor brightness percentage scale, which is quite approximate itself AFAIK. Secondly, check how LDR affected by temperature variation.

Photodiodes , may be better choice , easier to get accurate results.

You are using a multiplication factor on what I assume is the direct ADC reading (0 - 1023). This is proportional to the way you have configured your voltage divider. An alternative correction would be to assume the sensitivities of the different LDR's are the same, but there are constant factor offsets between the different LDR resistance values. This method is a bit more involved since it requires you to convert the ADC reading into the corresponding LDR resistance. If I assume you have configured your voltage divider as follows: Vcc - LDR - measuring point - fixed resistor - ground then your ADC reading would be related to the LDR resistance as follows:

It then follows that a fixed percentage offset of the LDR resistance would lead to a non-constant percentage change in the ADC reading. To assign a constant calibration factor to the LDRs you have to convert the ADC reading back to a resistance, then apply a correction factor, e.g.: