Light Sensor (LDR)
Settle on the brightest spot
The sun is moving across the sky and the rover’s battery is almost empty. Turn the panel toward the sun and charge the battery before time runs out. Compare the light sensors on the two ends of the panel: whichever gets more light, the sun is on that side. Now and then clouds block the light.
An LDR (photoresistor) is a part whose resistance changes with the amount of light falling on it. Street lights turn on by themselves in the evening, phone screens adjust their brightness to the room, and sun-tracking solar panels find the light source with LDRs.
Solar panels on Mars rovers use arrays of light sensors to find the angle with the most light during dust storms.
If the two sensors show about the same value, the panel is facing the sun straight on. When a cloud passes, both values drop but the difference stays the same; keep turning the panel.