Summary of Arduino Solar Tracker
This project is an Arduino-based solar tracker that uses four Light Dependent Resistors (LDRs) to detect the brightest light source, such as the sun. By comparing light levels across the sensors, the system adjusts two servos to orient a platform toward maximum illumination, ensuring optimal energy capture through automated alignment.
Parts used in the Solar Tracker:
- 2 x servo's
- 4 x lightdepending resistors (ldr)
- 4 x resistors 10K
- 1 x Arduino
- 2 x potentiometers 10k
What is does:
It searches for the brightest light source like the sun.
Step 1: How it works
How it works:
I’d made a sensor of 4 LDRs with sheets between them
The withe stips are the LDRs
When the stick on top is righted to the sun or the brightest point
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
- 2 x servo’s
- 4 x lightdepending resistors (ldr)
- 4 x resistors 10K
- 1 x Arduino
- 2 x potentiometers 10k (value doesn’t matter)
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
#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
void setup()
{
Serial.begin(9600);
// servo connections
// name.attacht(pin);
horizontal.attach(9);
vertical.attach(10);
}
void loop()
{
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 rig
- 2 x servo’s
- 1 x Arduino
For more detail: Arduino Solar Tracker
- How does the sensor detect the brightest light?
The sensor works by using four LDRs where the top stick aligns so all four receive equal light when facing the sun. - What happens when light comes from the left?
When light is on the left, the right-top, right-down, and left-down sensors fall into shadow while the left-top gets the most light. - Can I change the value of the potentiometers?
The article states that the value of the two 10k potentiometers does not matter for this setup. - How are the LDRs connected in the code?
The code connects LDR top left to pin 0, top right to pin 1, down left to pin 2, and down right to pin 3. - Which pins do the servos attach to?
The horizontal servo attaches to pin 9 and the vertical servo attaches to pin 10. - Does the project use hot glue for assembly?
Yes, the setup instructions state to just hot glue the components together. - What library is included in the code?
The code includes the Servo.h library to control the motors. - How is the difference between up and down calculated?
The code calculates the difference by subtracting the average down value from the average top value.
