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.
Ingredients:
- 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!
- An Imperial short ton of cardboard!
- Arduino
- I used the awesome Freeduino (ATmega 328)
- A breadboard
- 2 Servos
For more detail: Fun Sun-tracking Arduino