-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


"APRS Weather Reporting By Hand"
by Colin Cogle

Written Tuesday, April 2, 2019.
Updated Tuesday, April 9, 2019.

ABSTRACT
You can use `aprs-weather-submit` to share weather data without a smart
weather station.


BACKSTORY
Ever since I got my amateur radio license back in 2017, I've taken an
interest in APRS, the Automatic Packet Reporting System, which allows
hams to use a radio or an Internet connection to share useful data on
a map, such as location tracking and weather data.   However, I don't
have a fancy weather station that can automatically upload data.  Why
should weather station owners or builders have all the fun? I set out
to change that.

I already had the app PocketPacket on my phone, which can connect to
the APRS network via a radio or via APRS-IS (APRS Internet Service).
The latter method connects to a server called an IGate and uploads its
data there, and I saw PocketPacket came with a list of APRS-IS servers.
Once I authenticated my callsign, I got a username and password, and
was ready to start uploading data.

I'm going to tell the story of how I wrote this app.  If you're just
looking for directions on how to use it, scroll to the end of this ar-
ticle, or read its `man` page.

WRITING THE APP
First, I needed to learn how to make an APRS packet. Between looking at
raw packets on APRS.fi, reading the official APRS specification [1] and
its addenda (1.1 and 1.2), and some example Python code that I came a-
cross, I figured it out and created a mock-up in PHP.

However, I decided to make the final app a command-line app in the C
programming language, so that it could run on almost anything with as
few dependencies as possible, in case I should ever build my own weather
station with an Arduino or Raspberry Pi.  (Plus, I wanted to shake off
some of my rust, having not touched C since college.)

I spent some time rediscovering old friends such as Xcode, strncat(),
and sprintf(). The very first version of this app could only create the
APRS packet and print it on the screen, which I pasted into raw PHP
code which I then pasted into a terminal (`php -i`).  Once I saw my
weather reports showing up on the map, the hard part was learning sock-
ets programming.  Before long, it was complete.

The following pieces of weather data are defined in APRS 1.2.1 [4],
all of which I was able to support in my app:
- Barometric pressure
- Humidity
- Luminosity (how strong the sunshine is)
- Radiation
- Rainfall (in the last hour, last 24 hours, and since midnight)
- Snowfall (in the last 24 hours)
- Temperature
- Weather station battery voltage
- - -Wind speed, gust speed, and direction

EXAMPLES
I looked at my "dumb" thermometer and saw it was 32°F outside.  My
"dumb" rain gauge was as dry as my snow shovel, as both have been for
a few days. I reported both pieces of weather data with the following
command:

       $ aprs-weather-submit
               --callsign KC1HBK                       # my call sign
               --latitude 41.1234 --longitude -73.5678 # my location
               --server igate.example.com --port 12345 # IGate server info
               --username colin --password secret      # IGate authentication
               --temperature 32                        # the temperature (°F)
               --rainfall-since-midnight 0             # rain gauge is empty
               --rainfall-last-hour 0                  # it's dry
               --rainfall-last-24-hours 0              # it's been dry
               --snowfall-last-24-hours 0              # it also hasn't snowed

And that's it!

GET THE APP
While I don't have a binary available, you can download or contribute
to the source code of aprs-weather-submit on GitHub.  It's been tested
on macOS Mojave, and ought to compile and run on Linux.  A future ver-
sion will support Windows.

73 and thanks for reading.


LINKS
Permalink:  https://colincogle.name/aprswx
GitHub:     https://github.com/rhymeswithmogul/aprs-weather-submit

[1] http://www.aprs.org/doc/APRS101.PDF
[2] http://www.aprs.org/aprs11.html
[3] http://www.aprs.org/aprs12.html
[4] http://www.aprs.org/aprs12/weather-new.txt

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQQ7NZ6ap/Bjr/sGU4FSrfh98PoTfwUCYaKqsAAKCRBSrfh98PoT
f0/aAP9emCGoZJlijcX+T8MmTYauzojNvjFqXdxTQPK+7KkweQEAhWaPofsKFrIT
65EG5dSwbzbFU+kfwtvWYj/7e1c4AwY=
=EIcC
-----END PGP SIGNATURE-----