How to connect a weather station WS2355 (or WS2300) to Weather Underground with Arduino

By on November 30, 2011
Pin It


 

There are several softwares that enable the publication of the weather data of a professional weather station, but they all work on PC, so we should connect the weather station to a computer and leave it on, the idea is not good because the computer takes up space and consumes a lot. At a time when we should spare the energy, its not a good thing.
The project we’re talking about instead operates as a stand-alone application and allows you to publish the weather station data independently on http://www.wunderground.com, “forgetting” the PC consumption and even the desk space.

Arduino controls the dialogue with the weather station to acquire the data and also the Ethernet interface to transfer them, by making the necessary connection to the Internet via ADSL, passing by a router pointing to the IP address of the Weather Underground site and transferring information using the TCP / IP.

 

Our project

This circuit reads data from a weather station with serial interface and upload the data collected on http://www.wunderground.com.
Not all stations are equal, therefore, our circuit can not be universal but it is indicated specifically for stations La Crosse WS2355, WS2300 or WS2350.

The choice of weather station WS23xx was dictated primarily by a consideration: it has a convenient serial interface to connect and dialogue with a microcontroller such as Arduino.
We chose www.wunderground.com site because it allows anyone to upload their weather data, but also to monitor the temperature, humidity, pressure, wind etc. on line. Also on this site there are many widgets that allow you to integrate data in website or blog.
An example is the Widget for the home page of Google.
The data sent by users are publicly available, then from the home page we can specify the geographic area that interests us and we will see a screen that lists all of the corresponding stations.

How does it work?

The system has two circuit: one is the famous Arduino UNO and the other is a shield that integrates the Ethernet module WIZnet (you may, of course, use the the original Ethernet Shield), as well as a TTL/RS232 logic level converter MAX238 type. The converter allows you to adapt the serial levels of weather station to the TTL levels of Arduino.
Please be aware that the communication port of the weather station is not a simple RS232, because it has no ground reference. The DTR line must have a negative voltage while the RTS must be positive. The lack of common ground leads to the hypothesis (remember that there is no official document) that these two lines are taken as a reference of logic levels used in communication. It is a system that not only allows the use of serial connections relatively long, but also gives the opportunity to agree devices with different voltage levels on the serial port.
To communicate with La Crosse, the speed of the serial device (in our case, the Arduino module) must be set to 2,400 bps, with blocks of 8 bits, no parity and one stop bit (2400-8-N-1).
The memory map of the weather station, like many other unofficial information on the WS2355 is on the site http://www.lavrsen.dk/foswiki/bin/view/Open2300/WebHome.

 

The hardware

The jumpers on the lines T3IN and R3OUT (respectively RS232/TTL converter output and RS232/TTL converter input) let you choose which lines use for Arduino communication: we give you the opportunity to choose if use the serial hardware TXD and RXD or the two I/O digital D2 and D3 emulating a serial port with the appropriate library that can be downloaded from the website http://arduiniana.org/libraries/newsoftserial.

 

[code]

[/code]


 

 

The sketch

For the connection we uses the serial port pins 2 and 3 of module Arduino for this reason we have used the library NewSoftSerial that lets you emulate a UART using the generic contact I/O such as serial lines.
Periodically, the Arduino microcontroller polls the weather station and stores the data for the date, time, outside temperature, outside humidity, wind speed and direction, rain fell in one hour and 24 hours, the atmospheric pressure and dew point. The constant UPDATE_INTERVAL defines after how many seconds Arduino public the data collected on the site www.wunderground.com.
In order to publish the data of the control unit on this site, as already mentioned, you must have an account, once registered, there is assigned an ID that will be introduced during the connection to the site in order to proceed with publication.
In the sketch for the Arduino you must enter your ID and password, so that the publication will be successful, otherwise our system will point to the site but will not get access.
For the publication of data is sufficient to recall the page http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php,
passing data to the URL. For example, you have to compose a string like this:
http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc=2000-01-01+10&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw.

As you see, the user ID and password are inserted in the string. The data temperature should be expressed in Fahrenheit degrees and the wind speed must be in mph (miles per hour). The conversion of the data read by the control unit is made directly from the sketch, so as to spare you the burden to proceed with the manual calculation.

The use of the site www.wunderground.com for the publication of meteorological data is free and subject only to the rules of the provider, there are also advanced features, including the addition of photos and images from a webcam filming on location is the weather station and sent through the Internet.

 

 

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.
  • Bob

    Hi,

    I encounter few problems with your code. I would like to read just the temperature in the first time and it does not work. Are you sure about your “leggi” function because I obtain a string with a length of 1 or 2 max.
    This is my Arduino code : Thank you for your help

    void loop() {
    int incomingByteSer;
    if (Serial.available() > 0) {
    incomingByteSer = Serial.read();
    Serial.flush();
    if (incomingByteSer == ‘a’) {
    Serial.print(“Get temp “);
    readws();
    }
    else{Serial.print(“Error “);}
    }
    }

    void readws(){
    String temp;
    temp=getTemp(0);
    Serial.print(“Temp=”);
    Serial.println(temp);
    }

    String Leggi (int mem[]) {
    //Serial.print(“Leggi”);
    String inString;
    char inChar [3];
    int incomingByte=0; // a variable to read incoming serial data into
    int time=0;
    String chk;
    while ((incomingByte!=2) && (time 0) && (time18){
    return(“0″);
    }

    for (int i=0; i8){
    chk=(inString.substring(4,8));
    }
    inString=””;
    inString.concat(“00”); // Add 2 figures
    for (int tmp=0; tmp<5; tmp++){
    mySerial.print(byte(mem[tmp]));
    while ((mySerial.available() == 0) && (time98){
    return(“0”);
    break;

    }

    if (mySerial.available() > 0) {
    incomingByte = mySerial.read();
    }

    time=0;
    //delay(200);
    while ((mySerial.available() > 0) && time<200 ) {
    time++;
    delay(20);
    incomingByte = mySerial.read();
    if (tmp<4){
    if (tmp!=((incomingByte & B11110000)/B10000)){
    return("0");
    break;
    }
    }
    if (tmp==4){
    sprintf(inChar, "%02X", incomingByte);
    inString.concat(inChar);
    }
    }
    }

    }
    if (chk!=(inString.substring(4,8)))
    {
    return("0");

    }
    Serial.println(inString);
    return(inString);
    }

    String getTemp(int dato){
    String inString;
    String dataStr="";
    char cdata [10];
    int lung=0;
    char buff[10];
    int my_array[6];
    my_array[0] = (0x82);
    my_array[1] = (0x8E);
    my_array[2] = (0x9E);
    my_array[3] = (0x8E);
    my_array[4] = (0xFA);

    for (int ritenta=0; ritenta3){
    Serial.print(“length >5”);
    (inString.substring(4,6)).toCharArray(buff,3);
    dataStr.concat((atoi(buff))-30);
    dataStr.concat(“.”);
    dataStr.concat(inString.substring(2,4));
    }
    else
    {
    delay(500);
    }
    }
    if (dataStr.length()>2)
    {
    Serial.print(“length >2”);
    dataStr.toCharArray(cdata, dataStr.length()+1);
    float fdata=(atof(cdata)*1.800+32.000);
    if (fdata<1000){lung=7;}
    if (fdata<100){lung=6;}
    if (fdata<10){lung=5;}
    dtostrf(fdata,lung,3,cdata);
    dataStr=cdata;
    }
    else
    {
    dataStr="";
    }

    return(dataStr);
    }

  • Hi, are you using a WS2300 or WS2350?
    Please pay attention, the comunication is not a standard RS232, so you have to use a MAX3232.

  • Bob

    I use a max238CNG and my weather station is a WS2355.
    I have a communication (the synchronization works, I received “2”).

  • The max238 is ok,
    The firmware is ok, so try to upload directly the firmware as you see.

  • Bob

    I can’t upload the firmware as I see because I don’t have ethernet port. I save data on microSDcard. Normally, with the code in my first comment, it should work.
    So I don’t understand where is the problem. The synchronization is ok, but when I want to read the temperature, I obtain a string whith a length of 2 (FF, F0 or FC…).

  • Bob

    On your schematic , the pin 24(T3out) is connected to the pin 3 of the subd9 connector and pin 23(R3in) to pin 2 and on your PCB this is the contrary. What is the truth ?

  • You are right.
    I change the schematic.
    Now it is ok.

  • Bob

    Are you sure ? Because I switched the connections and now I received nothing. My config : 24 => 2 et 23 => 3

  • Bob

    and 19 with D3(Tx), 22 with D2(Rx). On your schematic, I do not understand where are Tx and Rx from Arduino ?

  • Kim

    Hi
    I found your project and thing its great.
    So would like to connect I to my WS-2355, but have a question.
    Would it be possible to use an other Interface Controller than the MAX 238 ?
    Because currently I only have MAX 232 Controllers lying around.

  • Hi, yes you could use the MAX232, but you need to put in the right state the pins 4 and 7 also.
    I suggest you to use the MAX238, is more simple.

  • nicolas

    hello,
    thank you very much for your realization, I did the same but the Arduino is connected to my ws2355 by xbee. it works for some hours and more after submission of data on weather underground but arduino read data of ws2355? I do not know of a problem or an idea comes?
    with which version you have to compile your arduino sketch? the latter does not support the commands.
    I can to make it work with version 0.23
    thank you again for your project.

  • The Arduino IDe version is 0.22, Arduino reads data from WS2300, WS2350 or WS2355 (they have the same core).
    For Arduino is not very simple read data from WS, my sketch reads data more times to be sure that the data are right

  • Fraschizzato

    Tried that sketch but there is no way to get communication with WS… The only difference between your sketch and mine in SoftwareSerial instead NewSoftSerial due to 1.0.5 IDE… Any Idea about that?

    • BorisLandoni

      WS???

      • Fraschizzato

        WS2355

        • BorisLandoni

          Have to work, but probably somethign changed in the library.