Author Topic: A UK homebrew AWS  (Read 6525 times)

0 Members and 1 Guest are viewing this topic.

Offline johnd

  • Forecaster
  • *****
  • Posts: 2612
    • www.weatherstations.co.uk
A UK homebrew AWS
« on: October 19, 2013, 04:50:40 PM »
Sorry, don't mean to hijack this subforum, but it seemed like the best fit for this post:

Is anyone in the UK interested in architecting and assembling a serious homebrew AWS and able to contribute any skills?

I say UK, simply because it's difficult to imagine this working without at least an occasional in-person meet-up. I've got some ideas (not wildly radical, but thought through) for a next-generation AWS and I can contribute a fair amount, but I'm not as clued up as ideally needed on electronics and associated small-scale assembly (including suitable weatherproofing) or on Arduino programming. If anyone can strengthen these skill gaps then please PM me.

This isn't intended for commercialisation in any serious way - I can see that the real problem here is not the design of the AWS (which isn't difficult in principle) but cost-effective production engineering and manufacturing on a large enough scale to afford real economies of scale. That isn't a game that I'm seriously intending to enter. But I guess there might be the potential, once a suitable design had been developed and fully tested, to offer a kit of parts for what might effectively become an open-source design.
Prodata Weather Systems
Prodata's dedicated Davis EnviroMonitor website
UK Davis Premier Dealer - All Davis stations, accessories and spares
Littleport, Ely, Cambs UK

Offline Bushman

  • Forecaster
  • *****
  • Posts: 6824
    • Eagle Bay Weather
Re: A UK homebrew AWS
« Reply #1 on: October 19, 2013, 06:19:18 PM »
Check with Gary - http://wunderweatherstation.wordpress.com/  Although not UK-based, he's done most of the legwork.  I expect to test this setup soon.

Offline johnd

  • Forecaster
  • *****
  • Posts: 2612
    • www.weatherstations.co.uk
Re: A UK homebrew AWS
« Reply #2 on: October 20, 2013, 04:46:54 AM »
Check with Gary - http://wunderweatherstation.wordpress.com/  Although not UK-based, he's done most of the legwork.  I expect to test this setup soon.

Interesting, but it's some way from the concept I had in mind, which is to use tried and tested existing components (which there seems to be little point in trying to reinvent, just for the sake of it, especially since any new homebrew designs won't have any established track record of accuracy and long-term durability, and which incidentally it wouldn't be surprising to see appearing as issues in the WU AWS linked to) and then integrate them with some custom electronics and data handling. That said, I definitely agree that a WiFi link into a local network/router is the way that next-generation stations are likely to work - that would be exactly the same architecture that I had planned.

Also, this WU-based design seems to be tied totally to WU. What I envisage would be much more flexible than that.
« Last Edit: October 20, 2013, 05:08:17 AM by johnd »
Prodata Weather Systems
Prodata's dedicated Davis EnviroMonitor website
UK Davis Premier Dealer - All Davis stations, accessories and spares
Littleport, Ely, Cambs UK

Offline AIW

  • Member
  • *
  • Posts: 18
Re: A UK homebrew AWS
« Reply #3 on: October 24, 2013, 06:33:01 AM »
I'm not in the UK, but I'd be more than happy to help where I could. I have experience with Arduino programming and my normal day job is repairing weather sensors for the NWS here in the states. I don't know what sensors you have in mind, but if you gave me a list I could see what I can come up with as far as hook up and working with others on some basic example code to get you started.

Even though you may see a couple links on some other posts linking to my website where I do sell some items, this is an offer strictly based on the hobbyist in me. I love to tinker especially when it comes to weather equipment.

Offline fmbfla

  • Member
  • *
  • Posts: 9
Re: A UK homebrew AWS
« Reply #4 on: January 13, 2014, 04:05:59 PM »
I've been running some sketch's that seem to werk preaty darn well for wunderground with an UNO
feel free to use and MOD.
(At Well under $100.oo U.S.)  No need for a CPU to hook up to after initial programming, A 5 volt system, battery power optional, solar chargeable optional (24 / 7 reporting as long as the router has power and the Internet is on!)
they do have Cell ($45.oo U.S.) adaptors for use with a local Cell carrier to give you some access to really remote locations.

Arduino UNO or just a RRRSA
Arduino ethernet or.........
ADAFRUIT DHT22 T(c or f) and H in %
ADAFRUIT BMP 085 Baro in Pa (or in my code inHg)
ADAFRUIT DS1307 "TIME" for the updates to Wunderground
Re Purposed DAVIS weather vane and anomometer (any anemometer/vane will work (HOME MADE),you just need to tweek the voltages for the vane and measure the anemometer radius and enter it into the code)
And a  Re purposed Rain tipper modded with a hall effect switch.


Code: [Select]
/*
 This MODIFIED sketch connects to a website (http://www.rtupdate.wunderground.com)
 using an Arduino Wiznet Ethernet shield To upload a weather conditions to wunderground.com,
 We make a standard HTTP GET request with the ID, PASSWORD and weather conditions as GET parameters.
 http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol#Personal_Weather_Station_Upload_Protocol
Binary sketch size: 25,960 bytes (of a 32,256 byte maximum)


 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * DHT to pin A0
 * wind direction to pin A1
 Anemometer to Digtal 2 (INT0)
 Rain tip to Digital 3 (INT1)
 * BMP to I2C
 * RTC to I2C
 
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen
 **
 **
  Modified  To upload weather conditions to wunderground.com
  By the drunkin programer
  1,Jan 2014
 */
#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>
#include <DHT.h>
#include <Adafruit_BMP085.h>
#include <RTClib.h>


//Pins
#define DHTPIN  A0                   // DHT 22  (AM2302)
#define vane A1
#define anemometer  2                // D2 Wind speed
#define rainTip  3                   // pin D3 Rain bucket
#define led  13// Notification of SENDING DATA
#define DHTTYPE DHT22                // DHT 22  (AM2302)
//IPAddress SERVER(38,102,137,157);                    // numeric IP for wunderground.com
char SERVER[] = "rtupdate.wunderground.com";           // Realtime update server
//char SERVER [] = "weatherstation.wunderground.com";  //standard server
char WEBPAGE [] = "GET /weatherstation/updateweatherstation.php?";
char ID [] =  "STATIONID";
char PASSWORD [] = "PASSWORD";
const float pi = 3.14159265;       // pi, not apple, not pumpkin, not pizza, not even related to Raspberry Pi. http://www.raspberrypi.org/ This is the REAL PI for RPM/Wind speed calculations
// Radius from vertical anemometer axis to a cup center (mm)
const int radio = 60;

// (changing "Wait")changes the windspeed calculation "period" automaticly
const unsigned long Wait = 1500;  // Amount of Time to wait till Re-connecting, Changing this also
const unsigned long period = Wait * 2; // Measurement period (miliseconds)
const unsigned long IDLE_TIMEOUT_MS = 500;
unsigned int counter = 0;         // pulse count for wind sensor
unsigned int RPM = 0;             // Revolutions per minute
unsigned int Sample = 0;          // Sample number
unsigned int connections = 0;     // number of connections
unsigned int winddir = 0.0;       // Wind direction
unsigned int rainin = 0;          // counter for Rain
unsigned int rainSample = 0;      // counter for Rain Samples 
float windspeedmph = 0/ 0.445;    // Wind speed (m/s)
float windgustmph = 0;            // Max wind speed
//---DEWPOINT
double dewPoint(double tempf, double humidity)
{
  double A0= 373.15/(273.15 + tempf);
  double SUM = -7.90298 * (A0-1);
  SUM += 5.02808 * log10(A0);
  SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
  SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
  SUM += log10(1013.246);
  double VP = pow(10, SUM-3) * humidity;
  double T = log(VP/0.61078);   
  return (241.88 * T) / (17.558-T);
}//---DEWPOINT
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,109);
EthernetClient client;
DHT dht(DHTPIN, DHTTYPE);         // DHT 22  (AM2302)
Adafruit_BMP085 bmp;              // BMP Sensor
RTC_DS1307 rtc;

void setup(void)

 
  Serial.begin(115200);
  Wire.begin();
  rtc.begin();
  //rtc.adjust(DateTime(__DATE__, __TIME__));//uncomment to reset the time during RECOPILE!
  bmp.begin();
  pinMode(anemometer, INPUT);
  digitalWrite(anemometer, HIGH);
  pinMode(rainTip, INPUT);
  digitalWrite(rainTip, HIGH);
  Serial.println(F(" Ethernet shield Wunderground Test!\n"));
  dht.begin();// Connect the DHT22 sensor
  Serial.println(F("\nInitializing..."));
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    Ethernet.begin(mac, ip);
  }
  Serial.println("Ready!");
  Serial.println();
}
void loop(void)
{

  DateTime now = rtc.now();
  Serial.print(now.year());
  Serial.print('/');
  Serial.print(now.month());
  Serial.print('/');
  Serial.print(now.day());
  Serial.print(' ');
  Serial.print(now.hour());
  Serial.print(':');
  Serial.print(now.minute());
  Serial.print(':');
  Serial.print(now.second());
  Serial.println();
    //Clear the rainCount and maxwind every 24 hr
  if ((now.hour() == 24) && (now.minute() == 00) && (now.second() <= 5)) {
    windgustmph = 0;
    rainin = 0;
  }
  //Clear the rainSample and maxwind every 30 seconds
  if (rainSample >=10){
    rainin = 0;//Clear the rainCount
    rainSample = 0;// Clear the rain samples
    windgustmph = 0;  //clear Max wind speed
  }
  Sample ++;
  rainSample++;
  windvelocity();
  RPMcalc();
  WindSpeed();
  Heading();
  float tempf = dht.readTemperature(2); //Calc *F
  float humidity = dht.readHumidity();
  float baromin = bmp.readPressure()* 0.0002953;// Calc for inHg
  float dewptf = (dewPoint(dht.readTemperature(2), dht.readHumidity()));
  // max wind speed
  if (windspeedmph > windgustmph) {
    windgustmph = windspeedmph;
  }

  if (client.connect(SERVER, 80)) {
   
    Serial.println("Sending DATA ");
    client.print("GET /weatherstation/updateweatherstation.php?");
    client.print("ID=");
    client.print(ID);
    client.print("&PASSWORD=");
    client.print(PASSWORD);
    client.print("&dateutc=");
    client.print(now.year());
    client.print("-");
    client.print(now.month());
    client.print("-");
    client.print(now.day());
    client.print("+");
    client.print(now.hour()+ 5);
    client.print("%3A");
    client.print(now.minute()+ 2);
    client.print("%3A");
    client.print(now.second());
    client.print("&winddir=");
    client.print(winddir);
    client.print("&windspeedmph=");
    client.print(windspeedmph);
    client.print("&windgustmph=");
    client.print(windgustmph);
    client.print("&tempf=");
    client.print(tempf);
    client.print("&rainin=");
    client.print(rainin / 2.0 / 100.0);
    client.print("&baromin=");
    client.print(baromin);
    client.print("&dewptf=");
    client.print(dewptf);
    client.print("&humidity=");
    client.print(humidity);
    //client.print("&action=updateraw");//Standard update
    client.print("&action=updateraw&realtime=1&rtfreq=5.0");//Rapid Fire
    client.println();
    Serial.println();
    Serial.print("Posting Sample # ");Serial.print(Sample);
    Serial.print(" Rain Sample # ");Serial.println(rainSample);
    Serial.print("wind dir= ");
    Serial.println(winddir);
    Serial.print("windspeed mph= ");
    Serial.println(windspeedmph);
    Serial.print("windgust mph= ");
    Serial.println(windgustmph);
    Serial.print("tempf= ");
    Serial.println(tempf);
    Serial.print("rain in= ");
    Serial.println(rainin / 2.0 / 100.0);
    Serial.print("baro= ");
    Serial.println(baromin);
    Serial.print("dew point= ");
    Serial.println(dewptf);
    Serial.print("humidity= ");
    Serial.println(humidity);
    Serial.println();
  }
  else {
    Serial.println(F("Connection failed"));   
    return;
  }
  Serial.println("-------------------------------------");
  Serial.println("Server Responce!");
  unsigned long lastRead = millis();
  while (client.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
      lastRead = millis();
    }
  }
  client.stop();
  Serial.println();
  Serial.print("Waiting ");
  Serial.print(Wait*2/1000.0);
  Serial.println(" seconds.");
  delay(Wait);// 30sec
  //clearing the rain readings every 5 seconds

  //clearing the rain readings every 5 seconds
  Serial.println();
  Serial.println("-------------------------------------");
}
void windvelocity(){
  windspeedmph = 0;
  counter = 0;
  attachInterrupt(0, addcount, CHANGE);//anemometer
  attachInterrupt(1, addrain, CHANGE); // Read the Rain tips Hall Effect
  unsigned long millis();                     
  long startTime = millis();
  while(millis() < startTime + period) {
  }
  detachInterrupt(0);
  detachInterrupt(1);

}
void RPMcalc(){
  RPM=((counter*5)*60)/(period/1000);  // Calculate revolutions per minute (RPM)
}
void WindSpeed(){
  windspeedmph = ((2 * pi * radio * RPM)/60) / 1000;
}
void addcount(){
  counter++;
}
void addrain(){
  rainin++;
}
void Heading(){
float windDir =(analogRead(vane)* 5.00 / 1023.0);    // Wind direction               
  if ((windDir > 4.94)||(windDir < 0.01))
    (winddir = 0.0);// North
  if ((windDir >= 0.02)&&(windDir < 0.30))
    (winddir = 22.5);//NNE
  if ((windDir >= 0.31)&&(windDir < 0.72))
    (winddir = 45.0);//NE
  if ((windDir >= 0.72)&&(windDir < 0.99))
    (winddir= 67.5);//ENE
  if ((windDir >= 1.00)&&(windDir < 1.25))
    (winddir = 90.0);//E
  if ((windDir >= 1.26)&&(windDir < 1.52))
    (winddir= 112.5);//ESE
  if ((windDir >= 1.53)&&(windDir < 1.91))
    (winddir= 135.0);//SE
  if ((windDir >= 1.92)&&(windDir < 2.40))
    (winddir = 157.5);//SSE
  if ((windDir >= 2.41)&&(windDir < 2.73))
    (winddir = 180.0);//S
  if ((windDir >= 2.74)&&(windDir < 2.96))
    (winddir = 202.5);//SSW
  if ((windDir >= 2.97)&&(windDir < 3.37))
    (winddir = 225.0);//SW
  if ((windDir >= 3.38)&&(windDir < 3.55))
    (winddir = 247.5);//WSW
  if ((windDir >= 3.56)&&(windDir < 3.85))
    (winddir = 270.0);//W
  if ((windDir >= 4.13)&&(windDir < 4.06))
    (winddir = 292.5);//WNW
  if ((windDir >= 4.07)&&(windDir < 4.32))
    (winddir = 315.0);//NW
  if ((windDir >= 4.33)&&(windDir < 4.93))
    (winddir = 337.5);//NNW
}


I havent had steady luck with the Adafruit CC3000 WiFi BoB(Mammory Hawg!), but i tool with it from time to time as I have more than one AT328PU on perfbords.
I hope this heelps you out some.
Cheer's

Offline fmbfla

  • Member
  • *
  • Posts: 9
Re: A UK homebrew AWS
« Reply #5 on: January 13, 2014, 04:08:26 PM »
Sorry, Forgot to link my weather data from my "Duino"
http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KFLFORTM67