Solar Tracking Robot
This is a simple robot that uses two photo resistors to track the incoming light from the sun and move to follow it. This robot could be very useful in many applications, including what its intended use as a solar panel alignment device to maximize the energy produced.
Step 1: How It Works
This system uses one of the simplest ways of tracking the sun, using 2 photo resistors to sense light. When wired up with a resistor these simple photo resistors can be turned into photo sensors which will be covered later. However with 2 photo sensors and a shade we can easily sense if the sun is inline with the device or not. One sensor in an unshaded position to gather a baseline reading on the ambient sunlight. The other will be tied to a shade and put inline with the direction we want to point. When the sun travels overhead and past the shade, it will cover the sensor and the values from these sensors will vary greatly. This prompts the servo to move until the sensor values are almost equal again. This action will keep the device pointed at the sun throughout the day, as well as checking that amount of ambient light. When the light gets low enough the servo is reset to wait for the sun the next morning. This creates a 100% autonomous solar tracking actuator.
Step 2: Hardware
In this project I used the following parts:
1. Servo gearbox assembly:
Ratio: I used the 7:1 Ratio, this will give you the most torque for your buck.
Rotation: If you have a Hitec servo programmer then you want to choose the stock rotation option and will need to program it when it comes in to get a full 180 degree range of motion. If not you can ether buy a programmer: https://www.servocity.com/dpc-11-servo-programmer or choose the option for "Max Rotation". If you have not used one, they are easy to use. Just download and install the software onto your computer and plug in your servo.
Direction: Counter Clockwise (Default)
Assembled: Here you most likely want to select "Yes" for a pre-assembled setup. If not you can assemble it yourself with full instructions, although it is very involved including: soldering wires to an external potentiometer, removing the mechanical stops, and mounting everything together.
2. Chanel Bracket C: 585480
3. 90 Degree Hub Mount A #585494
4. Socket Head Machine Screw 6-32x5/16 #632108
5. Socket Head Machine Screw 6-32x7/8 #632122
6. 1.00" Bore 32 Pitch Aluminum Hub Gear 84T #615226
7. Large Square Screw Plate #585430
Note: Items 6 & 7 are the bottom gear and screw plate for my design used only to keep the project upright and asthetics.
8. Arduino UNO, and assortment of small wires
9. 1K omhs resistors
Comes with 100, but will only need 2
10. photo resistors
Comes with 30, but will only need 2
11. Basic soldering equipment, solder, heat-shrink, flux, ect.
Step 3: Mechanical Assembly
1: The gears for the servo block will be bolted on when it arrives(If you chose the assembled option), take out the four bolts and set them aside. Using the 585494 pattern mount bolt this bracket vertically on the gear making sure the servo is centered. In my pictures I am also including my sun shade. This step will use 7/8th inch socket head screws.
Note: If the gear doesn't line up when the servo is centered, loosen the bolt on the clamp behind the main gear and rotate the shaft until it is straight and re-tighten the clamp.
2: Attach the bottom bracket 585480 with the 5/16th inch socket head screws. The direction is to your preference and specific application.
3: Bolt on the bottom plate with the 5/16th inch socket head screws using the large screw plate. Note: This sprocket is for show mostly, any flat plate or mount with a 0.770" Actobotics pattern will work here.
Step 4: Electronics
First, before we do any soldering is to get the electronics wired up to make sure everything works. With the bread board, create the circuit in the figure above making sure to use the corrct ports on the arduino. Using the two 1K resistors and photo resistors connected to the power (5V) and ground respectively we can create these sensors. With the signal wire coming from between the resistor and photo-resistor to the Arduino into ports A0 and A1.
The servo is much easier to wire up, power and ground are red and black respectivly, with the yellow(signal) going to digital port 11 on the arduino. Notice that port 11 has a ~ next to it meaning it will support PWM signal output. Once these components are bread boarded it is important to test before soldering everything together.
Step 5: Programming
The code for this project is relatively simple, I have also added comments to help if you get stuck. Install the Arduino IDE and upload this program. Read through the code comments and all should be clear. Make sure that you have wires in the correct ports.
To open the serial port in the IDE go to tools->Serial Monitor, or hit Ctrl+Shift+M this will give real time feedback on what your arduino is doing and help debug any problems. Once the program is working test to make sure that covering one sensor makes the servo move you are ready for final assembly.
Note: Only one sensor will move the servo forward so try covering them one at a time.
Step 6: Electronics 2
In the first picture we see the rough outline of how we will be assembling the final electronics. Be sure to use heat-shrink or another insulating material to keep from shorting out the board, also be sure to leave the photo resistor wires as long as possible as the sensors will be placed in slightly different places. Your final sensor should look similar to mine, with 4 wires coming out and no wires exposed.
Step 7: Sensor Mounting
Mounting the sensors is very important, if not placed correctly this project will not work. The first sensor should be placed in a location that will not be shaded and to serve as a baseline. The second needs to be placed next to a flat plane so that as the sun rotates overhead it becomes shaded. For this project I quickly drew up a sun shade and 3D printed it. However anything that is flat should work, a piece of plastic would work great as long as it will hold up in the weather and rain.
Step 8: Final Thoughts
If you are having issues with it not sensing once it is assemble, open up the serial monitor on your computer and verify the sensor values, depending on the soldering job and resistors them selves, these may need to be adjusted. To do this just change the sensitivity constant at the top of the code.
Also make sure that your sensors are in the right place, you may need to flip the signal wires.
If you have any major issues with this project please shoot me a message and I'll try to help! Enjoy!