manodeep
Published © CC BY-NC-ND

DIY solar tracker

This system can track the sun all day long, can be used for harvesting 15% more energy than typical static Solar Plates.

IntermediateFull instructions provided969
DIY solar tracker

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Resistor 1k ohm
Resistor 1k ohm
×4
LDR, 5 Mohm
LDR, 5 Mohm
×4

Software apps and online services

Visual Studio 2015
Microsoft Visual Studio 2015

Hand tools and fabrication machines

Breadboard, 400 Pin
Breadboard, 400 Pin
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit diagram

Code

Code for solar tracker

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

void setup() {
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(6,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() {
  digitalWrite(6,HIGH);
  delay(30);       
  digitalWrite(6,LOW);
  delay(1000);
  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

manodeep

manodeep

0 projects • 0 followers

Comments