Sunteți pe pagina 1din 9

Food Living Outside Play Technology Workshop

Arduino Solar Tracker


by geo bruce on July 2, 2011

Table of Contents

Arduino Solar Tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: Arduino Solar Tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: How it works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: The set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 3: The circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 4: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

http://www.instructables.com/id/Arduino-Solar-Tracker/
Author:geo bruce author's website
I study electronics

Intro: Arduino Solar Tracker


What is does:
It searches for the brightest light source like the sun.

Image Notes
1. stand
2. servo's
3. sensor
4. magic tape

Step 1: How it works


How it works:
I'd made a sensor of 4 LDRs with sheets between them

The withe stips are the LDRs

When the stick on top is righted to the sun or the brightest point
the four LDRs get the same amount of light on them.

Example1 when the light is left on top:


right-top, right-down, left-down are in the shadow
and left-top get the most light

Example2 when the light is on top


left and right down are in the shadow and top is in the light

http://www.instructables.com/id/Arduino-Solar-Tracker/
Image Notes
1. ldr
2. ldr
3. ldr
4. ldr
5. stick
6. sheets
7. the sensor

Image Notes Image Notes


1. Sensor 1. ldr
2. cardboard 2. ldr
3. horizontal
4. vertical
5. eevblog
6. other experiment

http://www.instructables.com/id/Arduino-Solar-Tracker/
Step 2: The set-up
Just hot glue it together!!!

Image Notes Image Notes


1. this point has never a shadow 1. ldr's

http://www.instructables.com/id/Arduino-Solar-Tracker/
Step 3: The circuitry

Image Notes
1. Arduino Image Notes
2. Horizontal servo 1. Connections LDRs
3. Vertical servo 2. Connections potentiometers
4. Pin 9 = Horizontal Pin 10 = Vertical
5. Potentiometers for speed and tolerance
6. Analog Pins A0 = left top A1 = right top A2 = left down A3 = right down A4 =
speed A5 = tolerance

Image Notes
http://www.instructables.com/id/Arduino-Solar-Tracker/
1. Horizontal servo pin 9
2. Vertical servo pin 10
3. Sensor

Step 4: The Code


you can download the code down this page

#include <Servo.h> // include Servo library

Servo horizontal; // horizontal servo


int servoh = 90; // stand horizontal servo

Servo vertical; // vertical servo


int servov = 90; // stand vertical servo

// LDR pin connections


// name = analogpin;
int ldrlt = 0; //LDR top left
int ldrrt = 1; //LDR top rigt
int ldrld = 2; //LDR down left
int ldrrd = 3; //ldr down rigt

void setup()
{
Serial.begin(9600);
// servo connections
// name.attacht(pin);
horizontal.attach(9);
vertical.attach(10);
}

void loop()
{
int lt = analogRead(ldrlt); // top left
int rt = analogRead(ldrrt); // top right
int ld = analogRead(ldrld); // down left
int rd = analogRead(ldrrd); // down rigt

int dtime = analogRead(4)/20; // read potentiometers


int tol = analogRead(5)/4;

int avt = (lt + rt) / 2; // average value top


int avd = (ld + rd) / 2; // average value down
int avl = (lt + ld) / 2; // average value left
int avr = (rt + rd) / 2; // average value right

int dvert = avt - avd; // check the diffirence of up and down


int dhoriz = avl - avr;// check the diffirence og left and rigt

if (-1*tol > dvert || dvert > tol) // check if the diffirence is in the tolerance else change vertical angle
{
if (avt > avd)
{
servov = ++servov;
if (servov > 180)
{
servov = 180;
}
}
else if (avt < avd)
{
servov= --servov;
if (servov < 0)
{
servov = 0;
}
}
vertical.write(servov);
}

if (-1*tol > dhoriz || dhoriz > tol) // check if the diffirence is in the tolerance else change horizontal angle
{
if (avl > avr)
{
servoh = --servoh;
if (servoh < 0)
{
servoh = 0;
}
}
else if (avl < avr)
{
servoh = ++servoh;
http://www.instructables.com/id/Arduino-Solar-Tracker/
if (servoh > 180)
{
servoh = 180;
}
}
else if (avl = avr)
{
// nothing
}
horizontal.write(servoh);
}
delay(dtime);
}

File Downloads

solar_tracker__english_.pde (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'solar_tracker__english_.pde']

Related Instructables

Arduino 2-axis My Arduino Line Ard-e: The robot How to Make an


servo solar Following Robot with an Arduino Obstacles A Strong Simple
tracker by Fun Sun- !!! - With Pololu as a brain by Avoiding Robot- Sun Tracker by
aplavins tracking QTR-6A IR imadami Arduino Style by Cowboywindmillbuilder
Arduino by Reflectance robotkid249
veedo Sensor Array
(video) by
DuFFxP93

Comments
20 comments Add Comment

ATTILAtheHUNgry says: Jul 14, 2011. 5:42 PM REPLY


Super awesome. Just use a sensor like this to auto-align solar powered objects like solar ovens and the like. You get my vote.

geo bruce says: Jul 15, 2011. 8:39 AM REPLY


THNX

drozzle says: Jul 12, 2011. 2:49 PM REPLY


Very cool, one of the few space related projects in the space challenge :D

geo bruce says: Jul 12, 2011. 11:34 PM REPLY


^^ =D

philic says: Jul 11, 2011. 5:28 AM REPLY


Great idea and exactly the type of thing I have been searching for. Is there any reason this couldn't be done with 3 sensors arranged in a 3rds formation as
opposed to the 4 in quarters like you have done? I just trying to think how to reduce the BOM. Cheers.

geo bruce says: Jul 11, 2011. 11:56 AM REPLY


Yeah it must be possible,
I should go for A

http://www.instructables.com/id/Arduino-Solar-Tracker/
shahzade says: Jul 6, 2011. 5:12 PM REPLY
Dude!!
I'm impressed by the design of the sensor. Did you come up with that by yourself or did u see that somewhere else before?

Great project, definitely on my todo list!


THX Shah

geo bruce says: Jul 7, 2011. 9:42 AM REPLY


I saw a long time ago on tv a lightsensor with 4 LDR's but I improved the idea

thnx

rocketman221 says: Jul 5, 2011. 11:55 AM REPLY


Cool. It just needs some bigger servos so it can move a solar panel around.

1tri2god says: Jul 5, 2011. 8:21 AM REPLY


this is awesome! What kind of LDR's did you use (so I can look 'em up and buy them)?

geo bruce says: Jul 5, 2011. 8:45 AM REPLY


It doesn't matter what LDR's you use
the ldr I used:
dark > 400kohm
light 100ohm - 20kohm

and I'd set it in series with an 1K resistor

1tri2god says: Jul 5, 2011. 9:29 AM REPLY


thanks!

geo bruce says: Jul 5, 2011. 10:31 AM REPLY


you're welcome!

piratus says: Jul 4, 2011. 10:52 AM REPLY


that s cool !! but where can i find micro serve ?§ thanks

geo bruce says: Jul 4, 2011. 11:24 AM REPLY


you can find them really cheap on ebay

look here:
http://shop.ebay.com/i.html?_nkw=4+x+servo+9g&_sacat=0&_sop=15&_odkw=4+x+servo&_osacat=0&_trksid=p3286.c0.m270.l1313

4 x servo = 10$ shipping included


http://cgi.ebay.com/4-X-Micro-9g-Mini-Servo-Futaba-Hitec-HS-55-GWS-walkera-
/160601107472?pt=Radio_Control_Parts_Accessories&hash=item2564926c10#ht_2542wt_1139

or you can find them on dx


http://s.dealextreme.com/search/servo

no problem

http://www.instructables.com/id/Arduino-Solar-Tracker/
rimar2000 says: Jul 3, 2011. 11:31 AM REPLY
This is a VIP: Very Important Project.

I was working in an equatorially mounted solar cooker. All is right, except it lacks a solar tracker!

Kiteman says: Jul 3, 2011. 1:41 AM REPLY


This is really very cool - an über-headbot.

We really need more details on how you mounted the actual mechanical parts, though.

geo bruce says: Jul 3, 2011. 3:48 AM REPLY


I'd just created a new step with a lot of pic's with the construction
(just hot glue)

Kiteman says: Jul 3, 2011. 5:20 AM REPLY


Excellent - it's a lot easier to see how the servos are arranged now.

jwkooi says: Jul 3, 2011. 4:36 AM REPLY


Thanks for the detailing. The movie clip really made me enthousiastic. I am considering a project like this but than with only 1 lcd. The servo contructiion with
hotglue is briljant.The mechanical construction is most of the times the reason for me not to start a project but with your appraoch: glue and presto.
Nice job.

http://www.instructables.com/id/Arduino-Solar-Tracker/

S-ar putea să vă placă și