Solar tracker using photodiode: circuit design
A simple way to do this is with differential measurement:



R1 and R2 are two LDRs (light dependent resistors).  A light baffle causes the light on them to be equal when the unit is pointed at the sun.  When off to one side, one LDR gets more light and the other less.  The voltage between them is then a measure of centerdness, with the middle value being centered.  The A/D in the microcontroller reads this value and drives the motors appropriately.

You need one pair of LDRs for each axis.

For extra credit, figure out how to do this with just 3 LDRs.  This is possible if you can drive nodes high, low, or measure their voltage only the fly.  Fortunately, that is easy to do with a microcontroller.

Added about LDR variations

It was pointed out in a comment that two LDRs will not have exactly the same resistance at the same light level.  This means that the voltage won't be exactly the center value when the unit is pointed directly at the sun, which should make the resistances equal.

This doesn't matter much to most applications because:

The light baffle system is set up so that the maximum change in brightness on a LDR as a function of angle is when pointed directly at the sun.  Imagine each LDR half in shadow and half in sunlight, for example.  Only a small angular change will shift this to all shadow or all sunlight.  Even a few 10s of percent mismatch in the resistance will be swamped by only a small angular change from directly aligned.  At any other angle, you don't care.  You just need to know which side of correctly aimed the system is.

The unit can be calibrated to the voltage actually measured when directly pointed at the sun.  This becomes the center reference for the algorithm.

If the two sensors have different non-linearities, not just overall scale, then the center value is a function of brightness.  In that case, calibrate at full sun, since that's when you care most.  Put another way, it's not so important to point directly at the sun when it's behind clouds anyway.

If the purpose is to keep something like a solar panel pointed at the sun, note that small deviations from exactly aligned cause very little change in the power hitting the panel.  The power due to misalignment falls off with the cosine of the error angle.  That is basically 1 for reasonable error angles anyway.

For example, it takes a 8&deg; aiming error to drop just 1% in power hitting a flat surface.  5&deg; error results in only 0.4% drop.