This project was one of my final projects I did on my exchange studies in Finland.

For this project I worked together with Fatbardh.

This is a much larger and more advanced version of one of my first projects ever.
Also a solar tracker: https://www.instructables.com/id/Arduino-Solar-Tracker/ .

The features of this solar tracker are:

  • Solar tracking: making sure the solar panels are aligned to the sun as long as possible.
  • Energy monitor: This measures the voltage and the current generated by the panels and calculates the generated Power and Energy.
  • Data logging: this sends the data from the energy monitor into the cloud of ThingSpeak.
  • Also there is an LCD to display the values of the energy monitor

In this instructable are technical drawings of the project included. And at step 10 there is a link to the complete project report and presentation.


To read more about the energy profit from this kind of system please read this chapter on wikipedia.

This is also my entry for the 3D printing contest:
I would love to have a 3D printer. It will help me a lot to do other projects. To make gears and enclosures. So if you found this Instructable interesting please vote for my Instructable in the 3D printing contest.

My excuses for my spelling mistakes, you may always let me know if you see some.

Step 1: Overview

In this step I’ll go over all the used components in this project.

Solar panels:

We used 2 solar panels of each 12V 150W which will bring the total to 300W.

Ebay link

Energy Monitor:

The energy monitor uses 2 current sensors, to measure the current.

And one voltage divider to get the voltage down to a voltage that the Arduino its analog-digital-converter or ADC can handle.
If you don't want to make it your self you can buy one as well: ebay link

Light direction sensor:

Light direction is detected by four Light dependent resistors or LDRs. Each of the LDRs is placed in a voltage divider and the signal is fed to the Arduino its ADC.
ebay link

The end stop Switch

The end stop makes sure the mechanical construction doesn’t collide in its self.

Ebay Link

The motors

The motors are 12V linear actuators from internet.

Actuators on ebay

And are controlled with a very simple H-bridge.

motor drivers on ebay


The ESP8266 is a cheap WIFI module which we use to send the data to a ThingSpeak datastream

Ebay link


The display is used to display the energy monitor values

ebay link

The microcontroller

The microcontroller we used was an Arduino ATMEGA 2560

Arduino MEGA 2560 R3 ~10$ - Ebay

The charger

For the charger you should search for a MPPT (max power point tracking) chager. And for sure not buy the one in the picture because this one overcharged our batteries and is not MPPT.

Step 2: Mechanical Construction.

We both didn't had a lot of experience with metal working. Because of this we got help from a local vocational school.

The construction exists of a strong steel beam, in which a second part is placed, by sliding in a rod in a hole. To this set-up are levers added to which we connect the linear actuators.

Have a look at the technical drawings (PDF) and the pictures to get a better idea of what it looks like.

The technical drawings and the renderings are made with Fusion 360

Linear actuator ebay link

Step 3: The Light Sensor

This is the same principle as the previous version. 4 LDRs separated by a crossbeam. This time the crossbeam was 3d printed.

It works by comparing the average of LDR values of each side to determine which side to rotate to.

LDR holder 3d model: http://www.thingiverse.com/thing:1500571

Photoresistors ebay link

Step 4: Motor Control Algorithm

The motor control algorithm is responsible for turning the motors on and off. This all depending on the data of the ligh sensor.

This also improved compared to my previous version. Now there is a hysteresis implemented. Comparable to a Schmitt trigger. So the motor turns only in if the light difference is larger than a certain threshold value, and it will only stop if the light difference is below a certain value.

Step 5: Energy Monitoring

The energy monitor works by measuring the voltage and current output of the panels.
By multiplying these two values you get the generated power.

P = U * I
P= Power in Watt; U = Voltage in Volt; I = Current in Ampere.

By integrating the Power over time you'll get the total generated Power.

Voltage measurement

The voltage measurement is done by a voltage divider over the panels output. To get the output range of the panels 0-22V down to a range of 0-5V to protect the analog-digital-converter.

Current measurement

The current measurement is done by two ACS712 hall effect current sensors.

Current sensor ebay link

Step 6: Data Logging

The data logging is done by sending all the data to a ThingSpeak channel.

This is done by an ESP8266 WIFI module.

The ESP8266 ebay link

Step 8: Software

If you want to use this code you should have a look at:

  • EnergyMonConnections.h
    • connections for the energy measurement
  • solartrackerdefines.h
    • settings and conenctions for the LDRs and solar tracker
  • solarPanel.h
    • to set the formulas right for the calculations of the ADC
  • internet.h
    • set wifi name and password aswell as api key

Step 9: Final Results!

Step 10: More Information

For much more information about this project.

I would like to recommend you my project report and presentation.



Step 11: Questions

If you have any questions, feel free to ask. If you can't find your answer in the comment section.
And I'll try to add more information to the Instructable depending where the most questions are about.

I hope you had fun reading my Instructable.

<p>Loved the idea and concept so I decided to build one.<br>Now it's still in testing phase so its pretty rough around the edges.</p><p>I took the code and stripped it back to just the solar tracking, taking away all of the WIFI and the energy monitoring. To be honest I had a lot of trouble trying to get the energy monitoring side of the software working, and didn't try the WIFI part. Later I wish to get the energy monitoring going but use ethernet, not wifi.<br>I am only new to this so it was quite a learning curve getting it all to work, but initial testing shows that it should be good.<br>The tracker does get confused when there is no sun, just pointing to the sky.<br>Here is a time laps video of it working. https://youtu.be/dhnQ9u6vnT8</p>
<p>Awesome build! Glad to see that someone replicated my instructable!<br>And it always points to the brightest point in the sky, so when there is no sun, if searches for the brightest point in the cloud.</p><p>Looks very good!!<br>please keep us updated if anything changes!</p>
<p>can you help with the code , as i'm using a stepper motor for pan motor </p><p>and the tilt motor is a dc motor .</p>
<p>Nicely done!!</p>
<p>How big is the motor which use solar tracker ????</p>
<p>geo bruce, thank you very much, for passing your knowledge to us, I am from Brazil, and I am studying about photovoltaic energy and I will put this project into practice if you authorize, of course.</p>
Of course have fun with it!! I'm glad I you like my project!!<br>Please keep us up to date and post some pictures and share your experiences!<br><br>Good luck!
<p>well done, but i don't get where is your left and your right in LDR , and if PAN_MOTOR_PIN_0 mean the direction is left or right also if i need to use this code as only a tracker my Void Loop will only be</p><p>void loop() {</p><p>readLDRVal();</p><p>turnToLight(TILT, AVERAGE_UP, AVERAGE_DOWN, UP, DOWN);</p><p>turnToLight(PAN, AVERAGE_LEFT, AVERAGE_RIGHT, LEFT, RIGHT);</p><p>}</p><p>please let me know which pin is right and which is left for motors, also where is your left and your right in LDR in the 3D printer model on a simple sketch if it is possible, thanks and again well done.</p>
I wanna copy that for my garden. Sorry in case i missed it but is there a circuit diagram/wiring diagram?
<p>Great project! Is your data on ThingSpeak public? If so, what is the channel number? We wanted to see if we could provide some MATLAB analysis of the raw data that might improve performance.</p>
<p>Hello Geo Bruce and Any kinf person who can able to answer,</p><p>I would like to make a similar one with horizontal stepper motor with micro step driver and vertical DC actuator, however i need some help on coding. Could you please help me on that. I have achieved to move both DC (driving with L293D) and Stepper motor, but i do not know how i can implement it into the code which is given here.</p><p>int pul = 3;</p><p>int dir = 2;</p><p>int DCyon1 = 5; // L293D's 2nd pin is one direction</p><p>int DCyon2 = 6; // 7th pin is reverse direction.</p><p>void setup() {</p><p>pinMode(pul, OUTPUT); // microstep driver pulse</p><p>pinMode(dir, OUTPUT); // microstep driver direction</p><p>digitalWrite(dir, LOW); // if it is HIGH means reverse direction of stepper motor</p><p>pinMode (DCyon1, OUTPUT);</p><p>pinMode (DCyon2, OUTPUT);</p><p>}</p><p>void loop() {</p><p>digitalWrite (DCyon1, LOW);</p><p>digitalWrite (DCyon2, HIGH);</p><p>digitalWrite(pul, HIGH); // this goes to pulse of step motor driver</p><p>delay(0.1);</p><p>digitalWrite(pul, LOW);</p><p>delay(1);</p><p>}</p>
<p>Hi All,<br>I was wondering ... what kind of load (a resistive load?) is applied to the output of the solar panels ?<br>Since these are very high wattage solar cells how do the creators go about tackling this?<br>(I could not find any reference to that while skimming through the project)<br><br>Thank you</p>
<p>Hi All, I was wanting to do something similar but keep the tracking simple to code and effect. I figured that being up to 5deg away from perpendicular to the sun wouldn't greatly affect electric output so my plan was to lead the sun by 5deg wait 40 minutes as the sun passed through perpendicular and then move ahead to lead the sun by 5deg again. So only about 18 movements per day. Given that the year is symmetrical, that's only about three and a half thousand x,y pairs for a given location. I would think an arduino could handle that kind of table lookup? What do people think of that idea?</p>
<p>Ok, I just read a post by Howdenpines over on:</p><p><a href="https://www.instructables.com/id/Stepper-Motor-Arduino-Solar-Tracker-EV" rel="nofollow">https://www.instructables.com/id/Stepper-Motor-Ardu...</a><br>Where he suggested having one axis parallel to the earth's axis. This hugely simplifies the required table of data. Each day the declination is set (23deg down at winter solstice, 23deg up at Summer solstice, zero for each equinox and a simple sine wave variation in between) and the axial rotation is then simply on time of day. I think I will simplify even further and only chase 9am to 3pm sun at 20 min intervals - 18 movements of 5deg so I won't be more than 2.5deg off perpendicular.<br>I'm still interested in anyone's thoughts ...</p>
<p>Hi geo bruce,</p><p>What server have you used to upload the data? can you provide a link of that please?</p>
<p>While this way of tracking is precise, it depends too much on digital subsystems that can fail, causing the entire thing to stop tracking. </p><p>Alternately, consider a mechanical/analog system that is based on differences in heat. Such a system uses the weight of a fluid in a closed loop system that is seeking to constantly equalize itself. As fluid heats up in one chamber, it pushes the fluid through tubes into another chamber. The balance point is constantly reached due to heat differences between chambers. The chambers are balanced whenever the panel is looking directly at the sun, since the amount of energy reaching both chambers is equal. If unequal, the side receiveing the most energy heats up, sending fluid into the other chamber to keep equilibrium equal. </p><p>The chambers are on a lever witha balanced fulcrum point that pushes microswitches at the ends of the lever arm. These switches are wired to the axis motors. As long as weight in the chambers are equal, the lever is perpendicular to the axis. Whenout of balance, the lever trips the switches, causing the panel to move.</p>
Of course fluids can leak, freeze or degrade/decompose. You can also measure the power generation by using the panel's current to heat something and get on the roof every 15 minutes to read the mercury thermometer and write it in your little black lab book with a nice sharp pencil (you can still get these if you know where to look). The heater will only lower the system's efficiency by about 50%. All of this require complex pipework. But hey, if you want all such complexity, be my guest! The whole point with arduino/esp is that it is so much easier. <br><br>Eco, I think yours is a job well done! Congrats! <br><br>BTW, your English is much better than most people's Finnish.
What was the total cost of these components and which panels manufactured by who at what cost ? Liked it...
If this is not an instruction on how to build this, what are you doing on this site? Not sure if you took notice but it's not called ideables!
<p>I've added technical drawings with measurements to this instructable.<br>So now everybody should be able to make a copy of this project.</p>
<p>Actually if you look closer, you will find all the details on how to build this thing. And if you were looking for some dumb step by step explanation that you might have used to make light bulbs switch on and off, then you will never be capable of building something of this size. </p>
Nice project, I am also building a solar tracker but I am not using light sensors. I will use astronomical calculations. Apart from that It will be similar so thank you for sharing.
Sounds cool, How will it determine it's exact location and orientation? Or are that parameters that will be hard coded?<br>
Well, im using what is called &quot;solar equations&quot; to know where the sun will be in a specific date and time for about 15 days. Using these equations and scilab or matlab I will calculate the angles. I am still thinking wheter I should calculate all the angles and save them in a eeprom for their comparison or design an algoritm that makes the calculations in real time both options based on a RTC such as a DS1307.
<p>I've already done it. I have built both a sun tracker and a moon tracker. All the formulas can be found in a book called &quot;Astronomical Algorithms&quot; by Jean Meeus. (And there are several other good books on the subject) Its all based on the Julian date system. Make sure you use a 32 bit microcontroller with floating point support such as STM32F103 because it's way too much math for an Arduino.</p>
<p>I have done astronomical calculations for a solar tracker too. I just used an Arduino pro mini along with a DS3231 accurate clock, that is more than enough computing power. see </p><p>https://youtu.be/vtVQ-U-DIPw?list=PLvwSEOUrC3V2ZoxLDbHDaQ-8YJWbLEHEh</p>
Im using an atmega32 for my project with avr-gcc compiler, thanks for the video.
That's amazing, I will look for that book thanks for the advice.
<p>Your 'calculation' method might be more accurate on cloudy days? Opinion?</p><p>Is your approach involving 'tables' , or are you actualoly doing astronomical calc's ??</p>
<p>Hey, I graduated from there 2012 :) and probably brought first arduino to premises around 2009. Nice to see that positive mood for projects on them have grown since then. </p>
Smart piece of kit, well done
<p>I really appreciate your posting your work. I returned the favor and voted for this project under the 3D printer contest. Best wishes and Good Luck. Cheers.</p>
Thank you very much! If you've any questions feel free to ask!
<p>Hello! What part of produced energy you use for move your tracker?</p>
<p>The stall current of 1 motor is 3A @ 12V but in normal use it only takes 0.6A in this setup. And the motor in not constantly turned on, only for very short periods of time.</p>
<p>Hi Canyonman,</p><p>You could adapt this to track satellites as the concept is the same, however the detection of the satellite and keep it centered would be difficult. You might want to look up radiosonde equipment to do this. I worked on one system many years ago that would follow radiosonde balloons for miles. The concept is the same, just different.</p>
<p>Is there a way to make this tracker follow satellite orbits by using manual tracking inputs. I use Ham Radio to &quot;Bounce&quot; messages off of satellites. I hold my antenna by hand now but it takes three hands to get it all done let alone have brain enough to transmit the info.</p>
<p>There was an article similar to this in Popular Electronics in the late 60's or early 70's. It was all analog, used a wheatstone bridge (if I remember correctly) and H-bridges to drive the motors. Super simple and reliable. The sensors were photocells on a flat board with two pieces of PCB shielding each photocell from the others. The idea was that when the sun was fully illuminating all the photocells, the system would stop moving. It worked well and was simple following the KISS engineering principle. I am surprised at how complicated things have become to do simple things in the last few years!</p><p>Don't get me wrong, I think this project is terrific.</p>
Thank you!<br><br>I've been thinking about designing this with only analog components. Which isn't that hard at all, as you say. But if you want to add the internet connectivity it gets very complex very fast.<br><br>But maybe one day I'll make one using only analog components.
Geo, good job. One correction: in step 4 you refer to hysteresis, but I think you mean deadband.
I looked up what deadband exactly is. But I it's not exactly the same. Wikipedia: &quot;In electronics, a Schmitt trigger is a comparator circuit with hysteresis implemented&quot;&nbsp;<br> <br> https://en.wikipedia.org/wiki/Schmitt_trigger<br> <br> thank you for the feedback!<br> <br>
<p>This looks and sounds fantastic. Seeing the length and engineering involved do you offer services of manufacturing one and selling it for those not having the time to build one themselves?</p>
<p>I appreciatie your enthusiasm for our project. But were are both students and we don't have the equipment to build another one. But it wasn't that hard to do it so there might be someone else who could build one for you.<br><br>Good luck!</p>
<p>that looks like a lot of work.simpler. extend small solar panel on arms on all four ends. partially shade each and run currents through gate controlled semi conductors to x and y axes servo motors on gimbaled stand or x and y motors independently. on error, default to neutral position or preset dawn.</p><p>when not enough light to power motors unit will stop operating until light powers it up again.</p>
<p>I did something like this a few years ago http://quixand.co.uk/?p=6</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:Dual axis solar tracker with online energy monitor High Speed Photography Arduino Internet Controlled Desk Lamp 
Add instructable to: