Open-Source Modules for Amateur Radio

Matt Roberts - matt-at-kk5jy-dot-net

Published: 2024-06-25

Updated: 2024-06-29


I write quite a bit of software for my amateur radio activities.  Much of this software is in the form of small utilities and scripts for my own use, but a few projects have been larger, and include digital mode projects that manage hardware or make contacts.  The sections below describe open-source modules that I have written for my radio projects, in case someone else wants to integrate them into their own projects, or translate them into another language.

These modules are written in C#, beacuse that's the language I use for most larger projects.  If I find reusable modules in my projects in other languages, such as C++ or Python, I may add them here later.


Maidenhead Locator ("Grid Square") Module

Radio operators often use the Maidenhead Locator or "grid squre" system when exchanging geodetic location information.  The Maidenhead Locators allow location to be sent in as few as two alphanumeric characters, with precision increasing exponentially with each additional pair of characters sent.  This makes the Maidenhead Locator system one of the most space-efficient methods of storing or transmitting a location of fixed precision.

Many contests require participants to exchange four- or six-digit grid square locations as part of each contact.  VHF+ operators in particular often exchange six-digit locators to record paths with more precision.  Some digital modes, such as FT8, use grid squares as a standard message type to communicate location to others, even outside of contests.

However, most geographical record-keeping in modern times uses a more familiar latitude/longitude pair, while distance calculations between points in modern standards normally use such coordinates as their inputs.  So it is handy to be able to easily convert between Maidenhead and "lat-lon" systems, and to calculate distances and bearings based on pairs of coordinates in each system.

This Maidenhead Locator module in C# is translated and adapted from earlier work in Pascal, by W9IP and W1GHZ.  The mathematics have been adjusted to use the types and libraries from the CLR and .NET runtime.  I have tested this module on coordinates from all four quadrants of the globe, and I use this module extensively in my FT8 Automation work, which regularly makes contacts just about everywhere on earth.  So the C# math appears to be quite solid.

Link: C# Maidenhead Locator Module

The original Pascal source for the Maidenhead module is in the public domain, and so is the C# adaptation.


ADIF Logging Module

When writing software that makes and manages on-air contacts, one of the first tasks one encounters is managing a log file to record those contacts.  A first attempt might be a simple text writer that appends new contacts to a log, line by line, but a log management module often does much more than that.  The log module needs to be able to add and search contacts in real time, especially in contesting where duplicate detection needs to be done quickly.  As the size of the log grows, it needs to perform these tasks quickly and efficiently.

The most common log format in use in the amateur radio world is the ADIF Standard.  It has some similarities to XML, but instead of closing tags, ADIF uses length fields, apparently to speed the parsing of files.

This ADIF module for C# handles the most common fields used by contesting software, supports searching, caching, and date/time conversions to/from standard .NET types.  It also works on-demand, which means that it does not hold files open.  Only when an operation is requested is a file opened, locked, the operation performed, the lock released, and the file handle closed.  This allows safe operation from multiple threads or processes without the need for explicit synchronization of the ADIF operations.

Link: C# ADIF Logging Module

This module is licensed under the GPL version 3, to encourage more open source radio software development.


Footnotes

If anyone would like to use any of my work under a different license than offered here, please contact me directly.

I try to document the interfaces in my modules quite well within the code itself.  If you find a feature that is not documented, mis-documented, or under-documented, please let me know.

Also please contact me if you find bugs or would like to request features.

Copyright (C) 2024 by Matt Roberts, KK5JY.
All Rights Reserved.