Introduction: Arduino Solar Tracker
What is does:
It searches for the brightest light source like the sun.
There is a newer and better version of this project: https://www.instructables.com/id/Dual-Axis-300W-IOT-Solar-Tracker/
Step 1: How It Works
I'd made a sensor of 4 LDRs with sheets between them
The white dots are the LDRs
the four LDRs get the same amount of light on them.
Example1 when the light is left on top:
right-top, right-down, left-down are in the shadow
and left-top get the most light
Example2 when the light is on top
left and right down are in the shadow and top is in the light
Step 2: Parts List
Step 3: The Set-up
Just hot glue it together!!!
Step 4: The Circuitry
Step 5: The Code
you can download the code down this page
/* this code is written by geobruce
for more info check my site http://xprobe.net
#include <Servo.h> // include Servo library
Servo horizontal; // horizontal servo
int servoh = 90; // stand horizontal servo
Servo vertical; // vertical servo
int servov = 90; // stand vertical servo
// LDR pin connections
// name = analogpin;
int ldrlt = 0; //LDR top left
int ldrrt = 1; //LDR top rigt
int ldrld = 2; //LDR down left
int ldrrd = 3; //ldr down rigt
// servo connections
int lt = analogRead(ldrlt); // top left
int rt = analogRead(ldrrt); // top right
int ld = analogRead(ldrld); // down left
int rd = analogRead(ldrrd); // down rigt
int dtime = analogRead(4)/20; // read potentiometers
int tol = analogRead(5)/4;
int avt = (lt + rt) / 2; // average value top
int avd = (ld + rd) / 2; // average value down
int avl = (lt + ld) / 2; // average value left
int avr = (rt + rd) / 2; // average value right
int dvert = avt - avd; // check the diffirence of up and down
int dhoriz = avl - avr;// check the diffirence og left and rigt
if (-1*tol > dvert || dvert > tol) // check if the diffirence is in the tolerance else change vertical angle
if (avt > avd)
servov = ++servov;
if (servov > 180)
servov = 180;
else if (avt < avd)
if (servov < 0)
servov = 0;
if (-1*tol > dhoriz || dhoriz > tol) // check if the diffirence is in the tolerance else change horizontal angle
if (avl > avr)
servoh = --servoh;
if (servoh < 0)
servoh = 0;
else if (avl < avr)
servoh = ++servoh;
if (servoh > 180)
servoh = 180;
else if (avl == avr)
Runner Up in the
Celestron Space Challenge
17 People Made This Project!
AymanH21 made it!
lad_deep made it!
BrownDogGadgets made it!
YeganeA made it!
azowlclub made it!
Spellmal made it!
jusio made it!
נדבא made it!
amaze_san made it!
SoumyakantiR made it!
hbulushios made it!
yacinehooo made it!
tatoo23 made it!
Akin Yildiz made it!
Geo Rambe made it!
tatoo23 made it!
AlexeyB19 made it!
See 8 more that made it
We have a be nice policy.
Please be positive and constructive.
hi.thanks for this amazing tutorial.i was wondering what program do u use to make the picture in step4???
the one of the circuit and the components.
If the sun go downunder into the west wat wll happen the next day if the sun comes up into the east ?
Is it possible to set after sun down (LDR's get no light) the panel turn in 45h/90v degrees, so the next day the solartracker can track to the first (sun) light ?
I'm curious to know if this Arduino has the same capability as the Uno when it comes to control systems. Do you need to have the Uno hooked up to a laptop?
Dear Bruce plz advice me how to adjust the speed and tolerance values also please send me the code my email is email@example.com
Dear sir is it required to calibrate the servo motor if so please instruct me how to calibrate it
Hi there! I am doing this project and after following all the steps it keeps moving and shaking in different directions. Anyone any idea why?