Winter Break Projects 2: Arduino sunTracker

Small scale

My dad has had a solar panel at a semi remote camp for years. And for years, I've been thinking of building a sun tracking or device to move the panel with the sun. The panel was sitting in a tree, mostly stationary unless you wanted to move it manually. I wasn't smart enough then to tackle the idea, but I figured I had the skills now to at least attempt it.

The problem is that a stationary panel only receives maximum light for a potion of the day. To increase it's efficiency, it needs to receive direct sun for as long as the sun is visible. This can be achieved by moving the light, or by moving the panel. A heliostat is a system that moves a mirror to reflect the sun to a target. This can get tricky. It can take an array of mirrors to spread the light across a large panel. I find heliostats more useful for when the light needs to be concentrated to a smaller point, such as heating applications (solar ovens, steam generator, etc…). Heliostats also seem to be pretty complex as far as control software goes.

I wanted to be as simple as possible. I decided to devise a panel moving system. As with most of my ideas, I like to do my first prototype without reviewing other peoples designs. I could save myself a lot of time by reading about other peoples mistakes before I make them myself. However, I enjoy the brain exercise of the initial problem solving and concept development more than anything. Therefore, I like to see where I end up on my own first, warts and all.

In this case, I initially envisioned an array of photocells arranged in a arch, and angled toward the sun. As the sun traversed the sky, there would be a difference in the resistance in the photocells. This would would be interpreted by the software as a solar position, and move the panel accordingly.

I initially tested inside with artificial light. My design did't change too much, but rather than an array of photocells, I ended up with just two. First, because I only had two on hand, but when I actually put it in sunlight the cells proved very sensitive. Even pointed directly away from the sun, the ambient light was enough to have a large effect on the cell. Shrouds are necessary to keep the cells shadowed from indirect sunlight. I used blue electical tape for testing.

As a small scale test, I used a small 12V panel (about 8x10 inches) and a hobby servo. The angled panel sits on top to the servo and makes for a very wobbly design, but it does the trick for test purposes.


The circuit uses an Atmel Atmega 328, programmed via Arduino. The photocells combine with 1 Kilohm trim pots to form a pair of voltage dividers. The trim pots allow adjustment of sensitivity, and can change the physical behavior without having to hook up a computer and mess with the code. The resulting voltages are converted to 10 bit values (0-1023) by the processor ADC.

The code is similarly simple. first, the values are read from the ADC. I perform a simple subtraction, resulting in a difference from -1023 to 1023. The difference is equivalent to how bright the light is on one sensor, compared to how bright it is on the other. The code interprets this value as the position of the sun, and moves the servo to a matching degree.

This is in contrast to other approaches that actually use time to move the device, by knowing where the sun will be at any given time of the day, on any day of the year. That's some complex code, I would imagine. My approach has an advantage in the fact that it moves to the brightest location. If clouds come along, and it's actually a bit brighter to point a little away from the sun, it will do so. Also, my approach doesn't constantly turn the motor. It moves to preset positions (as many as I care to program) and waits until a different position is more appropriate. With the servo mounted vertically above the panel, one could conceivably 'release' the motor (remove power) as you would not even need voltage to maintain a stall torque. This depends heavily on the angle of you panel, and may not be possible in many situations. My design does conserve energy by parking for a shot time after moving. This means that it won't move back and forth for constantly changing brightness. Rather it will wait to see if the brightness change is likely to stay that way before moving again.

Another aspect of the code is a sleep function. When the light level on both sensors drops below a predetermined value, the panel returns to its east most setting and waits for sunrise. This keeps artificial lighting and light from a sometimes large fire from tricking the sensors after dark. I suppose filters could be used to make the sensors UV sensitive only.

My early tests were quite positive. I did learn that the full 180 degree swing of the servo is not necessary. A much smaller range is sufficient. Also, I can probably get away with only three positions (morning, noon, and afternoon), but I will start with 5 by adding 2 intermediate steps (late morning and early afternoon). Also, it is imperative that I keep the potentiometers swappable so I can change my range of adjustment if necessary. I also need to maintain a serial connection so I can monitor and adjust the code if need be. This circuit behave differently in each new environment, and need to adapt accordingly.

Of course, all of this might change drastically, as I am now ready to go see what others have done. But if anyone is interested in the schematic or code for what I have done thus far, email me and I will make those available here.

Copyright 2012, Clockbroke. Contact Me