APRS weather station


edsard boelen, 4 march 2014


Since I got my tnc pi working and a digital weather station , then a nice next step would be to connect them together. xastir: the aprs program i use has support for a wide range of weather station types. So it might not be difficult to send the data to xastir and let it sent to the Nearby APRS repeater / gateway.




The data formats

This was the most difficult part. Xastir supports many station types. But it was very difficult to find any documentation on the format of any of those types. Also other programs and tools were all easy to install and use, but I wanted just to know which digits to send over to xastir so I can convert my own log files to it.
In the end I just downloaded the source code of xastir and found out that it was all nicely explained in the comments there...
here is a snippet
	  else if (12 == sscanf((const char *)data,
                    "%f %f %f %f %f %f %d %d %f %f %f %f",
                    &tmp1,
                    &tmp2,
                    &tmp3,
                    &tmp4,
                    &tmp5,
                    &tmp6,
                    &tmp7,
                    &tmp8,
                    &tmp9,
                    &tmp10,
                    &tmp11,
                    &tmp12)) {
                dallas_type = 12;
            }
            else {
                fprintf(stderr,"wx_fill_data:sscanf parsing error\n");
            }


            // The format of the data originates here:
            // http://weather.henriksens.net/

            // tmp1: primary temp (C)
            // tmp2: temp max (C)
            // tmp3: temp min (C)
            // tmp4: anemometer (mps)
            // tmp5: anemometer gust (peak speed MS)
            // tmp6: anemometer speed max * 0.447040972 (max speed MS)
            // tmp7: vane bearing - 1 (current wind direction)
            // tmp8: vane mode (max dir)
            // tmp9: rain rate
            // tmp10: rain total today
            // tmp11: rain total week
            // tmp12: rain since month
            // tmp13: Current Humidity
            // tmp14: Max Humidity
            // tmp15: Min Humidity
            // tmp16: Current Barometer
            // tmp17: Max Barometer
            // tmp18: Min Barometer
            // tmp19: Barometer Rate



So what this means is that I can send the station data in a long line of numbers:
    0.1 0.2 0.3 0.4 0.5 0.6 7 8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9

My weather station logs are written by fowsr in a xml format. I don't care, just read the last line and get the substrings from the right positions. No xml parsing done.

APRS-IS data format

It is also possible to send the weather packets directly to the APRS-IS servers. Then I can just run a daemon which sends the packet once an hour.

The APRS WX format is as described on wx.htm

  _X/XXX/gXXXtXXXrXXXpXXXPXXXhXXbXXXXX%type

_ is begin wx and wind direction
/ is 1 minute speed
g is gust (5 minute wind speed)
t is temp (IN FAHRENHEIT)
r is rain last hour
p is precip last 24h
P is precip since midnight
h is humidity
b is baro
% is software type

here is one example line :
PD1CC>APX200,WIDE2-1,qAU,PD1CF:=5214.9 N/00608.4 E_360/000g000t056r000P000p000h53b0000XOWW
PD1CC>APRS,TCPIP*:@181811z5214.91N00616.14E_360/000g000t056r000P000p000h81b0000XOWW
the qAU and ,PD1CC are server generated q constructs and should not be sent by the client (unless it is an igate)

You can send data to aprs-is by opening a telnet session and login with user ... pass ...

The server program for APRS-IS

This program will read my weather station and sends it via internet to APRS-IS for CWOP.
As specied on the site aprs2.net and aprs-is.net a socket connection to port 14580 on one of the load balancers is enough. My program will open a data stream socket, send a login and a password.
The login is my callsign, the password is just the callsign hashed by 73! The server will then respond with verified and its name.
Then I can send APRS data to it. Which then will be transmitted to all other sites and receivers.
I will send just one line with the weather and then close the connection.
After that I can view the raw packet in for example one of the server logs.

get the code here

The server program for xastir

This program is to send weather data via the radio using xastir
The result is as follows:
I have written a small server program which reads the latest fowsr log converts it to a string with 19 numbers and hosts it at port 3490.
get the code here


configuring xastir

First set up the interface:

After bringing it UP, you can check if it is working by selecting view-> own weather

It might take a couple of seconds to sync.
Then set in File->configure->defaults the reporting to station / WS

You will see the weather info appear on the world map

And we are done!, below you see it on my raspberry pi with the TNC and real data. The Nearby Igate from Deventer puts it online so it appears on aprs.fi