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


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()
// servo connections
// name.attacht(pin);

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;

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

<p>Just finished up my take on this tracker. I used continuous rotation servos, so i had to modify the code a bit. Super fun project, thanks geo Bruce!</p>
<p>Hi could you send me the schematic for the build and the codes... because i think im going to go with the continuous rotation servos too.... ty</p>
<p>My wiring and build was pretty much the same as GeoBruces, except for an LCD I added.</p><p>For your individual motors, the servohstop and servovstop values might need adjusting. If it doesnt work as is, try setting both of these values to 90 and go from there.</p><p>#include &lt;LiquidCrystal.h&gt; //include LCD Library</p><p>#include &lt;Servo.h&gt; // include Servo library </p><p>LiquidCrystal lcd (2, 3, 4, 5, 6, 7); //</p><p>Servo horizontal;</p><p>int servohStop = 95; </p><p>int servohLeft = 105; //move horizontal </p><p>int servohRight = 85;</p><p>Servo vertical; // vertical servo </p><p>int servovStop = 95;</p><p>int servovUp = 105 ;</p><p>int servovDown =87;// move vertical servo</p><p>// LDR pin connections</p><p>// name = analogpin;</p><p>int ldrLeftTop = 1; //LDR top left</p><p>int ldrRightTop = 0; //LDR top right</p><p>int ldrLeftBottom = 2; //LDR down left</p><p>int ldrRightBottom = 3; //ldr down right</p><p>int dtime = 25; //delay time in milliseconds</p><p>int tolerance = 100; //difference tolerance between ldr readings</p><p>int count = 0; //millis(); //start millisecond count</p><p>void setup()</p><p>{</p><p> lcd.begin(16, 2); //begin 16x2 LCD </p><p>Serial.begin(9600);</p><p>// servo connections</p><p>// name.attach(pin);</p><p> horizontal.attach(9); </p><p> vertical.attach(10);</p><p>}</p><p>void loop() </p><p>{</p><p> //int count = millis(); //start millisecond count</p><p> int leftTop = analogRead(ldrLeftTop); // top left</p><p> int rightTop = analogRead(ldrRightTop); // top right</p><p> int leftBottom = analogRead(ldrLeftBottom); // down left</p><p> int rightBottom = analogRead(ldrRightBottom); // down right</p><p>//print resistance values to serial monitor for debugging</p><p> Serial.println(leftTop );</p><p> Serial.println(rightTop );</p><p> Serial.println(leftBottom );</p><p>Serial.println(rightBottom );</p><p> Serial.println();</p><p> count++;</p><p> int avt = (leftTop + rightTop) / 2; // average value top</p><p> int avd = (leftBottom + rightBottom) / 2; // average value down</p><p> int avl = (leftTop + leftBottom) / 2; // average value left</p><p> int avr = (rightTop + rightBottom) / 2; // average value right</p><p> int avgTot = (rightTop+rightBottom+leftTop+leftBottom) / 4;</p><p> int dvert = avt - avd; // check the diffirence of up and down</p><p> int dhoriz = avl - avr;// check the diffirence og left and right</p><p> if (count%10 == 1) //mod the millis count so the lcd screen updates every 10 millis</p><p> {</p><p> lcd.clear(); //clear the screen and position cursor at top left</p><p> lcd.print(&quot;dvert: &quot;); //difference in vertical resistances read from the LDRs</p><p> lcd.print(dvert);</p><p> lcd.setCursor(0,1); //set lcd cursor to bottom left</p><p> lcd.print(&quot;dhoriz: &quot;); //difference in horizontal resistance read from the LDRs</p><p> lcd.print(dhoriz);</p><p> }</p><p> if (-1*tolerance &gt; dvert || dvert &gt; tolerance) // check if the difference is in the tolerance else change vertical angle</p><p> {</p><p> if (avt &gt; avd) //if average resistance on top is greater than on bottom</p><p> {</p><p> vertical.write(servovUp);</p><p> }</p><p> else //avg resistance on bottom is greater than on top</p><p> {</p><p> vertical.write(servovDown);</p><p> }</p><p> }</p><p> else if (-1*tolerance &lt; dvert || dvert &lt; tolerance) //if difference is smaller than tolerance, stop vertical servo </p><p> {</p><p> vertical.write(servovStop);</p><p> }</p><p> if (-1*tolerance &gt; dhoriz || dhoriz &gt; tolerance) // check if the difference is in the tolerance else change horizontal angle</p><p> {</p><p> if (avl &gt; avr)</p><p> {</p><p> horizontal.write(servohLeft);</p><p> }</p><p> else</p><p> {</p><p> horizontal.write(servohRight);</p><p> }</p><p> }</p><p> else if (-1*tolerance &lt; dhoriz || dhoriz &lt; tolerance) //if difference in horizontal </p><p> {</p><p> horizontal.write(servohStop);</p><p> }</p><p>delay(dtime); </p><p>}</p>
I would like to get this code.Now I research about dual axis solar tracker.So I need your help.I would like to know why you assign tolerance is 100.I must show the comparison of tracking and fixed system.I must prove that tracking get power more than fixed system.So how do measure power in this system?please give me advise.
I followed your schematic and used your code but I can't get info to display on LCD.. lcd back light lights up and white squares are there when I turn potentiometer... do the 4 resistors have to be a certain ohm to work correctly...
this is all I get :-(
<p>hello, can you please help me. I have made project by Spellmal and get the some problems as you with the LCD screen. how u solved thoose problems ??</p>
<p>Try adjusting the LCD contrast by varying the voltage input to pin 3 (V0) of LCD using potentiometer.</p>
<p>got a screen myself, working on replicating this project.. thanks for the comment</p>
<p>can i know what is the function of the LCD?and can i get the full image of your model solat tracker?</p>
<p>Thank you for the answers... so i wounder if your servos are modifyed to make a full spinn... if i do that to my servos would the code you sent me work?</p>
<p>Hi, I was planning to make this for my recent college project but for some reason it doesnt work well. I followed the circuit and the code as well (changed it since at first it was moving away from the light) but then at times the servo dont work at all or sometimes only one works. I can't seem to figure out what the problem is. At first i thought its loose connection but even after changing the wires and checking everything it doesnt seem to work properly</p>
Can u me code?
<p>Hi I am Swarnadeep from India. I am using same as yours for my college project. Can you pls give me your code ??? I am using 360 servo for horizontal axis</p>
<p>Hello ,which IC have u used ???</p>
<p>Hellowhich IC have u used ???</p>
<p>Hi could you send me the schematic for the build and the codes... because i think im going to go with the continuous rotation servos toceers</p>
<p>Hi could you send me the schematic for the build and the codes... because i think im going to go with the continuous rotation servos too.... ty</p>
<p>Hello is there any chance you could send me the schematic for the build and the codes... because i think im going to go with the continuous rotation servos too.... thank you </p>
<p>hi can you please send me same stuff (he schematic for the build and the codes for display ..)to build a solar tracker</p><p>Thank you</p>
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. ;-)
<p>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,</p>
<p>hi dude ,</p><p>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</p>
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. ;-)
cool! :p <br>can you show us some video's or pictures? <br> <br>thnx
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. <br>
nice upload your design to http://www.thingiverse.com/
OK, Here it is. <a href="http://www.thingiverse.com/thing:120526" rel="nofollow">Heliostat Solar Sensor support structure</a>
What are the results and conclusions
What are the results and conclusions
<p>*videos *thanks</p>
Sure, here is the link to the YouTube clip I made: http://youtu.be/6GTVWdeKvzY<br> <div> <iframe frameborder="0" height="315" src="http://www.youtube.com/embed/6GTVWdeKvzY" width="420"></iframe></div>
Nice!!!<br><br>It's cool to see your instructable finished by someone else :D<br>it means i've helped someone ^^ or someone liked my project! :D
It's really helpful to get me started toward my other goals. <br>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.
<p>amazing robot i like it </p>
I'm starting my solar tracker. Today i welded some stainless steel sheets and put most of the bread board together. Wish me luck!
Best luck!<br>have fun with your build!<br><br>And If you'd like to put your welding skills to good use you might be interested in my other instructable: https://www.instructables.com/id/Dual-Axis-300W-IOT-Solar-Tracker/
How did you aligned the servo with sun/lightsource at first?
Hey. Love the idea. Some cool things here. I'm a student studying energy and specifically doing some projects with solar. I was wondering what happened when it was a cloudy day? Did it still track the sun accurately? Also did you buy to potentiometers for 10000 dollars ea.? My goal is to make a cheaper potentiometer.
<p>Finished! Quite fun project. </p>
<p>Quite a fun project. Word of advice for those doing it, test your LDRs you have before starting this project, might save you some trouble. Some of the LDRs I had were producing enormously high voltage, way above data sheet values (like 10 times higher, it was impossible to overcome with tolerance calibration). </p>
<p>Hello</p><p>can i copy this instructables in my site, i will mention your name</p>
Yes If you mention my name and a link to my instructable it's perfect for me!<br><br>Good luck with your projects!<br><br>and thanks for asking ;)
<p>hi do you have a schematic diagram and code if stepper motor is used instead of servo? ty</p>
<p>Hello :) <br><br>when I upload the code on my arduino this error appears. My arduino is uno.<br><br>Arduino: 1.6.4 (Windows 8.1), Board: &quot;Arduino Uno&quot;</p><p>Build options changed, rebuilding all</p><p>__.PNG.ino: In function 'void loop()':</p><p>__.PNG:24: error: a function-definition is not allowed here before '{' token</p><p>__.PNG:33: error: a function-definition is not allowed here before '{' token</p><p>__.PNG:98: error: expected '}' at end of input</p><p>a function-definition is not allowed here before '{' token</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.<br><br>could you please help me ? <br><br>Thanks in advance :) </p>
<p>What do you use to create the circuit diagrams?</p>
<p>Working on this now for a solar powered weather station transmitter. I wonder what the quiescent current is when not moving? I'm thinking it would be smart to add low power to the sketch. If the tracker updates its orientation once every 15 minutes that should be plenty.</p>
<p>Well that was easy.</p>
<p>saw this post probably a year ago, finally got to it.!! thanks for sharing this amazingly simple project, i've learned a lot. followed everything as listed above.<br><br><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/PCFxlu3Z67o" width="500"></iframe>3D printed base + arm. cables are pretty stiff. will switch to softer wiring for the updated version. the + shaped arm has to be wider and the sensors must be tucked into the corner more for better shadow creation.. also a heavy, tall &amp; skinny frame approach is the way to go, for better cable management especially.</p><p>.<br>also took me a while to get the potentiometer settings correct as i was using endless turn knob ones.. will post updates here, and will upload the updated 3D frame to thingiverse.<br><br></p>

About This Instructable




Bio: 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 ... More »
More by geo bruce:Design a Parametric Pulley (DXF / STL) High Voltage Pulse Generator for $8 (stungun) Dual axis solar tracker with online energy monitor 
Add instructable to: