Arduino Solar Tracker

506,593

728

291

About: Hello, I'm Bruce. I'm a student in Belgium. I have a wide variety of interests: electronics, computers, technology, ... In my spare time I spend a lot of time on: projects, exploring the internet, cycling. ...

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: How It Works

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

The white dots 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


Step 2: Parts List

Step 3: The Set-up

Just hot glue it together!!! 

Step 4: The Circuitry

Step 5: The Code

you can download the code down this page

/* this code is written by geobruce
for more info check my site http://xprobe.net
*/
#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;
if (servoh > 180)
{
servoh = 180;
}
}
else if (avl == avr)
{
// nothing
}
horizontal.write(servoh);
}
delay(dtime);




Celestron Space Challenge

Runner Up in the
Celestron Space Challenge

Make It Move Challenge

Participated in the
Make It Move Challenge

Microcontroller Contest

Participated in the
Microcontroller Contest

18 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

291 Discussions

0
None
TomDunlap

6 years ago on Introduction

Just finished it and got it debugged. Really cool. Now I'm going to try to use it to build a Solar Forge and or a Solar Sand Sinter 3D Printer. Should be a snap. ;-)

14 replies
0
None
ShreyasP4TomDunlap

Reply 3 years ago

Hey Tom, We are right now making a Solar sand sinter 3D printer. We have finished making the coordinate plate and are working on the tracking system now. Would like to get your inputs. Best,

0
None
BalaJ11ShreyasP4

Reply 3 years ago

hi dude ,

what is the rate and power of servo motor which u have used.. can u give me some details.. i have to do this as mini project

0
None
TomDunlapShreyasP4

Reply 3 years ago

Good luck with your project. I have not been able to pursue this one so not much more to add. Everything you need should be available online now. Except time and money. You'll have to come up with those. ;-)

0
None
TomDunlapgeo bruce

Reply 6 years ago on Introduction

Another development, I used a Makerbot Replicator to print a replacement for the foam core sensor holder. Here is the Sketchup pic of it. The two pieces glue together. The center top hole is for a fifth sensor to shut the system down if clouds block the sun so it doesn't try to point at the brightest cloud.

Pyramid 3.png
0
None
geo bruceTomDunlap

Reply 6 years ago on Introduction

Nice!!!

It's cool to see your instructable finished by someone else :D
it means i've helped someone ^^ or someone liked my project! :D

0
None
TomDunlapgeo bruce

Reply 6 years ago on Introduction

It's really helpful to get me started toward my other goals.
Next I want to modify the code to operate some 12V drill motors with a MotorShield or the like if I can find one that will handle the 3-4A current.

0
None
AlexUstos

Question 2 months ago

Доброго времени! Вы сделали новый проект, и новый скетч, но не указали как подключить Н-мост. Купил 7A-160W. Как подключить старый скетч?

0
None
tgray1

5 months ago

The parts list says 10K resisters but the photo shows 1K (brown-black-red) and the handwritten notes say 1K.

0
None
mikhailmagri959

Question 5 months ago on Introduction

Hi,
just need to know what is the function of the potentiometers ?
Thanks

0
None
JosephM408

7 months ago on Step 5

Hello sir. What is the purpose of using a variable resistor that is connected in ANALOG PIN 4 AND 5?

1 reply
0
None
DraconicOJosephM408

Reply 6 months ago

hello, after reading the code it appears that pin 5 controls the tolerance of the resistors (or how sensitive they are), you don't want a passing wispy cloud to make your projects go crazy if your tracking the sun. and pin 4 controls how often the code repeats, both can probably be replaced with constant integers in their place, however, having a pot. there makes for easily adjusting on the fly without needing to reconnect a laptop or pc, although i am new to arduino so theres a chance im reading it totally wrong.