Ever since I got my amateur radio license back in , 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. 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.
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 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:
- Barometric pressure
- Luminosity (how strong the sunshine is)
- Rainfall (in the last hour, last 24 hours, and since midnight)
- Snowfall (in the last 24 hours)
- Weather station battery voltage
- Wind speed, gust speed, and direction
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 connection info --username colin --password secret # IGate authentication --temperature 32 # current temperature (°F) --rainfall-since-midnight 0 # my 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 version will support Windows.
73 and thanks for reading.
Metadata and license information
This blog post is licensed under a
|Search keywords||Amateur radio, APRS, CoCoRaHS, code, CWOP, NOAA, SKYWARN, weather|
|Summary||You can use aprs-weather-submit to share weather data without a smart weather station.|
|Word count||508 words, not counting code blocks|
- Author: Colin Cogle
- License: Creative Commons Attribution 4.0 International License
- Content rating: None
- Encoding: text/html
- Permalink: https://colincogle.name/blog/2019-04-02-aprs-weather-submit.html
- Permalink: https://colincogle.name/aprswx
- Search keywords: APRS, CoCoRaHS, code, CWOP, NOAA, SKYWARN
- Summary: You can use aprs-weather-submit to share weather data without a smart weather station.
- Word count: 508 (not counting code blocks)
This blog post is licensed under a Creative Commons Attribution 4.0 International License.
- This article:
- Automatic Position Reporting System (APRS) Protocol Reference Version 1.0.1
- APRS Spec 1.1 Addendum
- APRS Spec Addendum 1.2 Proposals
- APRS Version 1.2.1 Weather Updates to the Spec
- aprs-weather-submit on GitHub