A solar tracker is a mechanical device that automatically positions an item, such a solar panel, so that it faces the Sun’s rays in a way that will enhance the energy source’s supply. Heliostats are one sort of solar tracker. The goal of the prototype is to serve as a model for future work and to demonstrate how to build a basic solar tracker using readily accessible components from the market. The electronic parts that are utilized can support a tiny motor. It is also important to design a power circuit in order to support huge items.
The goal
The circuit is designed to offer a position to the object concerned as much as possible towards the sun. Since the relative position of the Sun changes due to the effect of the Earth’s rotation, a motion control system is required to position the object in front of the sun automatically. The circuit consists of some photoresistors and a servomotor. An ATmega328 manages the system logic. The MCU measures the voltage of six light sensors (through six analog input ports) and moves the motor to the correct position.
The Light Detector
The ATmega328 MCU has six ADC inputs, therefore the circuit includes six light sensors. As voltage dividers, they are represented by photoresistors coupled to six fixed resistors. The photoresistors’ values have to match. In accordance with the Sun’s angle, they must be situated and orientated with a total angular distance of 180 degrees, beginning in the East and finishing in the West. As seen in Figure 1, the required angular separation between each sensor is 36 degrees. The sensors’ “elevation” is determined by where the circuit is located on Earth (latitude).

The crucial thing is that the value of the fixed resistors in the divisor be the same, regardless of the value of the photoresistors. The sun’s light must be used to gauge the photoresistors’ value. The photoresistors are on the hot side of the divisor, as indicated in Figure 2, and the fixed resistor is linked to ground. The center node has the signal (output). Take a look at Figure 2 now. In this illustration, the Sun primarily shines on the fourth light sensor. If all the sensors have the same characteristics and all the resistors have the same value, the fourth divisor presents the highest voltage to the microcontroller. According to this fact, it will decide the position of the servo. The photoresistor here used has the following values:
- in the dark: 7M Ohm
- under an ambient light: 15k Ohm
- lit by the Sun: 400 Ohm
You can use, obviously, any photoresistor.

The servo
By connecting just one servo to a logical port of the MCU, exact angular motions may be accomplished in automation systems. For applications needing regulated rotation, this component is perfect. They may be added pretty much everywhere a 5V supply is present. Servo control is done through pulse pulses. It can operate at a 180° angle or less. It pulses at 0° for 1.5 milliseconds, 90° for 2 milliseconds, and -90° for 1 millisecond (as shown in Figure 3). The width of the high pulse determines the degree of angle of the servo motor. By appropriately choosing different values, between a minimum and a maximum, it is possible to orient the servo to any allowed direction. The servo can move a little solar panel or a small flower pot. To do this, you must build a structure able to contain these objects.

Electrical Schematic
The electric schematic (see Figure 4) is very simple. It consists of the ATMega328P MCU and its external oscillator. Six photoresistors and the relative fixed resistors implement the divisors of voltage. The value of resistors must be about the same value of the photoresistors lit by the Sun. The most enlightened divisor will give the highest voltage, and the firmware will know to follow the sun rotating the servo to a specified angle.

Its PCB
The process of making a PCB is trouble-free. Its measurements are 115 x 65 mm (Figure 5). Realizing it is really simple. Despite having numerous connections, the PCB only has one layer. The low current of the circuit is sufficient for the thickness of the tracks. It may be created with Press and Peel sheets, photo-etching, or transfer pencil.

Putting the parts in place
Figure 6 shows how to assemble the circuit. You need to place components with a low profile, such as ceramic capacitors and resistors. The largest components can then be put in position. The photoresistors do not all have the same angle, as you can see. Because the angular separation between each sensor must be 36 degrees (0°, 36°, 72°, 108°, 144°, 180°), they are rotated by 36 degrees.


List of the components
C1 = ceramic capacitor 22pF
C2 = ceramic capacitor 22pF
C3 = polyester capacitor 100nF
C4 = electrolytic capacitor 100uF
J1 = header for PCB 2 pin, 5mm
M1 =Servo SG90
PH1 = photoresistor 15k Ohm
PH2 = photoresistor 15k Ohm
PH3 = photoresistor 15k Ohm
PH4 = photoresistor 15k Ohm
PH5 = photoresistor 15k Ohm
PH6 = photoresistor 15k Ohm
R1 = resistor 390 Ohm
R2 = resistor 390 Ohm
R3 = resistor 390 Ohm
R4 = resistor 390 Ohm
R5 = resistor 390 Ohm
R6 = resistor 390 Ohm
U1 = ATMEGA328_PDIP28 MCU
Y1 = 16 MHz crystal
Firmware
The firmware is not critical and does not use any library for servo management. The impulses are generated by a rapid commutation of the digital port of the MCU. This commutation is performed by the UDF “servo()”, that accepts the length of the impulse, in microseconds, as a parameter. The function “setup()” configures the port 9 as digital output and it can be changed by the user. The function “loop()” is executed every second, and the program reads six analog inputs and store the results in six integer variables (S0, S1, S2, S3, S4, and S5). Then, six “if” conditions check for the sensor that gives more voltage. It is the photoresistor with the highest light from the Sun. These conditions rotate the servo motor, according to the position of the Sun. The programming of the MCU is very easy. You must type the sketch in the Arduino IDE, as shown in Figure 8. The parameters of the six angles (0°, 36°, 72°, 108°, 144°, 180°) are calculated by a linear curve, shown in Figure 9, with the following equation:
y(x) = 9.444444*x + 800
By this equation you can find any length of the impulse in microseconds, obtaining the desired angle.
Angle | Length of the impulse (uS) |
0° | 800 |
36° | 1140 |
72° | 1480 |
108° | 1820 |
144° | 2160 |
180° | 2500 |


Applications
Some practical and useful applications can be the following:
- to orientate a solar panel towards the Sun to get the maximum energy;
- to orientate a plant or flowers toward the Sun to capture the most light.
For big-size objects, it is possible to use a powerful servo with a power circuit. The sketch can be modified and changed, according to its own needs. If you don’t want to build the PCB, you can use Arduino Uno with a breadboard, on which you can mount the photoresistors and the resistors (see Figure 10). The Operating Temperature of ATmega328P is between -55° C and +125° C. Although this range is wide, it’s a good choice to place shadowed the MCU, especially in very warm countries.

Conclusions
This project is quite standardized. Users can modify it to suit their needs. Solar energy should always be used since it is pure, cost-free, and abundant. In order to avoid paying an electrical bill, the energy needed to power the circuit should also come from a battery that has been charged by a solar panel.