You do like to play with PV-cells? Many people have them, sitting on their rooftops, fixed, or hobbyists use them for smaller projects. But when fixed, they only get maximum output as the sun aligns with the panels.
So this is an "experimental" SunFollower. A small device that always searches for the direction from where the brightest light comes.
Step 1: Simple, But Working...
First, the tools I used to make it.
We need an Arduino,
4 resistors 1k
some cardboard (I used the sheet 2mm thick-from an art shop)
a cutter (sharp one, so prepare yourself, band-aids could come in handy)
A little piece of pcb board
Angled connector, and soldering equipment.
Step 2: Wiring Is Simple...
The set up is very easy: you just need the four Light depended resistors and de four resistors to make an analogue input.
The breadboard view is how to connect them to the Arduino, the schematic shows how the resistors work.
First, we connect the LDR to the positive of the power, through the second resistor we go to mass. The "output" in the middle gives us the connection to the analog in. How it works?
The more light that comes on the LDR, the lower the resistance-value will be, the closer the output will go to the +5V.
When almost dark, the value of the LDR is so high, that the output will near 0V.
in a small formula: VIn = Vout x (Rldr/ R1 + Rldr)
So, if our Rldr = 3k and R1 is 1K, then our output will be 5V x (3/4) or 5x 0.75 = 3.75V.
We can translate that to Arduino: Output = 1023 x 0.75 = 767,25. If we use "int", our value on A0 would be 767. When it's dark, Rldr would be very high, so A0 would be low.
Step 3: Programming...
Something more about our analog inputs. We measure all four of the LDR's.
In the program we map the values, as it is not necessary to use the entire value: since our servos start at 90°, we only need 90° in each direction to make them run.
This is done like this: a = map (a,0,1023,0,90);
This gives a more stable readout, and easier to send the values to the servos. with this, we can use it straight as an output-value.
On the experimental board, as shown in the picture, you see the cardboard "cells". These take care of it that the ldr's can actually read the differences of the light. I use only one of them as a reference (top, left). In the program we first measure the difference between top left and top right, this gives us the "left-to-right" swing. Then we use the difference between the top left and bottom left,given us the tilt. (I still wonder why I used the 4th one...).
On the bottom, I hot-glued one of the arms for the servo.
Step 4: Mechanical... and Some Calibrating...
So, this is how it looks...
I just glued the two servos together.
Because of the position, resistor values and tolerance of the resistors, it is quite sure that the values on the three (or actually four) analog inputs are not the same. So it did use some simple calibration.
Therefore you can find the "Serial.print' in the program: it just sends data to the serial screen... They can be omitted as the program runs.
The ideal weather to calibrate, is when overcast: the light is then similar in all directions. So all inputs should read the same value. Some + or - in the program, and it's done.
I also set some delay at the end of the loop: just to calm down the servos a bit. If not, a little shake would make the motors run again, and again, and...
I hope you enjoy it :-)