Author Topic: DIY Weather Station based on a Raspberry Pi2  (Read 4733 times)

0 Members and 1 Guest are viewing this topic.

Offline JohnG

  • Member
  • *
  • Posts: 31
Re: DIY Weather Station based on a Raspberry Pi2
« Reply #25 on: August 28, 2017, 09:51:26 PM »
I completed the magnetometer and RTC calibrations late yesterday.  Really nothing to see with the RTC, but know that it is not an obvious process, at least for the device I chose (DS3231).  It is really only four steps, but I spent maybe 10 times more time on it that should have taken, but at least it is complete.

As for the magnetometer calibration, that was more like a "three hour tour", but just as the weather (pun intended) started getting rough... PRESTO, I had the device reading more accurately and most importantly, with more repeatability than any smart-phone or traditional compass in the house.

 [ You are not allowed to view attachments ]
"Talent is equally distributed but opportunity is not." - Leila Janah

Offline JohnG

  • Member
  • *
  • Posts: 31
Re: DIY Weather Station based on a Raspberry Pi2
« Reply #26 on: September 03, 2017, 11:50:28 AM »
Additional progress has been made.  All sensors are now reporting, I divided the data into SI and US groupings as it was a little cluttered for my liking when grouped by data type.

I rediscovered "resistivity", it is resistance, but with a twist.  The long-distance wire I was using to validate the anemometer function (100ft +) measures just 2.3 ohms over that distance, so 4.6 for the round-trip.  Normally that is not going to create any issues, but when you are trying to measure pulses between 3.3v & 5.5v, there is not enough voltage or current left in the pulse to set the GPIO trigger.  So the 22ga wire run is out and a 18ga wire in.  Data is still not 100%, but at least it catches most pulses.  Looks like if I want to keep RPi indoors, an AD converter that will broadcast the data over I^2C (I2C) may be needed.

Tasks for the holiday are: verify if the wiring to the shop is good, get the code to run on a timer and once those two are completed, try again to get the rainfall to total for a 24 hour period.  Right now, the script hangs when it gets to rainfall, because that program runs continuously.  There has *got* to be a simple solution, I just have not figured it out yet.  I am trying to write the rainfall amount to a variable and pick up only the value of variable.  But thus far, all I have been able to do is call the script each time the program runs.

Below is a photo of the current sensors, except for rain as we had none, as they display in a terminal session:
 [ You are not allowed to view attachments ]
"Talent is equally distributed but opportunity is not." - Leila Janah

Offline JohnG

  • Member
  • *
  • Posts: 31
Re: DIY Weather Station based on a Raspberry Pi2
« Reply #27 on: September 03, 2017, 11:55:26 AM »
As can be seen from the screen-shot, I also was able to add "calculated dew point" to my outputs.  This took some searching and math coding in the program, but was not too terrible.  I learned long ago, that while RH is a useful measure, nothing will tell you more about the outdoor comfort level than Dew Point and temperature.
"Talent is equally distributed but opportunity is not." - Leila Janah

Offline Old Tele man

  • Singing in the rain...
  • Forecaster
  • *****
  • Posts: 1365
Re: DIY Weather Station based on a Raspberry Pi2
« Reply #28 on: September 03, 2017, 01:52:51 PM »
As can be seen from the screen-shot, I also was able to add "calculated dew point" to my outputs.  This took some searching and math coding in the program, but was not too terrible.  I learned long ago, that while RH is a useful measure, nothing will tell you more about the outdoor comfort level than Dew Point and temperature.
Don't "forget" the 'forgotten(*)' atmospheric measurement, Wet Bulb Temperature (Twb)! It comes in handy whenever anything is evaporating to dry.


(*) = To my knowledge, only MesoWest (UofUtah) calculates & displays Twb; neither NOAA nor NWS do.
« Last Edit: September 03, 2017, 05:46:21 PM by Old Tele man »
• SYS: Davis VP2 Vue/WL-IP & Envoy8X/WL-USB;
• DBX2 & DBX1 Precision Digital Barographs
• CWOP: DW6988 - 2 miles NNE of Cortaro, AZ
• WU - KAZTUCSO202, Countryside

Offline JohnG

  • Member
  • *
  • Posts: 31
Re: DIY Weather Station based on a Raspberry Pi2
« Reply #29 on: September 03, 2017, 04:56:51 PM »
I won't have enough data for Twb based on what NOAA suggests as inputs.  It certainly does bring a more comprehensive representation of "total uncomfortableness" into the mix.

In other news, I will explain how I "calibrated" the Anemometer (aka Wind Speed Sensor).

I had code for the "Fine Offset" anemometer that I purchased, but it was in kph and had been tested with Python code to determine an accurate WS function.  Knowing that the kph readings were more than accurate enough (much internet searching) based on the function used and design of the sensor, I set out to correlate kph to mph.

I know what the mathematical conversion is between kph and mph, but to validate I get the expected results is a little more complex.

The set-up included a two speed hair drier with the temperature set to off.  I positioned the nozzle such that it would be directed at the cups of the anemometer and took 5 wind speed measurements using all three "programs": Original code in kph, my code in kph (then converted to mph) and my mph code.  I did not change anything except which code ran, (it takes 6 seconds per run) and recorded the results.  I then set the drier to "Hi" and conducted the testing again as backup, using only 5x2 though.

For statistical purposes, 5 data points were taken from each program:

WS (original) kph: 10.09, 9.85, 10.09, 10.09, 10.09 ~ 10.04 avg (~6.22mph)
WS_mphV2 mph : 9.73, 9.79, 9.73, 9.97, 9.73 ~ 9.8mph  :-(
WS_mph_v6 mph : 9.76, 9.76, 9.76, 9.76, 9.76 = 9.76mph :-(

Seeing that both WS_mph programs returned essentially the same erroneous readings, I elected to do two things: 1) modify the calibration from the original WS = 1.18 as carried over to 0.765 and 2) perform the testing on only the "final" code version of the WS_mph_v6 program.

Results:
WS (original) kph: 17.3, 17.3, 17.06, 17.3, 17.3 ~ 17.26kph ~ 10.70mph
WS_mph_v6 mph : 10.71, 10.71, 10.71, 10.71, 10.71 = 10.71mph  \:D/

So I am SET in my anemometer calibration with the verified original WS in kph matching my code to within 0.01mph in 10.

No, I do not believe that is the true accuracy of the device, but for winds < 20mph, it should be accurate enough and better than what most commercial weather stations can do for 5x the cost.
"Talent is equally distributed but opportunity is not." - Leila Janah