707 Satellite Tracking - k3ng/k3ng_rotator_controller GitHub Wiki

Introduction

The K3NG Arduino Rotator Controller has the capability to track satellites in realtime. All functionality below is tested and working.

Quickstart

  1. Hardware - You need an Arduino Mega or similar platform. Don't even try this with an Uno or Nano. (No, don't even for support for these.)

  2. Software - Enable FEATURE_SATELLITE_TRACKING in your features and options file. Compile, and upload to your Arduino.

  3. The Arduino will boot up as normal. The first time you run the software with satellite tracking, it will load up a hardcoded Two Line Element (TLE) from code and write it to EEPROM. The satellite is called AO7TEST, and is the venerable AO-7 satellite. (Please be aware the age of the TLE data and the accuracy of the tracking of AO-7 will vary depending on when you downloaded the code and how recently the hardcoded TLE in the Arduino code was updated. The hardcoded AO7TEST TLE data is intended only to bootstrap the unit initially and give you the ability to test out the functionality immediately, prior to loading a real TLE file)

  4. You can see the current status of the current satellite (AO7TEST) by running the \~ (backslash, tilde) command in the CLI (serial interface). Running it without parameters prints the status once. Provide a number as an argument will cause the command to periodically print the status every X seconds. For example, \5 would cause the unit to print out the status every 5 seconds. Running the \ command again will cause one more print out and cease the periodic status print outs.

  5. The list of satellites loaded can be viewed with the \| (backslash, pipe) command. Upon first boot with the satellite tracking functionality you will see only the AO7TEST satellite. The satellite azimuth, elevation, latitude, longitude, next AOS time, and next LOS are displayed.

  6. You can load TLEs into the controller using the \# command. TLE Loading is described in more detail below.

  7. Change the current satellite using the \$. Examples: \$AO-07 \$NO-44 \$MAX VALIER SAT. Names can be matched using just four characters. Example: \$AO-0

  8. To initiate tracking, issue the \^1 command. To stop tracking, issue a \^0 command, or the Yaesu S command, or any other command that initiates manual rotation, rotation to a heading, or initiates moon or sun tracking. Hitting a rotation button or the stop button will also deactivate satellite tracking.

Features and Related Options

#define FEATURE_SATELLITE_TRACKING 

LCD Display

  OPTION_DISPLAY_SATELLITE_TRACKING_CONTINUOUSLY
  
  OPTION_DISPLAY_SATELLITE_TRACKING_ALTERNATING - LCD display one line that alternates current satellite az/el, AOS date/time, and AOS az/le 

  OPTION_DISPLAY_MOON_OR_SUN_OR_SAT_TRACKING_CONDITIONAL

  #define LCD_MOON_OR_SUN_OR_SAT_TRACKING_CONDITIONAL_ROW 4 
  #define OPTION_DISPLAY_SATELLITE_TRACKING_ALTERNATING_TIME_MS 5000
  #define LCD_DISPLAY_SATELLITE_VISIBLE_NOT_TRACKED_CHAR "~"

Nextion Touch Display

Satellite tracking is fully suported on the Nextion display (FEATURE_NEXTION_DISPLAY). No special settings are needed to enable this, the Nextion will recognize the presence of the satellite tracking feature and will enable the corresponding screen during boot up.

Settings

#define SATELLITE_UPDATE_POSITION_INTERVAL_MS 5000
#define SATELLITE_TRACKING_UPDATE_INTERVAL 5000
#define SATELLITE_AOS_AZIMUTH_MIN 0
#define SATELLITE_AOS_AZIMUTH_MAX 360
#define SATELLITE_AOS_ELEVATION_MIN 0
#define SATELLITE_AOS_ELEVATION_MAX 180

(TODO: Need to update this, include VT100 emulation option)

Pins

#define satellite_tracking_active_pin 0
#define satellite_tracking_activate_line 0
#define satellite_tracking_button 0        // use with a normally open momentary switch to ground

Commands

\|xxx               - list all satellites with current azimuth, elevation, latitude, longitude, and next AOS and LOS times
                        xxx = seconds between period reports (optional)
\~xxx               - current satellite tracking status; xxx = seconds between period reports (optional)
\^x                 - activate or deactivate satellite tracking (x: 0 = deactivate, 1 = activate)
\!                  - erase satellite TLE file area in eeprom
\@                  - print satellite TLE file area from eeprom
\#                  - load satellite Keplarian elements file into eeprom
                        DO NOT USE the Arduino IDE Serial Monitor or Termite terminal program (maybe others).  They strip
                        carriage returns and line feeds from pasted text.  You can use PuTTY on Windows, and on
                        Mac/Linux you can use the 'screen' command line program.

\$xxxxxxx           - change current satellite (xxxxxx = satellite name in stored TLE file)
\%x[x][x]           - print next x passes of the current satellite (defaults to one with no parm)

Loading TLEs and General Operation

Two Line Elements, or TLEs can be loaded into the system using the # command. TLEs define the orbit of satellites and are used to predict their position at any given time. TLEs are stored in the EEPROM, are non-volatile, and remain across reboots.

TLEs look like this:

AO-07
1 07530U 74089B   20233.79932519 -.00000039  00000-0  38858-4 0  9997
2 07530 101.8053 203.1944 0011782 239.9463 182.3764 12.53644665 94290

They are updated regularly and you should refresh your TLEs every week or two to ensure that you have the latest data for the satellites you want to track. Old TLEs may produce inaccurate results. A good description of TLEs and satellite orbital mechanics is here.

The process for loading TLEs is as follows.

  1. Download bare TLEs into a text file. AMSAT is a good source for amateur radio related satellites. Note that the TLEs ned to be bare TLEs and not the ones that contain any headers like these.

  2. Use a terminal program like PuTTY or Termite on Windows, or screen in the command prompt on Linux/BSD/MacOS. The Arduino serial monitor WILL NOT WORK for this uploading operation because it strips carriage returns and line feeds from pasted text. Don't try it. It will not work. (In PuTTY, paste is executed by doing a right-click. It's not intuitive nor have I seen this in any other program, but that's how they implemented it.)

  3. Issue the \# command on the Arduino command line interface. You will see a prompt to begin pasting the lines.

  4. Paste the TLE file lines, in groups of about five to ten satellites. On a Mega you will definitely not be able to paste the entire set of TLEs at once as the serial buffer will overrun. I've had reports that you can on the Teensy. I tend to load the Mega like so:

Screen Shot 2020-08-27 at 17 04 01

Screen Shot 2020-08-27 at 17 04 13

...and so on. Do not put blank lines in between lines or groups of satellite TLEs that have been pasted. Using the screen command line program on MacOS, I have to do a return after each group of TLEs I paste. This may vary depending on your operating system and terminal program. Do not use the Arduino serial monitor. Have I mentioned that you should not use the Arduino serial monitor?

  1. The upload will automatically terminate if there has been 20 seconds of serial port inactivity, double return was sent, or the end of the EEPROM is reached. You will receive a message that the file has been saved. If you did hit the end of the EEPROM, you will receive a message that the file was truncated. Do not worry, the TLE will still work fine if it is truncated.

  2. Run the \@ command to view the currently stored TLE file. It should look like what you pasted, however unnecessary data on TLE line 1 is not stored in order to save space and give you room for more TLEs. It will look like this:

Screen Shot 2020-08-27 at 17 07 48

  1. If you were running with the default hardcoded AO7TEST TLE, the system will automatically load up the first satellite in the saved TLE and make it the current satellite.

  2. You can switch to any satellite in the TLE file (view with the \@ or \| commands) using the \$ command. The current satellite is stored in the non-volatile EEPROM configuration within 30 seconds of changing it.

  3. All tracking operations are performed on the current satellite. The current satellite can be viewed with the \~ command, in the debug log \D, or appears in bold in the | command if the VT100 terminal emulation option is enabled.

There is room to store about 34 satellite TLEs on an Arduino Mega which has 4K of EEPROM. A Teensy 3.2 will hold about 16 satellites. You do not need to erase the EEPROM TLE file store area prior to uploading new TLEs, but you can erase the area with the \! command.

Satellite Data Updating Algorithm

Here are details on how the K3NG Rotator Controller initializes the satellite tracking subsystem and updates satellite data:

  1. The system waits 4 seconds before initializing the satellite “subsystem”. A lot of other stuff going on with the controller in the beginning.
  2. Load up the satellite data array with the names of the satellites from the TLE file in EEPROM. If the TLE file area is empty or there are no valid satellites, default to a hardcoded TLE called AO7TEST and write the TLE to EEPROM. Change the current satellite to whatever is stored in the configuration from EEPROM from the previous runtime.
  3. Calculate az, el, lat, long, next AOS, and next LOS for the current satellite...

Under construction due to algorithm change - Goody 2020-08-29

Script to Pull TLEs Automagically

This script will work on most any Unix variant including Linux, BSD, and the MacOS terminal.

#!/bin/sh
rm nasabare.txt
wget https://www.amsat.org/tle/current/nasabare.txt
grep -A 2 AO-07 nasabare.txt > tles.txt
grep -A 2 AO-27 nasabare.txt >> tles.txt
grep -A 2 AO-73 nasabare.txt >> tles.txt
grep -A 2 AO-91 nasabare.txt >> tles.txt
grep -A 2 AO-92 nasabare.txt >> tles.txt
grep -A 2 AO-95 nasabare.txt >> tles.txt
grep -A 2 ISS nasabare.txt >> tles.txt
grep -A 2 Max nasabare.txt >> tles.txt
grep -A 2 FO-29 nasabare.txt >> tles.txt
grep -A 2 NO-44 nasabare.txt >> tles.txt
grep -A 2 RS-44 nasabare.txt >> tles.txt
grep -A 2 CAS-4A nasabare.txt >> tles.txt
grep -A 2 CAS-4B nasabare.txt >> tles.txt
grep -A 2 SO-50 nasabare.txt >> tles.txt
grep -A 2 EO-88 nasabare.txt >> tles.txt
grep -A 2 PO-101 nasabare.txt >> tles.txt
grep -A 2 XW-2A nasabare.txt >> tles.txt
grep -A 2 XW-2C nasabare.txt >> tles.txt
grep -A 2 XW-2C nasabare.txt >> tles.txt
grep -A 2 XW-2D nasabare.txt >> tles.txt
grep -A 2 XW-2E nasabare.txt >> tles.txt
grep -A 2 XW-2F nasabare.txt >> tles.txt
cat tles.txt