The Raspberry Pi Project – Part 3May 24, 2019
For this part of the project I needed to write some code. By day I am a Java Developer, and over the years have used a few different programming languages so for this I wanted something new to learn so I chose to use Python 3 for this project. Its pretty easy to learn as there are plenty of resources out there, and its doesn’t want loads of resources to run and its cross-platform so when Ive finished with what I need for the Raspberry Pi I’ll be able to use it on other machines.
To start with I just need some basic functionality here,
- The ability to get my latitude and longitude from a GPS, covert that to a maidenhead grid
- Send the resulting Grid to JS8Call an update its Grid.
- Transmit the @ALCALL Grid message from JS8Call to the JS8Call network over an HF Radio connected to the Raspberry Pi.
- (Maybe) The Ability to automate all or some of the first 3.
Easy right? Well actually it was.
There are already python modules to open a UDP socket and send a message and also to access GPSD and convert the Latitude and Longitude to the Maidenhead grid. So really all the hard work is done for us.
I won’t detail the actual programming because its even more boring than the rest of this. But what I will do is run through the process of installing the prerequesites for the python program.
Firstly we need to open a terminal window on the pi, and enter the commands listed below.
sudo apt-get install python3 pip3 install gps pip3 install maidenhead
The resulting app needs to have a GUI, and it needs large buttons so it can be used on easily a touch screen when mobile or portable, that proved to be simple enough to set up as there is the module Tkinter is provided with Python3 (there are other modules available, but it seemed simpler to use something that’s already installed.
So after a couple of hours work I had figured out what to do and came up with something that looks like the pic below.
It works by having a GPS Listener running in the background that I can access at any time to get the current position, which is useful if moving about but maybe not so useful if you are reaming in the shack.
I decided that initiating a TX would require user intervention, future updates may include the ability to TX when your location changes significantly and Ill add a setting to decide what the parameters for that will be. But I did include the option to automatically update the Grid in JS8Call. every 10 minutes.
Once its tested Ill probable make it available to amateurs that are interested, could possibly be useful for emcomm and field use I guess.
UPDATE: The python code for this is now available on github: https://github.com/m0iax/js8calltools
Any ideas for other apps that could use the JS8Call API? Enhancements to this? feel free to comment below. Apologies if it takes me a while to read/reply to your comment, there are lots of spammers out there!