Introduction: Fun Sun-tracking Arduino

The Just-For-Fun Sun-tracker

             using the Arduino and two servos.

        This device, along the lines of the most useless toy, is not so much for function as it is for fun. But as with many things, you can't spell function without fun! This could easily be modified to rotate solar panels into the right position for the best solar power absorption.


  • An Imperial short ton of cardboard!
  • Arduino
    • I used the awesome Freeduino (ATmega 328)
  • A breadboard
  • 2 Servos - The kind/company doesn't matter terribly, you’ll just have to change the code a little if it’s too different
  • A lot of wire, almost as much as the cardboard
  • Some sheets of paper, any kind will do 
  • A knife, preferably a box-cutter - you’ll be cutting a lot of cardboard!
    • I used: This One
    • Also, be careful! Don't cut yourself as I have done
  • Circular drawing tool – Either a compass, Tupperware, or a ball and cup
  • Hot glue gun – Though you can use nuts/bolts, glue is much easier
  • Silly putty, presstick, or sticky tack 
  • Some nuts, bolts and washers. Depending on how much glue you want to use.

Step 1: The Sensor Array

For this part you will need:
  • 5 Sheets of paper
  • 5 Photo-Resisitors
  • 5 Pieces of putty / presstick / sticky tack
  • Compass / Protractor
  • Scissors / Knife
  • Wire / Strippers / Cutters

   - The sensors are positioned to form a cross to allow sensing in the x and y axis. It is possible to do this with as few as 3, but photoristors are so cheap that an extra 2 won't bust the bank. These sensors will sit inside cones to reduce the light that isn't shining directly at the resistors, thus making the sensing a lot more accurate.

   - To make a cone, you must take your trusty compass or any other circle transfer tool and make a perfect circle on one of the sheets of paper. The size of the circle will adjust the accuracy and contrast of the photo-resistors; bigger circles will result in bigger cones, stopping indirect light more.
   - Next, take your scissors/knife and cut out the circle you drew. Once you have the circle cut out, cut a line straight from the outside edge of the circle to its exact centre.

   - At this point you may either opt to cut a small circle out of the middle (to leave a hole at the bottom of the cone) or you can leave it uncut, in which case you will be poking holes in the paper for the leads of the photoristors. (as i have done)

   - Now you need to take the circles and turn them into cones!  All you do is take the ends of the circle (where you cut the straight line) and move them into each other. Rotate further to tighten the cone, I find a 30 degree opening to be best.

   - After you have your cones. Take some of the putty/sticky tack and roll it into a tiny cone shapes, this will sit at the bottom of your cones and hold your photorestors in place and they should be smaller than the length of the leads on the photorestors. Once you have all your sticky tack cones, take your photorestors and get the leads through the putty/sticky tack. The leads should poke out of the bottom about half a finger's width or more.

   - All that's left is to get your putty & resistor combo into your cone. Poke holes for the leads if you need to; though they tend to be soft, so use a sharp tool, like the one end of your compass.
   - You can now opt to stick the cones together like I have, or simply leave them loose if you plan on cutting individual mounting holes for the cones.

   - All that need to be done now is to wire the suckers. Remember to use long enough wires for this part, you can always cut them shorter, but you can never grow them back!
   - Take one lead from each of the pins and either solder them straight to wires, in which case you will have to remove them from the cones or risk losing an eyebrow, or do what I did, and solder wires to some female to male pins and then you can just plug the leads into them!
   - It helps at this point to think about where the other wires will be going on the breadboard. They need to be lined up on the breadboard from left to right C.R.L.U.D. (Centre Right Left Up Down). As with the other leads, solder them directly on to the wire or make the plugs.

Step 2: The Circuit

   It is time to wire everything together!

You will need for this step:
  • Your array from the previous step
  • Breadboard and Arduino
  • Regular 10-30kOhm resistors
  • The Servos
  • Wire / Strippers / Cutters

   Essentially you are replicating the image below.

    - Place the Arduino on one end of the breadboard, I chose to tape mine down with electric tape so I don't knock my wires out or something like that, just remember to poke holes through the tape for your wires if it goes over any of the pins.
   - Run a wire from the gnd and 5V pins to the ground and source lanes of your breadboard respectively. I also like to connect the source/ground lanes on one side of the board to the other, but that is just preference.
   - Place your 22kOhm resisitors as shown, going from one lane each to ground. I snipped my leads so that they fit snugly on the breadboard. Then on the same lanes as your resistors, run 5 wires (1 for each resistor) to analog pins 0 to 4 as shown; it helps to keep it organised. The resistors will help to divide the voltage and gives a good reference point.

   - The servos are next. The wires coming from the servo will vary depending on make and model, but it's usually safe to assume the red is power, the black is ground, and the wire that's left is the signal. The middle pin is, as far as I know, always the power. The signal wire can be white, grey, orange, and yellow. Sometimes there will be 2 black wires and a grey one. The unique wire is the signal, the middle is the power, and the other is the ground. The servos go into source, ground, and the signal wires go into pins 11(for x values) and 10(for y values).

   - Last but not least, the photorestors must be plugged in. If you followed the last step and lined up your photorestors in C.R.L.U.D. order, just stick them into the same lanes as the resistors and Arduino analog pins. The red wires coming from the other leads of the photorestors simply go straight into the source(red) lane.

 - At this point the circuit should be functional. Get the code from the last steps and see if it works!

Step 3: Cardboard! the Base

   For the base, it is best to make it as stable and heavy as possible. The wider and heavier the base, the less your solar tracking toy will jerk around and potentially fall over. You can use any shape of base you want, but I find the best configuration is either circular (like mine) or square.

   The First cut: A circle or square piece of cardboard roughly the size of what you will be mounting about it or bigger; this piece will be the very bottom, your motor resting right on it.Take your servo and place it on top of that piece of cardboard. Note how many layers of cardboard, stacked one on top of the other, would reach the bottom of the servo's blades.

This is important!

If there's too many layers, then the rotating piece won't rest on the blades of the servo, too few layers and the rotating piece will wobble and fall off the servo. Don't glue the top 2 layers till you know how many layers you need.

   You will need to cut a slot in the middle of the each of the subsequent cardboard pieces so that the servo can fit snugly inside the base. Remember to cut a notch where the wire is. Though it is important to make the base sturdy, you can also use strips of cardboard for every second layer instead of an entire circle, saves you some time and effort while not compromising the integrity.

Step 4: Cardboard! the Head (Cone Mount)

   Now we shall be moving on the the top/outer shell of the sun-tracker deluxe.
   For this I used a spare Digi-Key box that suited my needs. Most of the project was driven by the materials available, which I like to encourage! Be creative with it. You could also take 5 pieces and fashion yourself a makeshift box, but that seems like too much effort really. It should be a bit larger than the sensor array. A larger box will be a bit more difficult to to handle, but that's not a problem if the base is large enough.

   To mount the array on the box you can either cut a shape roughly similar to what I have in the photos (if you stuck the array together) or you can make 5 separate holes for your cones. It should be placed in the centre, obviously.

   To make the top complete, you need to cut another piece of cardboard. It should be about an 2 inches longer than the width of the box to give you something to stick/screw to the box as shown in the 3rd image. It helps to stick another layer of cardboard on this piece to help strengthen the box. *points to 4th image*

BAM! You're done with the helmet.

Step 5: Cardboard! Servo Y and Legs

   Now you need to build a piece to hold the Y position servo in place and with enough clearance between the blades and the brace from the previous step so that you can fit an attachment on it (see next step if you are confused)
   All I did was tack a square piece of cardboard about twice the size of the servo and cut a whole in the centre to put the bottom of the servo through. After that, I cut out a thin strip of cardboard to allow it to bend smoothly over like in the picture. This held my servo in place and gave me a surface to screw into the brace with.
   The blades of the servo should be roughly in the centre of the brace, it isn't a matter of life or death, but you could have some bugs if they aren't centred properly.
Remember to give the motor enough clearance!

   Cut 2 pieces of cardboard that look like the images below. The hole in the middle needs to be big enough to allow the cross brace from the previous step to fit inside with the blades of a mounted servo in the centre. (The images explain it a bit better.) Even with the blades at the centre there should be a little bit of clearance between the brace and the edge of the circle so that it doesn't get stuck during normal operation.

   Once you have that, you will need some stability in the legs. Cut two pieces of cardboard about an inch bigger than the width of your box (this includes the flappies to put screws through.) As with the previous brace, put one or two extra slices of cardboard on to these to provide strength, they will need it most of all, since you'll be using these to hold the weight of the helmet. The braces should be placed as close to the top as possible, otherwise they will limit the range of motion of your suntracker.

Step 6: Cardboard! at Last, Fini!

   This last part of the inside cardboard fun is probably the most difficult part of this entire project. Getting it right will be partially luck and partially skill, with a good amount of trial and error for good measure. If you think about it and plan it out, you should get it in the first shot, but don't be disheartened if you need to redo it.

  The images in this case help a lot, so look closely at them if you need to. You first need to create a circle. It should be larger than the blades of the servo, but small enough that it doesn't scrape against the bottom brace. (on which the servo is attached) After you have made the right size circle of cardboard, make 2 more! These two will make a holder for your servo blades. Cut the holes in these two to match the blades of your servo. Note: if your servo has no blades, it should still have small holes to put screws into, in which case you will be cutting another circle out of them. 
   Glue these three pieces together and confirm they are the right size by sticking them onto your servo and moving it with the cardboard.

   The only missing pieces now are the cardboard arms that hold your servo mount in the middle of the hole in your sun-tracker's legs. At this point it helps to attach your two top braces and to stick your bottom brace with the Y servo through the holes in the legs and get your positioning right. Remember, the brace needs to float through its entire range of motion. The arm pieces should be thinner than your servo mount circle and about double the length from the centre of the legs' holes to the braces. if you cut it exactly double, simply put a notch in the middle for a bend and away you go. Otherwise you will have to measure the distance or eyeball it correctly. Again, the images should be relatively self explanatory.

   You're now ready to screw the head of your tracker onto your bottom brace and marvel at your creation!

Step 7: Cardboard! I Lied

   This will be the last piece of cardboard you will need to cut. It will be the part that your feet attach to and the part that your X servo will spin around. You need two pieces the same size as your base.

   For the both pieces you need to cut a circular strip where your wire will come through as shown. It shouldn't be all the way around though, since that would defeat the purpose. On the bottom piece, cut out a shape like in the previous step to allow the servo blades to turn your tracker.
   Now glue both pieces together, make sure there's a good seal all around the edges. This will allow you to cut out strips for the legs, which you must now do. Do it! Don't cut through both pieces, just the top layer. All you need to do is make sure the legs are perfectly upright when you stick them into those strips. You can also put a cardboard angle to help support the legs, but that is optional.

It is complete!
Just remember to hook any connections back up that you removed to put it all together and you should be set.

Step 8: The Code

Attached to this step is a txt file with the code and the Arduino file.
Just upload it to your Arduino and run it.

Any problems? Don't hesitate to leave a comical yet concise comment.

Epilog Challenge

Participated in the
Epilog Challenge

Craftsman Tools Contest

Participated in the
Craftsman Tools Contest