With SpaceX’s Starlink being made available in my area, I became curious about just how many satellites were overhead at any given time. Fortunately, the US Space Command tracks and makes available data for tracking the live positions of objects in orbit. We can download this data, and use a Raspberry Pi and some speakers to announce when a particular satellite is making an overhead pass. You can also get an SMS message sent to your phone in addition to the audio.
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- 8 GB (or larger) microSD card with Raspberry Pi OS. See our list of best microSD cards for Raspberry Pi.
- Desktop speakers with a 3.5mm audio input
How to make a Raspberry Pi Satellite Tracker
Before you get started, make sure that you have your Raspberry Pi OS set up. If you haven’t done this before, see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen).
1. Install git, which will allow us to clone the code from github.com
sudo apt-get update && sudo apt-get install -y git
2. Clone the repository and descend into the directory created.
git clone https://github.com/rydercalmdown/pi_satellite_announcer.git cd pi_satellite_announcer
3. Run the installation command. It will take care of installing a virtual environment, any necessary low level dependencies, and the python requirements.
4. Visit space-track.org and create a new account. This will let us download two-line element (TLE) data tracked by the US Space Command. The code will update data from this website once per day, and store it locally to minimize stress on their servers.
5. Once registered, return to your raspberry pi and edit your environment.sh file – replace the template values with your space-track username and password.
nano environment.sh # Your spacetrack credentials # export SPACETRACK_USERNAMEemail@example.com # export SPACETRACK_PASSWORD=your_spacetrack_password
6. Retrieve your home latitude and longitude values from Google maps by right clicking on the map and selecting the first option.
7. Copy your latitude and longitude values into environment.sh, and set your desired radius in kilometers. For example, a radius of 20 kilometers would only report satellites overhead if their position on the ground is less than 20 kilometers away from you – they could be at any altitude.
8. Plug in speakers to the 3.5mm audio port on your raspberry pi, and test that you can hear them with the following command. I’m using a megaphone, but any speakers with a 3.5mm audio input will work. You may need to increase the volume with the alsamixer command. If you run into trouble, try configuring your audio in the raspi-config menu.
# Test speakers espeak -a 200 "this is a test" --stdout | aplay # Adjust volume alsamixer
9. Set up a twilio account. We’ll use this to send a text message when a satellite appears overhead. If you don’t wish to use twilio, you can edit app.py and set the ‘use_twilio’ variable to False.
10. Follow the setup instructions for a twilio account. Detailed instructions can be found on Twilio’s site here. You will need to create a phone number, and get your account credentials to perform the send actions.
11. Once you have your credentials and phone number, Add them to the environment.sh file.
nano environment.sh # Twilio credentials export TWILIO_ACCOUNT_SID=your_account_id export TWILIO_AUTH_TOKEN=your_account_token # the number you purchased with twilio export TWILIO_NUMBER_FROM=+10000000000 # your phone number export TWILIO_NUMBER_TO=10000000000
12. Run the code with the following command. It will connect to space-track, download the latest TLE data, and immediately start reporting satellites over the latitude, longitude, and radius provided in the environment.sh file.
13. Play around with the code. Right now it only announces satellites that are not considered debris, but this can be adjusted easily. You can also filter down by constellation, or only announce satellites with names that are interesting to you, like the international space station (ZARYA).