💾 Archived View for colincogle.name › blog › aprs-weather-submit captured on 2023-05-24 at 17:48:21. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
-=-=-=-=-=-=-
"APRS Weather Reporting By Hand"
Written Tuesday, April 2, 2019.
Updated Tuesday, April 9, 2019.
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 article, or read its `man` page.
First, I needed to learn how to make an APRS packet. Between looking at raw packets on APRS.fi, reading the official APRS specification and its addenda (1.1 and 1.2), and some example Python code that I came across, 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 sockets programming. Before long, it was complete.
The following pieces of weather data are defined in APRS 1.2.1, all of which I was able to support in my app:
Source:
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!
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 version will support Windows.
73 and thanks for reading.
=================================================================
Previous Blog: "A Kick in the Glass"
Next Blog: "Much Ado about Electrons" >>
=================================================================
"APRS Weather Reporting by Hand" by Colin Cogle is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC-BY-SA).
https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1