The project consists in building an easy & cheap photovoltaic sunflower.
The photovoltaic panel is able to direction itself towards the light thanks to the photoresistors.
A photoresistor is a light-controlled variable resistor. The resistance of a photoresistor decreases with the increase in incident light intensity. It can be used as a light-and-dark switch circuit if you measure the state by a digital reading, but in the project we will use a serial reading to obtain a relative value between 0 and 255 that indicates the light intensity that affects the photoresistance.
Step 1: Parts & Wiring
- x2 Servomotors(mounting brackets included for easy assembly)
- x4 photoresistors
- x4 20 KOhm resistors
- x1 RGB LED (common cathode)
- x1 Arduino Uno
- x1 Breadboard
- x18 M/M wires
- x1 solar panel
I built my solar panel by disassembling cheap garden lamps and welding the panels in series. You can find the lamps at the following link: Solar lights garden.
Step 2: How It Work:
The logic of the program is quite simple: once the serial value of each photoresistance is measured in the void setup(), the arithmetic average of the four values is calculated: this value is the equivalent of the average light intensity affecting the panel, and is the reference value on which the entire program is based.
In the void loop () a continuous serial measurement of the four photoresistors values is performed. In order to allow the panel to follow the sun along the Y axis, the average value of the photoresistors A0 -A1 (stored in down_averageD) and A2-A3 (stored in up_averageD) is calculated. Afterwards, with an "if" is asked if "down_averageD > up_averageD". If it is true then the panel receives more light from the photoresistors A0-A1, so it will have to move upwards, if the opposite is true. The same process is repeated for the X axia taking into consideration the pairs of photoresistors A0-A2 and A1-A3.
The RGB LED switches its color from red to green depending on the amount of average light measured by the four photoresistors in the void loop, indicating the amount of energy produced by the panel.
Step 3: Code & Structure
The structure is handmade:
To keep the servomotors I bought some low-cost metal brackets that I successively bent using a clamp and a hammer. The servomotors must be mounted on the other at an angle of 90 degrees so that they can move one along the X axis and the other along the Y axis.
As a base I used a piece of plexiglass on which I set the breadboard.
Now you just have to download the .ino file, upload into your Arduino Uno et voilà, project completed :)