As the circuit is using a Arduino Uno you can connect all the components to the Arduino using jumper wires. You need to connect the signal wire of the servo motor to pin 9 and then connect the four LDRs to A0 and A1. I have included the wiring diagram.

Once all the components are connected together you will need to upload the code to the Arduino. To do this connect the Arduino to the computer using a USB cable and open the Arduino IDE. Copy in my code and upload it to the Arduino.

#include <Servo.h>  //include the servo libraryi 
Servo servo; 
int diff = 0;
int servoPosition = 90;
int LDRr = 0;  //attach LDR1 to pin A0
int LDRl = 1;  //attach LDR2 to pin A1
int rLDR = 0;   
int lLDR = 0;
int offset =200
void setup() 
 servo.attach(9);  //attach servo to pin 9
void loop() {
 rLDR = offset + analogRead(LDRr);    
 lLDR = analogRead(LDRl);
 diff = rLDR - lLDR;  
 if(diff>15)  //If the diffrence is above 15 turn to the right 
     servo.write(servoPosition);  //Move the servo to 10 degrees  
 else if(diff<-15)  //If the diffrence is above 15 turn to the right
     servo.write(solarPosition);  //Move the servo to 10 degrees

After the circuit is built and programmed test to see if it operated as expected the servo should rotate in the direction of most light. If the circuit does not work check your connections.

Now that you have the circuit working you can make an enclosure for it. You could do this many ways but I chose to 3D print the enclosure. The enclosure just needs to have a position to mount the two LDRs one on the right side and the other on the left side. Also the servo needs to be mounted upright so the  solar panel can be connected to it.

All you need to do now is mount the LDRs into the enclosure using hot glue and also hot glue the solar panel you want to use onto the mount for the servo. Now just connect the Arduino to a power source and place the solar tracker in a sunny location and the solar panel will turn to the direction with the most sunlight.


I thank LCSC Electronics for the partnership.

LCSC Electronics Is China's leading Electronic Components Distributor. LCSC sells a wide variety of high quality electronic components at low prices. With over 150, 000 parts in stock they should have the components you need for your next project. Sign up today and get $8 off on your first order


Check out more of my other projects on my website.