I’ve made some progress on my “tweet uplink” software, and now all stages in the process are fully automated except for a required manual approval step, in case anyone tries to spam the flight!
The key new element is a Windows program that lists incoming tweets and offers Accept and Reject options for each tweet that mentions a particular hashtag, for example:
The tweets are received via a simple Python script using the tweepy library, which saves each as a separate file which the Windows program then sees and displays:
Each accepted tweet is then moved to an accepted list (the tweet file is renamed from <Twitter ID>.tweet to <Twitter ID>.accepted):
The next step is a bit more complex. To make the most of the available radio bandwidth, tweets are combined together into radio packets. So whenever there are enough tweets to combine, or the uplink queue is empty, the program seeks to find the best combination of tweets to join together into a single radio packet (max 255 bytes). These packets are then placed in a queue on a Raspberry Pi running my LoRa gateway:
Here we just have a single tweet, because only one was generated in the above example.
Periodically, the balloon tracker stops transmitting down to the ground, and starts listening for an uplink from the gateway. If the queue has at least one entry then the gateway program will send one entry to the balloon. In turn, the balloon tracker will receive the packet and save it as a file. Meanwhile, a small Python script will see that file and start displaying it on the Astro Pi LED.
The gateway needs to know if the uplink was received OK or not, so the tracker includes a “last message ID received” value in the telemetry packets that it sends to the ground:
The gateway then parses this information and removes the matching message from the queue (renames <ID>.sms as <ID>.ack). The final step is for the Windows program to then remove the message from its list of queued messages and add it to the list of acknowledged messages: