Sun-Tracking Cell Phone Charger
My main project is a sun tracking cell phone charger. I used a solar panel that rotates throughout the day to follow the Sun’s path while charging a mobile phone. I completed this project using an Arduino, Servo, boost converter, and solar panel.
Engineer
Brooke S.
Area of Interest
Environmental Engineering
School
Los Altos High School
Grade
Incoming Junior
Starter Project: MintyBoost
MintyBoost Materials
- Circuit board
- 2 x AA Battery Holder
- USB Type A Female Jack
- 10-22uH power inductor, at least 1A current capability
- Schottky Diode
- 100K 1/4W 5% resistor (brown black yellow gold)
- 15K 1/4W 5% resistor (brown green orange gold)
- Bypass capacitor (0.1uF)
- Power supply capacitor (100uF/6.3V or higher)
- 8-pin socket
- 5V boost converter
- 1/8W 1% 49.9K resistor (yellow white white red brown)
- 1/8W 1% 75K resistor (violet green black red brown)
- 1/8W 5% 3.3K resistor (orange orange red gold)
First Milestone
My first milestone is building the circuit for my project. To build my circuit, I used jumper wires, an Arduino, resistors, LDRs (light dependent resistors), a breadboard, a Servo, and a battery to power the Servo. The biggest challenge I faced was ensuring that everything was connected in the right places and getting both photoresistors to work. I had to modify my code to get both to function. In this video I have already built my wooden stand and filmed the video afterwards. A key component in my circuit is the breadboard. A breadboard is a plastic board with hundreds of small holes in it to be used for prototyping when building a circuit. Because this one is solderless, it is easy to add and remove components. Metal inside of the breadboard allows for current to pass through and connect a circuit. On the edges of the breadboard are symbols and numbers. The plus sign means positive, or power and the minus sign means negative or ground. These are important when connecting a power supply like a battery. The image below shows the connections in a breadboard.
Using a Servo was also crucial for my project. Inside of the Servo, there is a DC motor, potentiometer, and a control circuit. Gears attach the motor to the arms on the outside of the Servo. The resistance in the potentiometer changes so that the control circuit is able to determine how much the motor is moving and in which direction. A potentiometer has various other functions as well; it can also work as a voltage divider so that it can convert a large voltage into a smaller one.
Circuit Image
Second Milestone
Solar Panel Stand Image
Final Milestone
Demo Night
Resources
Sun Tracking Feature Code
#include <Servo.h> int pos = 0; Servo servo; int dark = 200; int light = 400; int servoSet = 100; int difference = 10; int eLDRPin = A0; int eastLDR = 0; int westLDR = 0; void setup() { Serial.begin(9600); servo.write(pos); servo.attach(9); } void loop() { delay(50); eastLDR = analogRead(eLDRPin); westLDR = analogRead(wLDRPin); if (eastLDR < light && westLDR < light) { while (servoSet <= 180 && servoSet >= 0) { servo.write(servoSet); delay(10); } } difference = eastLDR - westLDR ; if (difference > 10) { if (servoSet <= 180) { servoSet ++; servo.write(servoSet); } } else if (difference < -10) { if (servoSet >= 0) { servoSet – ; servo.write(servoSet); } } }
Servo Sweep Code
/* Sweep by BARRAGAN <http://barraganstudio.com> This example code is in the public domain. modified 8 Nov 2013 by Scott Fitzgerald http://www.arduino.cc/en/Tutorial/Sweep */ #include <Servo.h> Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo position void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }
Servo Initial Position Code
#include <Servo.h> Servo myservo1; // Create a servo object to control the servo int pos = 90; void setup() { myservo1.attach(9); //attaches the servo object to PWM pin 9 } void loop() { myservo1.write(pos);}