Project showcase
Sun-Tracking Mechanism for 40W solar panel

Sun-Tracking Mechanism for 40W solar panel © GPL3+

Trackers generate more electricity than their stationary counterparts due to increased direct exposure to solar rays.

  • 2,984 views
  • 4 comments
  • 24 respects

Components and supplies

Necessary tools and machines

Apps and online services

Ide web
Arduino IDE
Autodesk TinkerCad Project Ignite
early stage mechanical design and code simulation done on this online platform.

About this project

The idea started many years ago at work when we wanted to build a pin-hole camera to capture the image of the sun spots. So I built a little primitive contraption that was controlled by a PIC to point at the sun as it moves across the sky. My interest slowly shifted to solar energy and how to best capture the short hours of sunshine on a small panel since i don't have a large foot print to install an array of panels. At the same time, the project is helping me save on some electricity bill to light up the apartment.

Code

Dual_Axis_Sun_Tracking_with_DC_Motors.inoArduino
This might not be the most effective code, but it's giving me the result and flexibility that I need. Comments included in the code to guide wiring of the various components. Speed of motor can also be adjusted by varying the value of AnalogWrite.
// define pin numbers:
#define redbutton 12
#define greenbutton 13
#define IN1 6
#define IN2 9
#define IN3 10
#define IN4 11
#define ldrEast 7
#define ldrWest 8
#define ldrUp 4
#define ldrDown 5

int ldrEastState = 0; //variable for reading east LDR status
int ldrWestState = 0; //variable for reading west LDR status
int ldrUpState = 0; //variable for reading Up LDR status
int ldrDownState = 0; //variable for reading Down LDR status

void setup() {
  
pinMode(IN1, OUTPUT);//make two output pins
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);//make two output pins
pinMode(IN4, OUTPUT);
pinMode(ldrEast, INPUT); //make LDR input pin
pinMode(ldrWest, INPUT); //make LDR input pin
pinMode(ldrUp, INPUT); //make LDR input pin
pinMode(ldrDown, INPUT); //make LDR input pin
pinMode(redbutton, INPUT); //make red button input pin
digitalWrite (redbutton, HIGH);
pinMode(greenbutton, INPUT); //make green button input pin
digitalWrite (greenbutton, HIGH);

}

void loop() {
  //check east-west orientation first
ldrEastState = digitalRead(ldrEast); //read east ldr
ldrWestState = digitalRead(ldrWest); //read west ldr
digitalWrite(IN1,LOW); //set signal to motor driver board to low
digitalWrite(IN2,LOW); //set signal to motor driver board to low
digitalWrite(IN3,LOW); //set signal to motor driver board to low
digitalWrite(IN4,LOW); //set signal to motor driver board to low

//manual overwrite to orientate panel to west
if (digitalRead (greenbutton) == LOW) {
  analogWrite (IN2,150); //turn motor CCW to go towards west
} else {
  digitalWrite (IN2,LOW);
  }

//manual overwrite to orientate panel to east
if (digitalRead (redbutton) == LOW) {
  analogWrite (IN1, 150); //turn motor CW to go towards east
} else {
   digitalWrite (IN1, LOW);
  }

if (ldrWestState == HIGH) {
  if (ldrEastState == LOW) {
    analogWrite (IN2,150); //turn motor CCW to go towards west
  } else {
    }
} 

if (ldrWestState == LOW) {
  if (ldrEastState == HIGH) {
    analogWrite (IN1, 150); //turn motor CW to go towards east
  } else {
    }
}
delay (500); //wait 0.5 second


//check up-down orientation after eas-west orientation has been adjusted
ldrUpState = digitalRead(ldrUp); //read up ldr
ldrDownState = digitalRead(ldrDown); //read down ldr
digitalWrite(IN1,LOW); //set signal to motor driver board to low
digitalWrite(IN2,LOW); //set signal to motor driver board to low
digitalWrite(IN3,LOW); //set signal to motor driver board to low
digitalWrite(IN4,LOW); //set signal to motor driver board to low

if (ldrUpState == HIGH) {
  if (ldrDownState == LOW) {
    analogWrite (IN3,150); //ON tilt motor to rotate up
  } else {
    }
} 

if (ldrUpState == LOW) {
  if (ldrDownState == HIGH) {
    analogWrite (IN4, 150); //ON tilt motor to rotate down
  } else {
    }
}
delay (500); //wait 0.5 second

}

Custom parts and enclosures

Schematic Design
rough concept
Sun tracker mechanism 3x9h52lrah

Schematics

Wiring Schematic
Schematics j310blg7u4

Comments

Author

Limpinglim
LIMPINGLIM
  • 5 projects
  • 12 followers

Additional contributors

  • A very comprehensive tutorial on controlling dc motor with the ln298 driver board. by Rudy Schlaf

Published on

February 2, 2018

Members who respect this project

ThejesterBiopic olika0hz2oDefaultDefault1798865 221548598035609 1663391656 nDefaultLogo white   smallest zoofch0xx412140659 760034697475393 76920913417940772 n

and 16 others

See similar projects
you might like

Similar projects you might like

Servo-Controlled, Light-Tracking Solar Panel Platform

Project tutorial by scott mangiacotti

  • 12,447 views
  • 10 comments
  • 41 respects

Dual Axis Solar Tracker Panel with Auto and Manual Mode

Project tutorial by Giannis Arvanitakis

  • 7,153 views
  • 6 comments
  • 35 respects

Light Intensity and Solar Panel Energy Detector

Project tutorial by Kutluhan Aktar

  • 1,740 views
  • 4 comments
  • 11 respects

Solar Panel Sun Tracker - Phone Charger

Project tutorial by FIELDING

  • 27,297 views
  • 11 comments
  • 118 respects

Integrated Solar ChargeController, Inverter, PowerBank, Lamp

Project tutorial by Shahariar

  • 7,733 views
  • 16 comments
  • 30 respects

Servo Control Panel

Project tutorial by dancili

  • 1,202 views
  • 0 comments
  • 6 respects
Add projectSign up / Login