Arduino solar tracker

Hey guys, i want to make a solar tracker, using arduino. I need some advice or maybe some code on how to do this. Some other questions i have is in what orientation should i put the LDR sensors that i plan to use. Should i have four, all pointing in north south east west configuration, or use on one LDR sensor. So the servo that drives it rotates all the time, until the LDr sensor that points in the same way as the solar panel, get to a certain threshold, as in, pointing towards the sun.

FWIMBW, I was once going to build one and thought of a concept that may help you.

Instead of looking for the brightest point, if you have a "stick" between the sun and the LDR, you can look for the shadow of the stick. It would seem to me the shadow would be more distinct.

There are also formulas that can be used to track the sun. However these are pretty complex and I never had much luck porting them to C.

Sounds like a very interesting project. Please keep us posted.

Good idea! The thought of this project might be though, to be as compact as i can. Im still working on the code for this… i hope to post it soon for anyone else who’s watching.

Is it mobile or a fixed installation? I am building a fixed installation with 1.3Kw of tracking panels. I will be using Arduino as a clock drive, driving spit-roast motors for a short time each hour. For a fixed installation, a clock drive avoids the deterioration of the sensors by the constant exposure to weather & sun. Total power collected will increase by 30% at this latitude (-34) when tracking is enabled. Currently (non-tracking) I am generating about 6 kwh per day, exporting 1.5 kwh per day (Southern Spring)

This is mobile, only because i am just experimenting. This could also apply to larger panels, it just would need better motors.

i have figure out the program, i think? I do not have a motor handy, or a TIP120 circut to drive the motor.

int value1 = 0; //analog reading from light sensor
int value = 0; // variable to keep the actual value for PWM

int threshold = 512;
int motorToTurnSolarPanel = 11; //with a tip120 transitor circut to drive the motor, using PWM

void setup(){
Serial.begin(9600);//set the baud rate

value1 = analogRead(1);

void loop() {
for(value = 0 ; value <= 80; value+=5) // fade in (from min to max)
if (value > threshold) digitalWrite(motorToTurnSolarPanel, LOW); else analogWrite(motorToTurnSolarPanel, value);//primary command to move the motor



I'm doing the same thing for my final year project at university, but I'm using GPS to get the time, date, elevation, longitude and latitude.

From this I can work out the azimuth and the elevation, then moving two motors.

That is a very cool idea! Very nice

Instead of using one motor as described earlier, would it be more simpler to use one servo and two LDRs

I'm with robotkid249 on this. Golden rule of engineering: KISS (Keep It Simple, Stupid)

Use two LDR's pointing in the same direction, but separated by a sheet of black cardboard/plastic/whatever. Unless they are facing the sun head on, one will show a very low value and one a very high as one is in the sun and the other is in the sade of the cardboard/plastic/whatever separator. If their values are not within a certain threshold of eachother you tell the servo to run in the appropriate direction.

2 LDR's, a servo (or stepper motor), and less than 20 lines of code. KISS FTW! 8-)

Im aware of this IC, but it might not be as "smart" as i need it to be. Generally you use this with the BEAM bicore

Soryy i forgot to post the link...

Hello everybody. I'm still quite new at this, so bear with me, please.

I have only very recently been introduced to Arduino, and it's a wonderful thing!

I have wanted to implement an idea for a solar tracker for some time, but haven't had the development platform handy to do so with conventional MCU's so discovering the Arduino has been a complete bonus.

Co-incidentally, I've only just discovered this topic when searching around the Playground and Forum in order to work out how to get my finished prototype up on display. Should have come here first ..........

Until I have somewhere public to post my images and code I will just have to e-mail anyone who's interested any or all of the above, until I can get me head around how to get it up here.

In summary, I've used four small solar cells on a backing plate, separated by baffles that provide shadows when the plate is off axis (vertical of horizontal). The shadows are interpreted by the Arduino as differential voltages, which then translate into motor movement. I've used a simple robotic arm kit to get the articulation needed for movement of the panel, and control is achieved with a few IC's and a couple of relays on a breadboard hitched up to the Diecimilia.

What I've built is a model, but easily extensible to the real thing with appropriate interfacing on the output of the Arduino. I have produced circuit diagrams and code, for anyone who wants to have a look.

I'm open to suggestions for improvements, and also any practical help from those of you who have used the Forum and Playground a fair bit, as to how to post my work. At present I do not have a web host for any of this work (it's on my PC at home), so could use some advice about posting content from here.

I can be contacted at the following e-mail address:

Have fun, the Arduino way ! :)

Hello Alll....

I m too new to Arduino... I have just ordered it and I also will try to work on this project as I do have few solar panels but they are not tracked.

One suggetion that strcuk my mind was, why not we decide a goal and start working together on it.

For Example :

GOAL - To make the most efficient and cost effective solar tracker using Arduino.

So we cannot use GPS (as we want to make it cheap) we can use a LDR circuit then.... etc...

Then we can upgrade this project... like using Xbee shield to enable remote data tracking of the solar panel etc....

And and this way we shall be able to implement entire project that is well documented

Let me know what do you feel about this...

Thanks dufferdev

I want to try that solar tracker. Can you give me some information about that?

See previous discussion...

Hello world !

You can see my develop of Sun Tracking system

In the next post I give you the address.



You can see my sun tracking develop at:

Thank you

Hi Guys, I'm new to this forum, and new to solar tracking, but plan to build something myself. I've looked at various approaches online, and many use sensors. I have an idea of how to do it, but cannot see any reference to this approach on any websites, so maybe it would not work. Anyway, I wanted to put it out there and ask for feedback. So the idea is to just adjust the position of the panel to maximize the current going to the battery. The current can be measured across an inexpensive shunt resistor. The Arduino would turn the control motor in the direction that causes the current to increase, and stop once the current starts to go down. It sounds pretty simple. Am I missing something? Feedback most welcome. Regards, Gerry.

The remark about wear and tear on the LDRs out in the sun's damaging rays, and all weathers set me thinking...

a) In ANYTHING you design that will be outdoors, design it for easy replacement of damaged parts. They WILL need replacing... sooner than you hope!

b) Are LDRs the way to go? Probably... but I wondered if maybe temperature sensors embedded in small blocks of black epoxy might do just as well, and be more robust?

c) Of course, while I would be the first to applaud anyone wanting to have fun creating a solar tracker... how cool! (I've wanted to build one for years).... if I just wanted my solar panels oriented correctly, I would put my faith in Mr Newton. The geometries of the earth's relationship to the sun are entirely predictable, and a program can be written to point the panels in the right direction without any light sensors. Sorry to be a bore. Do remember on BIG advantage of the track-by-light-sensor approach, though: It doesn't need an accurately set RTC (time of day clock) to work.

d) A KISS point: You really only need the expense, complexity, etc, etc needed to "tip" the panels left and right around one axis of rotation day by day.... to track the sun across the sky. You may want to mount everything on a second axis of rotation to compensate for the sun's height above the horizon at noon, to compensate for the seasonal variation in that axis... but this adjustment can be done manually with whatever you want to use during your routine servicing of the panels. The rate of change in this axis is slow.