Solar power is energy that is produced from the sun, unlike typical energy sources which use fossil fuels. Fossil fuels are a non-renewable energy source, so as they are used they are depleted from the Earth. Solar power provides many benefits that enhance our quality of life.
With the rising fuel prices I decided to purchase a Piaggio Scooter to ride back and forth to school on in nice weather. Living in Ohio I only get about 6 months out of the year that I can ride it however it’s still a big savings for me. During the winter months when you have to store your scooter unless you plug your battery into a wall tender when spring comes you will find your scooter not starting. Looking for ways to save even more I set out to build something that would charge my scooter and not raise my electricity bill in the process. The solution was to have a solar panel outside of my garage do the work for me.
You can view a larger photo on my Flickr page which will help to show the hook ups. For the Arduino, I am using one that I created on a breadboard, you can follow this tutorial if you would like to do the same.
Arduino Solar Tracker
This is my initial testing of the Arduino Solar Tracker. I am going to need to also create a shunt regulator, so that when the battery is fully charged it won’t over charge. The charging ability will basically shut off until the battery drops down to a certain level. I picked up a nice solar panel at Harbour Freight, if you have a local store near you check there first because it may be cheaper in store than from the web.
The next step will be to build a bracket outside my garage that can hold the solar panel and be able to move as the sun moves across the sky.
I will post more information as I complete each piece of this project. For now, here is what you will need to do in order to get the Arduino Solar Tracker portion set up. Orignial credit to Stigern.net for the concept.
For testing purposes I used two small photoresistors, but the final project will use two giant cds cells.
What you will need:
- (2) Photoresistors
- (2) 470 Ohms resistors
- (1) Servo
- Hook-up wire
- Breadboard
Hook-up
Breadboard Power. In my set up photo above, I used two small half sized breadboards. Then I just jumped power and GND to the second one.
Servo Power. The red wire goes to 5V, the black wire goes to GND, and depending on your servo the yellow or white wire will go to arduino pin 9.
Photocell Circuit:
The photocells are hooked up as 5v to leg one, then on leg two you will have leg one of the 470 Ohm resistor and a connection to arduino pin 0. The other leg of the resistor goes to GND. Do the same for the second photocell but it will connect to arduino pin 1.
Arduino Sketch File:
-
#include
-
-
Servo myservo;
-
-
int pos = 0; // Variable to store the servo position.
-
int inputPhotoLeft = 1; // Easier to read, instead of just 1 or 0.
-
int inputPhotoRight = 0;
-
-
int Left = 0; // Store readings from the photoresistors.
-
int Right = 0; // Store readings from the photoresistors.
-
-
void setup()
-
{
-
myservo.attach(9); // Attach servo to pin 9.
-
}
-
-
void loop()
-
{
-
// Reads the values from the photoresistors to the Left and Right variables.
-
Left = analogRead(inputPhotoLeft);
-
Right = analogRead(inputPhotoRight);
-
-
// Checks if right is greater than left, if so move to right.
-
if (Left > (Right +20))
-
// +20 is the deadzone, so it wont jiggle back and forth.
-
{
-
if (pos < 179)
-
pos++;
-
myservo.write(pos);
-
}
-
-
// Checks if left is greater than right, if so move to left.
-
if (Right > (Left +20))
-
// +20 is the deadzone, so it wont jiggle back and forth.
-
{
-
if (pos > 1)
-
pos -= 1;
-
myservo.write(pos);
-
}
-
-
// Added some delay, increase or decrease if you want less or more speed.
-
delay(10);
-
}








Cool project, thanks for sharing.
What is the power consumption of your arduino and the servo/stepper motor (under load)? Line losses, battery inefficiencies and fluctuating energy input (dirt, orientation, shading, clouds, night time, etc) might result in a net energy loss. Just stuff to think about, if you haven’t already.
http://en.wikipedia.org/wiki/Solar_tracker#Active_tracker
Good luck with the project. Please post an update when it is complete.
Great start of the project. I built this and in theory everything worked. In reality, I had to add a delay/slow to the servo controls to make it work without being “herky jerky”. I used a simple servo from a old RC and it worked beautifully with the arduino code. I built a really small solar cell out of a science kit, and built the physical piece out of used CDs, the servo, and some cardboard. In initial testing the Arduino board works well even with the very small solay cell size I’m using.
#include
Servo myservo;
int pos = 0; // Variable to store the servo position.
int inputPhotoLeft = 1; // Easier to read, instead of just 1 or 0.
int inputPhotoRight = 0;
int Left = 0; // Store readings from the photoresistors.
int Right = 0; // Store readings from the photoresistors.
void setup()
{
myservo.attach(9); // Attach servo to pin 9.
}
void loop()
{
// Reads the values from the photoresistors to the Left and Right variables.
Left = analogRead(inputPhotoLeft);
Right = analogRead(inputPhotoRight);
// Checks if right is greater than left, if so move to right.
if (Left > (Right +10))
// +10 is the deadzone, worked best for me.
{
if (pos (Left +10))
// +10 is the deadzone, worked best for me.
{
if (pos > 1)
pos -= 1;
myservo.write(pos);
}
// Added ALOT of delay, increase or decrease if you want less or more speed.
delay(70);
}