One Man's Adventures into Renewal Energy

Solar Panel

Night - 0 Watts

Battery Bank

Very Low - 11.66 Volts
Battery and Panel Stats Updated @ 30/05/2017 00:55
Please help me to continue hosting this website & associated costs by donating £2.
In return, I'll email you a ZIP file containing arduino code + all images from the website + some extra ones that aren't on the website...all in high res (370MB of pics!).

Prototype mk I

6th May 2012 - Prototype 1...the very first build!

Parts Needed -
Even though it worked fairly well, there were a couple of issues.


Circuit Diagram

Prototype 1 Layout

Arduino Code

int sensorPin0 = A0;    
int sensorValue0 = 0;  
int sensorPin1 = A1;    
int sensorValue1 = 0;  
int sensorPin2 = A2;    
int sensorValue2 = 0;  
int sensorPin3 = A3;    
int sensorValue3 = 0;  
int left = 0;
int right = 0;
int up = 0;
int down = 0;
int ledPin3 = 10;   
int ledPin4 = 11;   
int ledPin5 = 8;   
int ledPin6 = 9; 


void setup()
{
  Serial.begin(9600);
  pinMode(ledPin3, OUTPUT);    
  pinMode(ledPin4, OUTPUT);  
  pinMode(ledPin5, OUTPUT);    
  pinMode(ledPin6, OUTPUT); 
}

void loop() {
  ////////////////////////////////////////////////////// Set all relays low
digitalWrite(ledPin3, HIGH);
digitalWrite(ledPin4, HIGH);
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin6, HIGH);

  ////////////////////////////////////////////////////// Read Orange Input
  sensorValue0 = analogRead(sensorPin0);       
  delay(1000);    

  // Serial.print  ("orange - sensor 0 = ");   
  // Serial.println  (sensorValue0);

  /////////////////////////////////////////////////////// Read Yellow Input
  sensorValue1 = analogRead(sensorPin1);       
  delay(1000);    

  // Serial.print  ("yellow - sensor 1 = ");
  sensorValue1 = (sensorValue1 + 26); //////compensation for LDR, tweak as necessary
  // Serial.println  (sensorValue1);

  //////////////////////////////////////////////////////// Read Blue Input
  sensorValue2 = analogRead(sensorPin2);       
  delay(1000);    

  // Serial.print  ("blue - sensor 2 = ");   //////compensation for LDR, tweak as necessary
  // Serial.println  (sensorValue2);

  //////////////////////////////////////////////////////// Read Green Input
  sensorValue3 = analogRead(sensorPin3);       
  delay(1000);    

  sensorValue3 = (sensorValue3 + 25);

  // Serial.print  ("green - sensor 3 = ");  //////compensation for LDR, tweak as necessary
  // Serial.println  (sensorValue3);  

  // Serial.println ("");

  ////////////////////////////////////////////////////////Move Left?
  left = (sensorValue1 - sensorValue3);
  // Serial.print  ("left = ");
  // Serial.println  (left);  

  if (left > 3)   ///// 3 = threshold value.  Lower number will cause more movements and increase twitching
  {
    // Serial.println ("Move Motor Left");                
    digitalWrite(ledPin3, LOW);    
    delay(75); 
    digitalWrite(ledPin3, HIGH);     
  }

    delay(1000); 

  ////////////////////////////////////////////////////////Move Right?
  right = (sensorValue3 - sensorValue1);
  // Serial.print  ("right = ");
  // Serial.println  (right);  

  if (right > 3)   ///// 3 = threshold value.  Lower number will cause more movements and increase twitching
  {
    // Serial.println ("Move Motor Right");                
    digitalWrite(ledPin4, LOW);    
    delay(75);   
    digitalWrite(ledPin4, HIGH);   
  }
    delay(1000);
  ////////////////////////////////////////////////////////Move Up?
  up = (sensorValue0 - sensorValue2);
  // Serial.print  ("up = ");
  // Serial.println  (up);  

  if (up > 3)   ///// 3 = threshold value.  Lower number will cause more movements and increase twitching
  {
    // Serial.println ("Move Motor Up");                
    digitalWrite(ledPin5, LOW);    
    delay(500);    
     digitalWrite(ledPin5, HIGH);      
  }
    delay(1000);
  ////////////////////////////////////////////////////////Move Down?
  down = (sensorValue2 - sensorValue0);
  // Serial.print  ("down = ");
  // Serial.println  (down);  

  if (down > 3)   ///// 3 = threshold value.  Lower number will cause more movements and increase twitching
  {
    // Serial.println ("Move Motor Down");                
    digitalWrite(ledPin6, LOW);    
    delay(500);       
      digitalWrite(ledPin6, HIGH);     
  }
    delay(1000);



}



See how the LDR Circuit is made


Comments

Raghvendra S. Chauhan - 01/05/2014 11:36:20
Sir, how do we make connections on relay module with LDR circuit.? Can u please mail me the whole circuit diagram or the final picture of whole assembly.

john - 05/08/2013 08:34:04
I'm defo gonna use this. Thanks.

eds - 02/07/2013 10:22:49
how to place the four LDR i need help..plsssss

eds - 02/07/2013 10:22:45
how to place the four LDR i need help..plsssss

eds - 02/07/2013 10:22:43
how to place the four LDR i need help..plsssss

ADMIN
- 23/04/2013 09:55:37
Hi Imed - This was first attempt at code. It's since changed considerably, but I've yet to upload the new code. If I get chance this week, I'll upload it.

Imed - 23/04/2013 09:37:13
Hi, I reproduced the same circuit and the same code but it did not work, mesnwhile I noticed some issues in the code.. I think it still missing somthing in the code, for example the variables servov and servh are not declared, and how the ARDUINO will give the oreder to the servos to turn left or right?!

Lauri - 31/03/2013 07:31:43
Why not using Time To Follow The Sun?

ADMIN
- 28/02/2013 08:47:30
The "servo" part of the arduino comes as standard within the package. I didn't do anything special other than just install the arduino software....I think! It's been a good few months since I looked at this. I'm waiting for the good old British Spring time to kick in and I'll be picking all this up again.

Paul (nze.okeke@gmail.com) - 27/02/2013 22:19:23
I guess there is a class called "servo" (correct me if am wrong) and you did not include the code...

Mike Blake - 03/02/2013 01:26:12
I tamed the LDR problem by putting a resistor in parallel with the LDR so that the change of output in dark conditions is reduced. I,m still developing it but at the moment I have 10k across the sensor into a 10k at the bottom which limits the output range to 2.5v - 5v. It's still not linear enough at the low light levels so my next experiment will be trying various filters to keep the LDR's in the higher resistance range.

Name

Email Address (won't be shown)

Human Check - What colour is the sky?

Comment








Copyright 2017 BinaryOrbit.org