Real time satellite tracking. Sattrack is a simple portable application that lets you predict, visualize, and track satellite passes from your smartphone or the command line.
This code is for my engineering senior design project. The python class SatTrack is the main interface. It does the following things:
- Load satellite TLE data from file / parse web sources for it
- Track satellite position in real or sped up time
- Predict next pass (or next n passes)
- Controll antenna using servo motors via serial port - arduino interface
- Visualize satellite position using a web interface implemented in D3js
- Access the GUI on a mobile/remote device over wifi
- Record transmissions at a particular frequency using RTL SDR.
An example of satellite tracking interface:
- Python 2.7
- A modern web browser (only for visualization)
- Arduino Uno (Board and IDE)
- 2 x servos
- 5-7V DC power supply
- Download/clone this repository,
- In console, change directory to this repository,
python setup.py installNote: python should previously be added to the system PATH variable. Otherwise the general instruction is:
<path to python.exe> <path to setup.py> install
External python dependencies are:
- PySerial (for connecting to Arduino)
- Requests (for downloading satellite data)
- SDR_flow_automation (for using RTL software defined radio)
For illustration the
trial.py which contain basic uses of the SatTrack class.
The easy way is a GUI in a web browser. After installing SatTrack, type:
> python -m sattrack.interactive
The GUI simplifies controls by requiring less arguments. The values put in
defaults.py are used for all satellite instances created.
This starts a local server on
localhost:8000 and also broadcasts it over the device's network. You can open up the interface by typing
localhost:8000 on your local browser. Or you can access the interface from any web browser on another device by going to
192.168.42.1:8000. For connecting servos etc. see Set up and Wiring in the next section.
from sattrack import SatTrack # Import the `SatTrack` class: s = SatTrack() # Instantiate class s.set_location(lat='0', lon='0', ele=100) # Set observer location s.get_tle('satellite_name') # Search CELESTRAK or AMSAT for satellite TLE data s.load_tle('file_location') # OR Load TLE from a file. get_tle() and load_tle() create the satellite to track. s.begin_computing() # Start calculating topocentric coordinates at 1 second intervals. s.show_location() # Start printing satellite data to console s.visualize() # Start a server and visualize satellite on map in browser
This functionality was added to allow antennas to track a satellite's pass using 2 servo motors. One servo motor controls azimuth and the other controls altitude.
Servo control is split into 2 parts: getting coordinates for satellite, and conveying them to servo motors.
- Connect an arduino board via a USB port to the computer.
- Load the file
ServoCont/multipleSerialServoControl/multipleSerialServoControl.inoonto the board.
- Quit the arduino IDE to free up USB port control.
For most servo motors, you will not need to make any changes to the
Each servo motor is has 3 wire connections:
- Voltage High (usually red)
- Ground (usually black)
- Control (usually yellow)
To protect arduino'c circuitry, connect the power supply wires to an external power source. Make sure that the ground connections are tied: both ground pins (on the arduino and the servo motors) are on the same node.
The arduino is programmed to control up to 6 servo motors. The pin assignments for control wires are:
After the satellite TLE data has been retrieved, observer location is set, and position calculations have begun,
# continuing from SatTrack instance 's' s.connect_servos(port='COM3', motors=(1,2), minrange(0,0), maxrange=(90,360), \ angle_map=(lambda x:x, lambda x:x), pwm=(900,2100), timeout=1) # (altitude servo, azimuth servo) s.begin_tracking()
Note: In case of empty/None parameters, default values in
defaults.py are used.
And that's it!
SatTrack comes with a basic interface to use RTL software defined radios. Before using this, the SDR_flow_automation dependency needs to be installed and
rtl-sdr need to be added to the system path. More instructions can be found on the repository page. After that:
s.start_radio('freq', 'output_file') # e.g freq='123M' for 123 MHz _ = raw_input("Press any key to stop...") # any duration to record s.stop_radio()
Output is stored as a
s.stop() # stop computations and tracking s.server.stop_server() # stop server in case you are visualizing satellite
Class functions pertaining to servo motor control are still undergoing testing.
For more details, see function definitions in the sourcecode.
For examples, see