Skip to main content

Chapter 14 Photosensors and the Solar Tracker

The goal of this chapter is to build a solar tracker: a servomotor that turns an arm carrying two light sensors until the arm points at a light source, and that keeps following the source as it moves. The sensor is a photocell, a resistor whose resistance falls as more light falls on it. The ADC (analog-to-digital converter) measures voltages and not resistances, so the first job is an interface: a voltage divider that turns the photocell’s resistance into a voltage on an ADC pin. With two photocells on the servo’s arm, one on each side, the difference between their two voltages depends on which side the light is on, and a program we write turns that difference into a change in the servo’s command pulse. That program is a feedback loop. The servo has its own feedback loop inside it, and the tracker closes a second loop around the servo.
This chapter covers one class day. Before class, the reading introduces the photocell, the family of sensors that work the same way, the divider, the photocell’s datasheet, and what a solar tracker is. In class we’ll predict which way the divider’s voltage moves as the light changes, work through the photocell study from Lab 8, mount the photocells on the arm, discuss how the tracker’s feedback loop can be implemented, and start on the loop. Lab 8 is where you tune and demonstrate it. Section 14.3 collects the divider formula, the two-channel ADC read and the loop’s update rule for looking up later.