Single Axis Solar Tracker using Arduino

A solar panel which tracks the sunlight

Hello friends,

Today we are going to make a solar tracker which tracks the sunlight in its direction using arduino. Before starting, I will tell you about how to use breadboard for ground and +5v. Carefully notice, the breadboard has four rows with many holes in it. The first and the last rows are used for defining the ground and +5v. It has a group of 10 holes.

Materials Required

  1. Arduino UNO
  2. Two 10K ohm resistors
  3. sg90 sevo motor
  4. Two LDRs (Light Dependent Resistors)
  5. Jumper wires
  6. Breadboard
  7. Arduino IDE Software
  8. USB ASP Cable (For uploading the program in arduino)
  9. Solar panel or any rectangular piece for mounting


  1. Connect the orange wire of servo motor to pin number 13 of arduino.
  2. Connect the brown/black wire of servo motor to first row of breadboard in first hole of row 1 of the breadboard. The row 1 is the row for all the grounds.
  3. Connect the red wire of servo motor to fourth row of breadboard in first hole of row 4 of the breadboard. The row 4 is the row for all the +5v.
  4. Attach two LDRs on both sides of the solar panel. Attach 1 resistor each to both LDRs.
  5. Now connect each LDR to ground of the breadboard in row 1 and to +5v of the breadboard to row 4.
  6. Also connect LDR1 to A0 pin and LDR2 to A1 pin of arduino.
  7. Attach a propellor to servo motor and mount the solar panel.

Circuit Diagram


#include <Servo.h>

Servo tracker;

int eastLDRPin = 0;

int westLDRPin = 1;

int eastLDR = 0;

int westLDR = 0;

int error = 0;

int calibration = 204;

int trackerPos = 90;

void setup()




void loop()


eastLDR = calibration + analogRead(eastLDRPin);

westLDR = analogRead(westLDRPin);

if(eastLDR<350 && westLDR<350)



{      trackerPos++;




}  error = eastLDR – westLDR;









else if(error<-15)










Thank You

Hope you make it.

What do you think?

0 points
Upvote Downvote

Written by Sanidhya Goel

I am a student currently studying in class 12. I have the knowledge of almost all sensors and arduino microcontrollers. I have  interest in arduino based projects. I will post a number of  projects on this website. For any enquiries, contact me at:-


Instagram: war_syndrome_2003

If you want to learn robotics, view my ad at


Colour Sorting Machine Project

Water level detector using ultrasonic Sensor