We have had a sunshine meter since 2000, made by my
dear friend and neighbour Jeff, but it sadly developed a fault
earlier this year. Electronics has moved on since 2000 and I
thought I could make use of more modern pieces of kit now available.
So here are the details of the Sunshine Hours
Recorder that I have made for less than 50.
It is very easy to assemble hopefully all you need to know will be
listed here.
It works on the basic premise that sunshine produces
shadows no shadows, no sunshine.
There are therefore two sensors mounted vertically, one on each side of a
vertical board. The
board is aligned such that one sensor faces the sun, while the other faces away
from the sun but is shaded by the board at all times.
On a dull day both sensors give similar readings.
On a bright but not sunny day there is a noticeable difference between
the readings. When the
sun is out there is a considerable difference between the readings and the
machine is set up to start counting when this difference reaches a preset (but
adjustable) figure. I have set
this preset figure by observation here in Cornwall it can easily be adjusted
if necessary for elsewhere in the country or the world for that matter.
The components are as follows:-
The sensors are Light Dependent Resistors (LDRs), whose
resistance
drops as the light increases.
These feed (via a voltage divider don t panic very,
very simple) to an Arduino Uno.
This is a very small and cheap microcontroller essentially a very basic
computer. The Arduino
project is an Open Source project basically aimed at providing a cheap way for
youngsters to learn computer programming.
As it is Open Source everything is open for anyone to develop in whatever
direction they wish .The Arduino Uno from the makers will cost 20 but clones
are available quite legally on EBay for 5.
Anyway the Arduino converts the current from the two sensors to binary
and gives a readout between 0 and 1024.
A very simple piece of programme code, which I will list later, then
tells the Arduino if the value from the sunny side is greater than the value
from the shady side plus a constant, to start the hour counter running.
If the sunny side is less than the shady side plus the constant the
counter does not run. Very
simple.
The hour counter is the most expensive piece of kit at
about 20.
It has to be either 12v or 5v
and be resettable which a lot are not.
The Arduino
gives a 5v output
so if the counter is 12v there has to be a 5v relay between.
The Arduino can be powered from a computer USB (you need
this anyway when you are setting it up) or from a standard 12v adapter.
The sensors can be a considerable distance from the Arduino connected by
telephone cable or CAT5 cable.
Now in more detail.
Initially I set this up using a breadboard or prototype
board. This is a piece of
plastic with rows of holes which are connected together in groups and you just
push the wires or ends of components into the holes, doing away with the need
for soldering and the components can be changed or re-used at will.
This is the circuit diagram ( a bit hybrid to show the
Arduino and relay) :-
This is how the prototype looked, using a breadboard:-
The sensors (LDRs) are mounted on the apex of the roof in
an enclosure made mainly from 12mm exterior plywood.
There is approx..30m of cable between the sensors and the main unit.
The sensors have to be protected from the rain but not
stopped from reading the ambient light levels.
I fashioned a transparent cover made from an old piece of clear Perspex
which can easily be bent with the aid of a heat gun I guess a hair dryer would
also serve the purpose.
The final version of the main unit is housed in a plastic
box measuring 140mm long x 80mm wide x 60mm deep.
The small number of connections needed can all be done with 3 amp cable
connection strips if you don t like soldering.
To get all this to work you need to download the latest
Arduino IDE to you PC or laptop, connect the Arduino with a USB cable, click on
File and New and copy the following code ( called a sketch in Arduino talk).
You then upload this to your Arduino.
This is the Sketch:-
int sensor1Pin = A0; // pin that the sensor is attached to int sensor2Pin = A1; int relayPin = 8; // pin that the relay is attached to int ledPin = 13; int sensor1Value = 0; int sensor2Value = 0; int sunval = 0; void setup() { // initialize the relay pin as an output: pinMode(relayPin, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { // read the value of the potentiometer: sensor1Value = analogRead(sensor1Pin); sensor1Value = analogRead(sensor1Pin); delay(200); sensor2Value = analogRead(sensor2Pin); sensor2Value = analogRead(sensor2Pin); delay(200); sunval = sensor2Value + 250; // this sets the adjustment for sun and shade if (sensor1Value > sunval) { digitalWrite(relayPin, HIGH); digitalWrite(ledPin, HIGH); } else { digitalWrite(relayPin, LOW); digitalWrite(ledPin, LOW); } Serial.print(sensor1Value); Serial.print("\t"); Serial.print(sensor2Value); Serial.print("\t"); Serial.print(sunval); Serial.println(); }
Parts List.
12v DC adapter
Arduino Uno or
clone
2 x 1k resistors
2 x LDR s (there are all sorts of these. Mine are GL5547 resistance at 10 Lux 1-15 Kohm and came from tcelectroniccomponents on EBay)
Hour Counter
something like the Curtis 701PR001O-1248D2060A
which is 12v
5v relay needed unless hour
counter is 5v. Something like Velleman VMA406