International Space Station Tracker

Track the ISS’ current location & trajectory using a Raspberry Pi, ePaper Display, ProtoStax Enclosure and Python.

In this project, I show you how to track and display the current location of the International Space Station (ISS) and its trajectory over time, using a Raspberry Pi, ePaper Display, ProtoStax Enclosure and some Python.

Step 1 – Set up Raspberry Pi

The Waveshare ePaper Display uses SPI for communications. We therefore need to enable SPI on the Raspberry Pi, if you haven’t already done so.

Steps to Enable SPI

Launch raspi-config. Go to “Interfacing Options”. Navigate to SPI and press enter. Say yes when asked if you would like the SPI interface to be enabled. See steps below in the slideshow – the caption for each image is numbered and gives additional explanation for each step.

Install the ProtoStax ISS Tracker code from the GitHub Repository (link below)

$ git clone https://github.com/protostax/ProtoStax_ISS_Tracker.git

This installs the demo code as well as the requisite Waveshare ePaper library.

Step 2 – Double-check that the SPI interface is working

Some people have encountered issues where the SPI interface doesn’t get enabled properly.

Double check that SPI is actually “on” in your /boot/config.txt. Search for an entry like the following:

dtparam=spi=on

And check that you can see the SPI device connected:

$ ls /dev/spi* /dev/spidev0.0 /dev/spidev0.1

should show something! (like /dev/spidev0.0 /dev/spidev0.1 above) If it doesn’t, try sudo rpi-update and reboot.

If SPI has been properly enabled, the /boot/config.txt entry should show up as above AND you should also see the device connected when you list the SPI devices.

Step 3 – Install other pre-requisites

The code expects Python 3+ – if you are using an older version of python, you will need to install python3

The code also depends on other libraries. Install spidev, RPi.gpio, Pillow and requests dependencies as follows:

$ sudo apt-get install python3-spidev$ sudo apt-get install rpi.gpio$ sudo apt-get install python3-pil$ sudo pip3 install requests

Step 4 – Run the ISS Tracker

cd to the directory that was created with you cloned the git repository above.

$ cd ProtoStax_ISS_Tracker

Run the iss.py python script (using python3):

$ python3 iss.py

If all the steps above have been done correctly you should see the World Map with the current location of the International Space Station on your ePaper Display! Every 30 seconds, the current location gets updated (which the previous locations are plotted as the trajectory). 15 minute markers (red rectangles) are also added, to get a sense of how fast the ISS is traveling!

Here is the ISS Tracker in action (speeded up a bit):

Understanding the Code

The code has a couple of nuances to bear in mind. The location of the ISS is in latitude and longitude coordinates. These range from -180 to 180 (longitude) and 90 to -90 (latitude). These need to get mapped to the XY coordinates of our ePaper Display. The 2.7 inch display from Waveshare has a screen resolution of 264 x 176. That is an aspect ratio of 3:2

The next point to note is that world maps don’t typically have this aspect ratio. We need a map that can be displayed on the ePaper Display and give a reasonably accurate depiction of the latitude, longitude of the ISS on the world map. We also need a map that is reasonably accurate with latitude and longitude depictions.

After a bit of search, I found a world map with latitude and longitude lines, which I was able to shrink to a size of 264 x 181. Since the ISS does not fly over the poles, I can rest assured that the latitude/longitude mapped onto this coordinate system will not spill outside of our 264×176 display.

So that’s our XY coordinate system. (-180, 90) should map to (0, 0) and (180, -90) should map to (264 x 181). x = a. lon + b, and y = c.lat + d. We have two equations, and two unknowns each, and each has two data points, which we can therefore very easily solve for (I’ll leave that as an exercise for you!)

The position of the ISS gets updated every 30 seconds, and gets appended to a list. We transform the latitude, longitude data of each position to our XY Coordinate system.

We plot the World Map in black. We then plot the positions in the list in red – the last position in the list is the current location, and so we show that using an ISS icon. The other positions get plotted as little circles (just plotting a point is too small for us to see), and every 15 minutes, the position gets plotted as small rectangle. These 15 minute markers help us to see how fast the ISS is actually moving! It completes a full orbit in about 90 minutes, and a little less than 16 orbits a day. Vrooom vroooom! ??

Going Forward

Once you get comfortable playing around with the code sample and understanding the code, it is always nice to try to extend your learning with doing more.

Here are a few suggestions on how you can take this project forward:

  • Reverse the colors – display the world map in red, and the ISS location and trajectory in black.
  • Also display the current location time and latitude, longitude as text on the screen
  • Store your location coordinates, and every time the ISS is near you, print it out on the display, or take some other action, such as sending you a tweet or email, or turning on an LED.
  • Make the script run in the background, so that even when you are logged out of your Pi, the script continues to run and update your position (Hint: use nohup)
  • Make the script run on boot up, so it will automatically get launched when you power up your Pi!

Can you think of other ways to extend this project? Share it with us below! ?

Happy Making! ?

Schematics

Source: International Space Station Tracker

Scroll to Top