10 August, 2018

SOLAR TRACKING

SOLAR TRACKING


a mini project for EEE students :

              Solar energy is rapidly advancing as an important means of renewable energy source.Solar tracking enables more solar energy to be generated because the solar panel is able to maintain a perpendicular profile to the sun rays.Through initial cost of setting of a solar tracking system is high,this paper proposes a cheaper solution . Design and construction of prototype for solar tracking system with single degree of freedom,which detects sunlight using light dependent resistors (LDR) , is discussed.

Here is the code :


#include<Servo.h>

Servo myservo;
int pos = 90;
int sens1 = A0;
int sens2 = A1;
int tolerance = 2;

void setup()
{
  myservo.attach(9);
  pinMode(sens1, INPUT);
  pinMode(sens2, INPUT);
  myservo.write(pos);
  delay(2000);
}

void loop()
{
  int val1 = analogRead(sens1);
  int val2 = analogRead(sens2);

  if ((abs(val1 - val2) <= tolerance) || (abs(val2 - val1) <= tolerance)) 
  {
  
  }
  else {
    if (val1 > val2)
    {
      pos = --pos;
    }
    if (val1 < val2)
    {
      pos = ++pos;
    }
  }

  if (pos > 180) {
    pos = 180;
  }
  if (pos < 0) {
    pos = 0;  
  }

  myservo.write(pos);
  delay(50);
}



for any help in arduino coding Message on Facebook  (click here)

whatsapp  Send Message

Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home