Sun Tracker

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
Post Reply
Posts: 29
Joined: Fri Jan 23, 2015 8:32 pm

Sun Tracker

Post by Jonas » Sun Apr 12, 2015 4:13 pm

I have two 45 watts solarpanels and I want to find out the difference in watt hours if one sits facing south all day and the other is tracking the sun.

The stand is ready for the solar panel. It turns two and a half rev/min at 12 volts.
suntrackerstand (Small).JPG
suntrackerstand (Small).JPG (191.84 KiB) Viewed 6353 times
First I tried a L298n H-bridge, but never got it to work, so common relays will do the job instead.
The four LDR's are separated so if not all of them are facing the sun directly some of them will be shaded a bit and the ADC value will change.
I got this working, now it's just to figure out how to compare the values and pull the relays.
suntrackelectronics (Medium).JPG
suntrackelectronics (Medium).JPG (232.08 KiB) Viewed 6353 times
Maby I need some kind of home and/or end switch so it never can turn a full revolution, and when it gets dark it can return to home position waiting for the sun to come up the next day.
Some other ideas are to use the RTC and algorithms to track the sun, or just for compensate for the change in its wating position, I might wait with that...

But I have no clue on how to measure the energy I wish to compare. Perhaps some kind of load and measure the amps and log it over time...
How would you do the comparing of two identical panels, one always facing south and the other on a tracker?

User avatar
Posts: 3628
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: Sun Tracker

Post by dhylands » Sun Apr 12, 2015 4:33 pm

I *think* you could just measure the voltage that the panel produces. I quick test with a multimeter should confirm this.

See what the voltage is with the panel directly facing the sun and then gradually angle away and you should see the voltage drop.

Plot voltage versus time for both panels and compare.

If you want to measure current, you basically wind up measuring voltage drop across a very low value resistor (typically 0.1 or 0.01 ohms). You can also buy sensors like one of these: ... r-ICs.aspx

A resistive load will consume more current if presented with more voltage (V = I/R or I = V/R) so measuring voltage is essentially the same thing as measuring current. You'll just need a resistor divider to get the voltage down to the 0-3.3v range.

Posts: 3
Joined: Mon Feb 02, 2015 2:21 am

Re: Sun Tracker

Post by mikewop » Thu Apr 16, 2015 5:08 am

You probably should measure the output voltage while a realistic load is attached (e.g something simulating what you want to use the panels for).
In the easiest case probably just a resistor or 12v/24V light bulb (depending on the nominal output of your panels).
Also, do your panels already have a charge-controller or something like that attached or do you have direct access to the 2 wires going to the silicon cells?
Any charge controller (or a Maximum-Power-Point tracker ... llers.html) might already "process" the output voltage and thus affect your results.
The voltage of the solar panel without any load attached may be much higher than "under load" and might be too inaccurate.

It really depends on how accurate you want to measure the difference. I'd probably start with a simple resistor/light bulb and measure voltage and current through it(light bulbs are non-linear in resistance so you need to measure voltage and current to get the power). If you have a suitable resistor that can handle the current you probably only need to measure voltage or current.
Plotting that over the whole day and integrating it in suitable intervals (e.g each minute) will let you calculate the total output in Wh.


User avatar
Posts: 5066
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: Sun Tracker

Post by pythoncoder » Thu Apr 16, 2015 4:27 pm

If you're tracking on the horizontal axis only, I'd use dead reckoning with the RTC. The Sun is due South at 12:00 and travels through 360 degrees in 24 hours. So if t is the time in hours on a 24 hour clock the angle relative to South is (t -12)*360/24 degrees (clockwise). There's little point in rotating the panel once the Sun's set: while calculating rise and set times isn't hard, the lazy man's option is to use an LDR to sense that the available light is too dim. However dead reckoning does imply some method of reading the motor's position: an optical encoder or a potentiometer could be used here.

As for measuring power, whether measuring voltage alone will work depends on the characteristics of the load. Measuring voltage alone will work if the load is resistive, but if it's an electronic inverter or if you're charging batteries you'll need to measure current and voltage (with power being the product of the two).
Peter Hinch

Posts: 29
Joined: Fri Jan 23, 2015 8:32 pm

Re: Sun Tracker

Post by Jonas » Fri Apr 17, 2015 10:11 am

solcell12 (Small).JPG
solcell12 (Small).JPG (166.28 KiB) Viewed 6287 times
Thanks for your input.

The sun finally came back after hiding behind the clouds for a week. My initial tests show that I need some kind of load. The specs on the solarpanels says max 17 volt and 1 amp output, but with no load it outputs over 20 volts even when not facing the sun directly, and it drops alot when a load is applied. I think a resistor that draws 0.5 amps puts it right in the middle and will be a good place to start.
There is no other electronics on the panel then a diode, but i'm going to have a mppt later, perhaps it's possible to build one using a pyboard as a controller?

It is a two-axis, and I will spend the rest of the day trying to make it run smoothly. I would much rather use the rtc than the ldr's, but for now I'm way to new to python. (Even comparing adc-values and make the motors run is a struggle...)
But I found some info on how the sun position relates to date and time, i guess that could be used to calculate the panels position if I had some feedback from the axis. Is the rtc accurate? I think I read somewhere that it's not...
Anyhow I will look in to that later, for now it's just a simple project for me to learn from.

Posts: 9
Joined: Fri Apr 17, 2015 4:22 pm
Location: Anchorage, Alaska

Re: Sun Tracker

Post by moose » Fri Apr 17, 2015 4:44 pm

Great project! The "short-circuit current" of a solar panel is linearly related to the amount of solar radiation incident on the panel. So, it would be most accurate to place a dead short across the panel and then measure the current. However, it's a bit of a pain to measure current; here is a breakout board from Adafruit that will translate a current into a easily measured voltage:

The route you're on by just adding a load resistor across the panel and then measuring the voltage across that resistor is simpler than the Adafruit board and still can give accurate results as long as you keep the voltage across the load resistor small relative to the open circuit voltage of the panel. Then, you have not-quite-a-short-circuit, but good enough for what you're up to. For example if you put a resistor across the panel that produces a voltage of 3 Volts in peak sunlight, that is reasonably small relative to the panel's open circuit voltage of 20 volts, and the voltage you measure will be proportional to short-circuit current and proportional to incident solar, which is what you're after.

Here is a great article on this approach: Because you will need a relatively small load resistor, he suggests using a length of wire as the resistor. If you shoot for 0 - 3 Volts of voltage across the load, you'll be able to measure it directly with an ADC pin on the pyboard, which measures 0 - 3.3 V. You'll want to do some calibration between your two panels by facing them the same direction and observing the readings, which ideally should be equal (but won't be due to slight panel and measurement differences).

Be careful with the power (heat) dissipated by the load resistor. You said your panel puts out about 1 amp at 17 volts. It will put out somewhat more current at near-short-circuit conditions. Under peak sun, you'll be dissipating roughly 3 Volts * 1.1 amp = 3.3 Watts, so your load resistor needs to be rated that high (using wire for the load will probably be fine at that level of power dissipation). The load resistor needs to be roughly 3 V / 1.1 A = 2.7 ohms.

User avatar
Posts: 5
Joined: Wed Sep 24, 2014 2:29 pm
Location: Fremont California

Re: Sun Tracker

Post by Tage » Sat Apr 18, 2015 3:23 pm

good advice, the short circuit current is proportional to the amount of sunlight that hits the panel. so the best way to measure is to connect a resistor to the wires and measure the voltage drop. if the panel is small you can just connect a number of 15 ohm "1/4W" resistors in parallel to get low enough voltage drop you can connect to the ADC input. For example, five resistors per ampere of short circuit current. the 1/4W common type of resistor with leads can actually handle 0.6W each. ... iance.html
there are online calculators that show the average amount of sunshine in different parts of the world, and also show the effect of tilting the panel in different ways. it might be cool to compare your measurements with estimates from the link above.

Posts: 29
Joined: Fri Jan 23, 2015 8:32 pm

Re: Sun Tracker

Post by Jonas » Sat Apr 18, 2015 6:19 pm

I wasn't sure about doing a short circuit, thought it might damage the panel.
I have some NiCr wire, to wind my own resistors, making it easy to calibrate them to each panel.(I think)

Post Reply