Page 3 of 6
Re: Arduino and 1-wire based home built weather station.
Posted: Sat 15 Sep 2012 5:06 pm
by Gina
These are only rough at this stage.
Yes, temperature will be in degrees Celsius with one decimal place and negative values, of course. Not sure whether to convert rainfall to mm or leave it as bucket tips. The latter is probably easiest. With my present rain gauge, 1 bucket tip = 0.04mm. Not sure about pressure yet but probably one decimal place.
My light level is simply the voltage produced by a photo-voltaic cell. It's about 2.3v in strong sunlight so I was planning 0-255 with units of 0.01v. My FO unit doesn't cover light level so I shall have to get some info about this if I emulate FO units.
Re: Arduino and 1-wire based home built weather station.
Posted: Sat 15 Sep 2012 6:54 pm
by AllyCat
Gina wrote:My light level is simply the voltage produced by a photo-voltaic cell. It's about 2.3v in strong sunlight so I was planning 0-255 with units of 0.01v.
Hi Gina,
With a PV cell (e.g. from a cheap solar garden light) IMHO it would be far better to measure the current in a load resistor (i.e. the voltage across it), which should vary reasonably linearly with light level. I believe that the (open circuit) voltage of PV cells doesn't change very much with light intensity (but does with temperature, leakage, etc.).
An alternative is a photo-resistor (the ORP-12 is a classic) which can be arranged to give a more logarithmic scale of perhaps 3 - 4 decades into an 8-bit A/D converter, by choosing a suitable value of feed resistor.
For detecting "sunshine", I've been considering using an Infra-Red (Remote Control) phototransistor (actually just the c-b junction can give enough current in sunlight) because the colour temperature band isn't too different to sunlight (about 50% of "sunlight" is IR). IR transistor packages normally have an integral "lens" (curved top), but that can easily be filed away.
Another issue is whether you actually want a "flat plate collector" (any of the above) or a more even "horizon to horizon" collector (e.g. a diffuser). The FO (3080) uses a small white dome and I believe you have some ping-pong balls.
Cheers, Alan.
Re: Arduino and 1-wire based home built weather station.
Posted: Sat 15 Sep 2012 7:18 pm
by Gina
I did some experimenting with several different light detecting devices particularly with regard to their polar responce. The garden light PV cell was very good for angle of detection with an almost constant sensitivity over 160 degrees - which surprised me. However, I'm open to suggestions for anything better
It isn't actually the open circuit voltage I'm measuring - there is a load resistor. In fact the measuring device is actually measuring current.
Re: Arduino and 1-wire based home built weather station.
Posted: Sat 15 Sep 2012 8:43 pm
by AllyCat
Gina wrote: However, I'm open to suggestions for anything better

Hi Gina,
No, I don't have any definitive answers yet. I've been considering starting a new thread on the topic, but hoping it wouldn't get as long as the last sunshine recording thread.
However, I haven't yet decided on one fundamantal issue: "What is the purpose of the measurement?". Obviously a PV cell is likely to be most useful for predicting the effectiveness (or otherwise) of a Solar Panel Array and similarly an IR sensor for a solar direct-water-heating system. For "sunshine hours" (sunrise-sunset) probably a diffuser or spherical mirror collector is required, but which (if any) of these is relevant to weather forecasting (or even recording)?
My "thought experiment" suggests that if (sun) light strikes a PV cell at 60 degrees off-axis then 50% of the available energy must "miss the target", so it should only read 50%. That's quite a loss in "energy efficiency" terms, but quite small in terms of photographic exposures or winter/summer light levels, etc.. Also, I haven't seen any figures which indicate the proportion of energy collected by PV panels from the direct sun versus the sky.
Cheers, Alan.
Re: Arduino and 1-wire based home built weather station.
Posted: Sat 15 Sep 2012 9:19 pm
by Gina
AllyCat wrote:
My "thought experiment" suggests that if (sun) light strikes a PV cell at 60 degrees off-axis then 50% of the available energy must "miss the target", so it should only read 50%. That's quite a loss in "energy efficiency" terms, but quite small in terms of photographic exposures or winter/summer light levels, etc.. Also, I haven't seen any figures which indicate the proportion of energy collected by PV panels from the direct sun versus the sky.
My records using my 1-wire weather station showed that sunshine always provided more output than a bright but cloudy sky. Hazy sunshine made it a bit difficult to say if the sun was out or not but I guess any system would have difficulties in these conditions. Strangely, the output doesn't seem to fall off much until the angle gets down to something like 10 or 15 degrees.
When I have the Arduino version working I may add other types of sensor and see how they compare. Also, the Arduino would let my carry out more exact and scientifically controlled experiments by using a stepper motor or large servo motor to rotate the sensor w.r.t. the light source.
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 2:47 pm
by Gina
Sorting out the RTC reading (and setting) and the data logging code.
The data logging shield uses the Dallas DS1307 RTC chip which uses I2C and Analog pins 4 & 5 to talk to the Arduino. Info on this and more is on the appropriate web page :- http://www.ladyada.n...shield/rtc.html
This provides links to the required library and how to install it plus code to set the clock and read the time.
Setting the time is simply :-
Code: Select all
RTC.adjust(DateTime(__DATE__, __TIME__));
which takes the time from the computer on compilation and writes it to the RTC when it's run.
Reading the clock is just as simple :-
Code: Select all
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('-');
Serial.print(now.month(), DEC);
Serial.print('-');
Serial.print(now.day(), DEC);
Serial.print('T');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
This shows displaying the RTC time on the computer but the logging to SD file works similarly. I have converted the code to use the ISO standard (up to the seconds).
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 3:07 pm
by Gina
Code for logging date/time to SD card file :-
Code: Select all
// fetch the time
now = RTC.now();
// log time
logfile.print(now.year(), DEC);
logfile.print("-");
logfile.print(now.month(), DEC);
logfile.print("-");
logfile.print(now.day(), DEC);
logfile.print("T");
logfile.print(now.hour(), DEC);
logfile.print(":");
logfile.print(now.minute(), DEC);
logfile.print(":");
logfile.print(now.second(), DEC);
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 5:58 pm
by Gina
I now have date/time plus a some random data successfully logging to files on the SD card.
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 6:43 pm
by yv1hx
Gina wrote:These are only rough at this stage.
Yes, temperature will be in degrees Celsius with one decimal place and negative values, of course. Not sure whether to convert rainfall to mm or leave it as bucket tips. The latter is probably easiest. With my present rain gauge, 1 bucket tip = 0.04mm.
Gina,
I would recommend you leave it as "bucket tips", because you can in the future change your rain gauge and maintain your recordings only changing the appropriate conversion factor to mm or inches.
Gina wrote:Not sure about pressure yet but probably one decimal place.
Using mb or HgInches one decimal place is the usual. I don't know about other scales.
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 7:34 pm
by mcrossley
yv1hx wrote:Gina,
I would recommend you leave it as "bucket tips", because you can in the future change your rain gauge and maintain your recordings only changing the appropriate conversion factor to mm or inches.
Hmm, but then would you not have to apply different conversion factors to the data depending on the date when querying historic data? I would have thought recording actual units would be preferable?
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 8:02 pm
by yv1hx
mcrossley wrote:yv1hx wrote:Gina,
I would recommend you leave it as "bucket tips", because you can in the future change your rain gauge and maintain your recordings only changing the appropriate conversion factor to mm or inches.
Hmm, but then would you not have to apply different conversion factors to the data depending on the date when querying historic data? I would have thought recording actual units would be preferable?
Mark,
The conversion factor needs to be applied after reading the "bucket tips" and before saving the data in the storage medium (or displaying the data on screen).
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 8:29 pm
by Gina
I can decide the rain data units later but that's a good point about changing conversion factor depending in date/time for historical data - I had that problem with the FO station when I changed the rain gauge calibration. I think I'll build the conversion factor into the Arduino sketch and save the rain data as mm to two decimal places. That may be overkill but would enable detecting light showers.
With the data saved as CSV rather than being exact location dependent (as in the FO), I can extend any data value to virtually any number of digits. Of course if I later provide FO emulation the data will want converting before sending to Cumulus or whatever.
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 8:36 pm
by Gina
Now I'm looking at the sensors - how many and which pins they require. Everything 1-wire goes on one single digital pin, which takes care of wind speed & direction, light level and rain gauge. Temperature/humidity will use the DHT22 and one pin but for both indoor and outdoor, that's two.
Then we come to the barometric pressure for which I'm thinking of the BMP085 module :-
http://www.ebay.co.uk/itm/1x-BMP085-Mod ... 4ab97f69cc
This uses the I2C bus and Analog pins 4 & 5 which is also used by the RTC. So far it looks like I should have sufficient I/O on the Arduino Uno.
Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 8:47 pm
by yv1hx
Gina wrote:Now I'm looking at the sensors - how many and which pins they require. Everything 1-wire goes on one single digital pin, which takes care of wind speed & direction, light level and rain gauge. Temperature/humidity will use the DHT22 and one pin but for both indoor and outdoor, that's two.
Gina,
What about the
http://www.sensirion.com/en/products/hu ... sor-sht15/ family? It's uses a similar (but not compatible) protocol to I2C, I'm pretty sure about the library existence for dealing with Arduino and this part.
BTW, the SHT11 / SHT15 is the same sensor used in the Davis VP2 family

Re: Arduino and 1-wire based home built weather station.
Posted: Sun 16 Sep 2012 9:06 pm
by Gina
yv1hx wrote:Gina wrote:Now I'm looking at the sensors - how many and which pins they require. Everything 1-wire goes on one single digital pin, which takes care of wind speed & direction, light level and rain gauge. Temperature/humidity will use the DHT22 and one pin but for both indoor and outdoor, that's two.
Gina,
What about the
http://www.sensirion.com/en/products/hu ... sor-sht15/ family? It's uses a similar (but not compatible) protocol to I2C, I'm pretty sure about the library existence for dealing with Arduino and this part.
BTW, the SHT11 / SHT15 is the same sensor used in the Davis VP2 family

That seems to have a worse spec than the DHT22. I already have DHT22s. +-0.5C and +-0.5% RH