DIY Solar Tracker

About This Project
Learn how to make a light tracker of your own that always points in the direction of the light falling on it.
Project Info
Estimated Time Required: 3 Hrs
Programming Platform:


A light tracker tracks the direction of the incoming light. It can be used along with solar panels which are programmed to move in the direction of the sun to receive the maximum amount of incident light. Solar trackers are built on the same principle to capture maximum sunlight.

In this project, we will be building a light tracker using light dependent resistors to detect the direction of incoming light from the torch of your Smartphone and two servo motors to align in that direction.
Ready. Set. Go!

Components Required

ImageComponentQuantityAvailable in Kit
Micro Servo Motor with Accessories2
Acrylic Part: Base Plate1
Acrylic Part: Base Servo Holder2
Acrylic Part: Servo Mounting Plate1
Acrylic Part: Light Tracking Plate 11
Acrylic Part: Light Tracking Plate 21
30mm M3 (Female to Female)4
M3 bolts of 8 mm Length4
M2 bolts of 12mm Length6
M2 Nut6
Thick Cardboard1
  • None

Building Guide

Step 1: Assembly

The assembled robot is shown in the following figure:Light Following Robot

  • Attach 30 mm standoffs to the chassis at the positions shown. Fasten using M3 bolts of 8mm length.
  • Insert a servo motor in the base servo holder and fasten it to the holder using M2 bolts of 12mm length and M2 nuts.
  • Fasten the motor holder at the top of standoffs using M3 bolts of 8mm length. Inserting Servo 2
  • Our light tracker requires two servos, one for rotation about each axis. This is one of the two. Also, to produce combined rotation, both the motors should be connected. Insert the second motor in the servo motor holder. The same assembly shall carry the micro horn which fits into the first motor. Fasten the horn to the servo motor holder using self-threading M2 screws, as shown in the corresponding image.attaching Servo Horn
  • Fix the motor holder to the base through the rectangular slots available.Servo Holder1 Servo Holder2
  • Insert the second servo in the slot on the holder and fasten using M2 bolts and nuts.Inserting Servo1 Inserting Servo2

We have assembled the individual motors. Now, we will assemble our 4 LDR sensors which will detect incoming light from the four directions.

  • Arrange the light tracker plates 1 and 2 provided with the kit as shown in the image below.Light tracker Palatte
  • You can see how the surface has been divided into 4 sections. One LDR will be inserted in each hole. This, along with the LDRs will be attached to the servo. Through the combined rotations of the 2 servos, this assembly will be able to receive light from all possible directions. Fasten a servo horn to it using M2 screws, as shown.Fiiting Servo Horn
  • Make a sunflower-shaped cutout using a hard paper as shown below and paint it with your favorite color. You need to make a + shaped cut at the center and four small holes in each section of the cutout. Then place it on the top of the light tracker plate assembly by matching the slots, as shown. Completing Flower Assembly2
  • Insert LDRs (light dependent resistors) into the holes made.Inserting LDR1 Inserting LDR2
  • There is a free horn on our sunflower like assembly. We will lock our second servo motor to the horn through the screw provided with servo accessories. Using evive controls menu, set the servo angle to about 90°. Attaching Servo to the flower2Attaching Servo to the flower1
  • There is a free horn at the bottom of this assembly which we will connect to the remaining servo. Now you can see how each servo’s individual rotation will provide an all-around rotation of the sunflower-like structure on top hence ensuring that it is able to detect the light falling on different sections.Final Assembly

Step 2: Add-Ons

Here, the most popular use of the Sun Tracker is when we attach Solar Panel. In Solar Panel, if the Photoresistors are, then the solar panel will then check which part of it is receiving more light. Thus, adjusting the position accordingly. Which results in increased efficiency.

We have then placed this Sun Tracker in our home.Sun Tracker

Step 3: Circuitry of the Robot

Connect the LDRs and 10 kOhm resistors directly to the breadboard. Make the remaining connections using jumper
wires. Refer to the circuit diagram for ensuring proper connections.Light Tracker Diagram

Step 4: Logic

From the assembly, you can observe that the four LDRs are separated by the wall. Each LDR will detect light falling on its section. We will number each LDR for reference. If both the servos are at the 90-degree position, then the sunflower will be facing upward as shown in step 12 of assembly. The top left LDR will be named LDR1. Similarly, we will name LDR2 (top-right), LDR3 (bottom-left) and LDR3 (bottom-right).Arrangement of LDRs

  • Upper Region – LDR 1 and LDR 2
  • Lower Region – LDR 3 and LDR 4
  • Left Region – LDR 1 and LDR 4
  • Right Region – LDR 2 and LDR 3

We will also name the two servos – Vertical (servo on the base) and Horizontal (servo on the top).

Using the horizontal servo, we will reduce the difference in the light falling on the upper region and lower region to zero. If the light is coming from the upper region, then the upper region LDRs will have higher reading as compared to the lower region. Hence we have to rotate the horizontal servo motor forward incrementally.

If the lower region has higher value, then we will move the sunflower backward incrementally.

To move the sunflower sideways, we will use the vertical servo. Whenever there is a difference in the values of the left region and the right region, it will move to reduce it to zero. If the light is more on the left region as compared to the right region, we will decrease the servo angle by 5° each time until the difference is zero. If the light is more on the right region as compared to the left region, we will increase the servo angle by 5° each time until the difference is zero.


To decide the direction in which the servos should move, we will consider the total amount of light received on a region, i.e. the sum of readings at LDR analog pins.

Step 5: Scratch Script

The code is written in two halves, one for each motor. Initially, both are set at an angular position of 90 degrees as shown in the main script. CalibrateVerticalServo and CalibrateHorizontalServo are two blocks defined to track light.
Create variables LDR1_Value, LDR2_ Value, LDR3_Value and LDR4_Value to store the analog value of the LDRs connected to analog pin A0, A1, A2 and A3 respectively.

Create variables, HorizontalServo and VerticalServo to store servo angle. Also, create variables Average1 and  Average2 to store the average LDR value of the upper region and lower region.

For CalibrateHorizontalServo block, Average1 represents the average light falling on the upper region while Average2 represents the average light falling on the lower region. Depending on which region receives more light,
we slowly change the variable HorizontalServo. Observe that we only check the magnitude of difference in the
variables using the abs block.

The physical angle will only change whenwe use the set servo pin angle block to set the angle equal to the variable HorizontalServo.


Now the entire script is ready. Upload it to evive as done in the previous chapters. To check if the light tracker is working or not, turn on the flashlight of any smartphone and move it over the robot. It should start following the light.Calibrate Vertical Servo Calibrate Horizontal Servo

Step 6: Conclusion

With this, your very own solar tracker is ready! Now watch as it follows you and your Smartphone’s light wherever you go!

Circuit Diagram

DescriptionCircuit Diagram

Connect the LDRs and 10 kOhm resistors directly to the breadboard. Make the remaining connections using jumper wires. Refer to the circuit diagram for ensuring proper connections.


DescriptionDownload Code
Code for Light Tracking RobotDownload
evive libraryDownload
Share this Project
Related Projects
Featured Projects

DIY Unique Christmas Tree

This project will show you how to make a unique DIY Christmas Tree for this year’s Christmas.

All articles loaded
No more articles to load

Leave a Reply

Close Menu


ATV Tank Small

Subscribe toour newsletter!

We publish new projects every Tuesday & Friday.
Be the first one to get notified.