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.
- Arduino UNO
- Two 10K ohm resistors
- sg90 sevo motor
- Two LDRs (Light Dependent Resistors)
- Jumper wires
- Arduino IDE Software
- USB ASP Cable (For uploading the program in arduino)
- Solar panel or any rectangular piece for mounting
- Connect the orange wire of servo motor to pin number 13 of arduino.
- 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.
- 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.
- Attach two LDRs on both sides of the solar panel. Attach 1 resistor each to both LDRs.
- Now connect each LDR to ground of the breadboard in row 1 and to +5v of the breadboard to row 4.
- Also connect LDR1 to A0 pin and LDR2 to A1 pin of arduino.
- Attach a propellor to servo motor and mount the solar panel.
int eastLDRPin = 0;
int westLDRPin = 1;
int eastLDR = 0;
int westLDR = 0;
int error = 0;
int calibration = 204;
int trackerPos = 90;
eastLDR = calibration + analogRead(eastLDRPin);
westLDR = analogRead(westLDRPin);
if(eastLDR<350 && westLDR<350)
} error = eastLDR – westLDR;
Hope you make it.