Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Varun Chandrashekhar
Published © GPL3+

Solar Tracker

This device uses 2 servos to allow for co-axial adjustment of solar panels. This allows for the most efficient light capture method

IntermediateShowcase (no instructions)2,686
Solar Tracker

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Solar Panel, 2.5 W
Solar Panel, 2.5 W
×1
LDR, 5 Mohm
LDR, 5 Mohm
×4
Resistor 10k ohm
Resistor 10k ohm
×1
Arduino Mega 2560
Arduino Mega 2560
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Wire, Wrapping Wire
Wire, Wrapping Wire
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Soldering iron (generic)
Soldering iron (generic)
Wire Wrap Tool, Pencil
Wire Wrap Tool, Pencil

Story

Read more

Custom parts and enclosures

Solar Tracker 3D Files

If you have trouble accessing this file, feel free to contact me.

Schematics

Schematic of Solar Tracker

Breadboard View of Solar Tracker

Code

Solar Tracker Code

Arduino
//*Will Put My Code later - Arduino Web Editor is Down*

// Here is Great Scott's code for the Solar Tracker
// He does a great job building his solar tracker and was my inspiration for this project

int topleft;
int topright;
int downleft;
int downright;
int waittime = 1;

void setup() {
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  TCCR1A = 0;
  TCCR1A = (1 << COM1A1) | (1 << COM1B1) | (1 << WGM11);
  TCCR1B = 0;
  TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11);
  ICR1 = 40000;
  OCR1A = 3000;
  OCR1B = 3600;
}

void loop() {
  topleft = analogRead(A0);
  topright = analogRead(A1);
  downleft = analogRead(A2);
  downright = analogRead(A3);

  if (topleft > topright) {
    OCR1A = OCR1A + 1;
    delay(waittime);
  }
  if (downleft > downright) {
    OCR1A = OCR1A + 1;
    delay(waittime);
  }
  if (topleft < topright) {
    OCR1A = OCR1A - 1;
    delay(waittime);
  }
  if (downleft < downright) {
    OCR1A = OCR1A - 1;
    delay(waittime);
  }
  if (OCR1A > 4000) {
    OCR1A = 4000;
  }
  if (OCR1A < 2000) {
    OCR1A = 2000;
  }
  if (topleft > downleft) {
    OCR1B = OCR1B - 1;
    delay(waittime);
  }
  if (topright > downright) {
    OCR1B = OCR1B - 1;
    delay(waittime);
  }
  if (topleft < downleft) {
    OCR1B = OCR1B + 1;
    delay(waittime);
  }
  if (topright < downright) {
    OCR1B = OCR1B + 1;
    delay(waittime);
  }
  if (OCR1B > 4200) {
    OCR1B = 4200;
  }
  if (OCR1B < 3000) {
    OCR1B = 3000;
  }
}

Credits

Varun Chandrashekhar

Varun Chandrashekhar

9 projects • 27 followers
I'm passionate about ML, Data Science, and Electronics, and have conducted research building several devices to address societal issues.

Comments