Intro: Sun Follower Solar Panel
Have you ever wondered how the sunflower manages to follow the sun and point it’s direction wherever it goes. This is a system that resembles very much with a sunflower, following a source of light and pointing to its direction.
The system could be manufactured by using a 3D printer, but we will focus on using items commonly found in most households, since not so many people own a 3D printer.
- Arduino UNO or some arduino compatible board;
- 2 x Servo motors;
- Jumper Wires;
- 4 x Photoresistors (LDRs);
- 4 x 10k resistors;
- Some cardboard and something to cut it (a cutter);
- Metal paperclips;
- Hot glue or other something to help assemble the pieces.
Step 1: Mechancal and Hardware Setup
1.Following the annotated picture cut out of cardboard or other DIY material you have the required parts and glue them together;
2.Attach the servo motors to the system where indicated by the green arrows (one servo turns the whole system horizontally and the other turns the solar panel and sensor “cross” vertically);
3.Place the 4 LDRs on the “cross” like indicated by the red hexagons;
4.HINT: Connect the solar panel to the side walls and the servo motor using metal paperclips (like indicated by the yellow circles);
P.S. There's also a photo of the 3d printed version, it might help you.
- follow the connection schematic in the image!
1.Connect a jumper wire between 5V pinout from Arduino board and one pin of each LDR;
2.The other pin of each LDR has to be connected to a pin of the resistor;
3.The free pin of each resistor has to be connected to a jumper wire and through that to the GND pin on Arduino;
4.Between each LDR-resistor pair connect a jumper wire and the other end to one of the ANALOG Arduino inputs;
5.Each servo motor has three wires: VCC, GND, COMMAND;
6.Connect the VCC of each servo to the 5V pin from Arduino;
7.Connect the GND of each servo to the GND pin from Arduino;
8.Connect the COMMAND of each servo to a pwm enabled pin (pwm enabled pins have “~” in fron of the number) from Arduino;
Step 2: Software Setup
1.Install Arduino IDE, from following link: https://www.arduino.cc/en/main/software
2.Click on Windows installer
3.Click on JUST DOWNLOAD
4.After download is complete, click on RUN button
5.Click on I Agree button (Arduino IDE is a free software)
6.Select all components from the list and click on Next button
7.Proceed with the installation after selecting the desired location
8.Install driver “Adafruit Industries LLC Ports”, by clicking on Install button
9.Install driver Arduino USB Driver” by clicking on Install button
10.Install driver “Linino Ports (COM&LPT)” by clicking on Install button
11.Press CLOSE button when installation is complete.
12.Download application file from bellow:
13.After code file (“Solar_Panel.ino”) has been downloaded, double click on it to open in Arduino IDE and press OK button to create a folder named “Solar_Panel”.
14.Select type of board from Arduino IDE menu: e.g.:Tools\Board: “Arduino/Genuino Uno”
15.Identify the communication port on which the Arduino board will communicate, by accessing Device Manager
16.Set communication port (identified at step 15), from Arduino IDE menu: e.g.: Tools\Port : COM7
At this point you can compile the code. If you upload it to the board it will probably not work as you expect it to because there are some configurations to be made.
Step 3: Software Configuration
#define THRESHOLD 15
#define DTIME 15
•THRESHOLD = Minimum and maximum change in value for which we don't move the solar panel in order to avoid vibrations and unnecessary movements;
•DTIME = Number of MILISECONDS between loop executions (proportional with the speed of the movements);
Experimentally determine parameters:
#define SENSOR_TL 3 //Top Left sensor pin
#define SENSOR_TR 1 //Top Right sensor pin #define SENSOR_BL 0 //Bottom Left sensor pin #define SENSOR_BR 2 //Bottom Right sensor pin
•Determine which sensor placed on the “cross” is connected to which analog pin on the Arduino; Hint: cover it and the read value will be way lower than the others;
#define HORIZ_PIN 9 //Specify connection pin for the horizontal servo
#define VERT_PIN 10 //Specify connection pin for the vertical servo
•Determine on which Arduino pin you connected each of the servos(vertical and horizontal);
#define HORIZ_LIMIT 180
#define VERT_LIMIT 80
•HORIZ_LIMIT – should not be changed in order to permit the horizontal servo to perform a complete 180 degree rotation;
•VERT_LIMIT – The value is determined depending on the mechanical setup (the angle at which the vertical servo keeps the panel parallel to ground);
Step 4: Data Visualization
1.Uncomment the following block of code in order to be able to visualize data read from the sensors;
// Serial.print(average_top);<br>// Serial.print(","); // Serial.print(average_bottom); // Serial.print(","); // Serial.print(average_left); // Serial.print(","); // Serial.print(average_right); // Serial.println();
2.Collected data can be displayed as a graph, from Arduino IDE menu: Tools\Serial Plotter;
3.Collected data can be displayed as numerical values, from Arduino IDE menu: Tools\Serial Monitor.
Step 5: Enjoy
Play around with the code, test it out and enjoy it! :D
M8952 made it!