Screen Tracker: Live Planets & ISS
by mars91 in Circuits > Microcontrollers
338 Views, 6 Favorites, 0 Comments
Screen Tracker: Live Planets & ISS


This simple screen shows the locations of the planets and the ISS (International Space Station) in real time.
For this project, I will use a custom API, designed PCB (Gerber files), and a few soldered components. I chose the easiest SMT (Surface-Mount Technology) sizes so you should be able to solder these with a regular soldering iron.
Supplies
- TFT screen
- 2 pin push button
- Slide switch
- Two 10kΩ 0805 resistors (has to be 0805, it's a surface-mount component size)
- One 100nf 0805 capacitor
- Neopixel
- ESP32
- PCB provided below
These links are spread across Amazon, DigiKey, and Adafruit. With some research, you'll probably be able to find all the parts on DigiKey, saving on shipping costs.
Order Your Board



Order your board or download the Gerbers here! https://www.pcbway.com/project/shareproject/W775378ASH74_satscreen2_439d7c6a.html
You could also build this on a breadboard. (Board designed in KiCad)
Check Out the API



This is my first AWS website that I've shared https://orbital-api.com/. The API creates orbit data. Hopefully, it keeps running smoothly... If for some reason it goes down, I can always set up a quick GitHub repo so you can build the site locally, just ask. And maybe one day I'll make a tutorial on how I made this site.
We'll be using two APIs for this project:
1.) ISS State Vector API
https://orbital-api.com/satelliteVectorEciOnEcef?norad=25544&basic=true
You can create this link yourself using the API homepage above (see attached picture). The only difference is that the this URL has &basic=true at the end, which limits the amount of data, no need to overload the little chip. This API returns the ISS state vector, which is a list telling where the satellite is and how fast it's moving. Why a state vector? The ESP32 chip will actually be doing some astrodynamics to avoid constantly hitting the API and still track the ISS in real-time.
2.) Planet Data API
https://orbital-api.com/allPlanetsLatLonDist
Unlike the ISS API, you can't generate this one from the website's homepage. ¯\(ツ)/¯ The chip refreshes the planet data every 30 minutes, which IMHO is good enough since planets move much slower than the ISS.
Code and WiFi



The code will hit the API every 30 minutes to refresh the ISS and planet data. It will also move the ISS on the screen using astrophysics and the chip’s internal clock! One button switches the display to the ISS, while the other button switches to the planets. If on planet `mode`, it will keep cycling thru them every 30 seconds. That’s it!
How the code works
Animations!
First, the TFT_eSPI.h library, found here TFT_eSPI. This is a great library but it can be hard to set up. Here are some tips. Check what TFT driver your screen uses (the brain of your display). For this Adafruit screen, we have an ST7789 driver.
Next, figure out your ESP32's SPI pins. These include MOSI, MISO, SCK, and a few others. These pins are responsible for updating all 54,400 pixels fast! ESP32 S2 Pins. Once you have the correct pins, you’ll need to change the User_Setup_Select.h file in the library to match your ESP32, pins, screen size, and driver.
It usually takes me a while to tweak everything until my screen works. But once it does, this library is awesome. I’ll attach the two files I used to make it work. Lmk if you run into issues. You can also check the schematic above to see the exact pins.
Physics!
You’ll see a C++ function called:
This function takes the state vector from the API and propagates the ISS using the ESP32’s built-in clock. It then converts the ISS's position (in outer space) to a latitude and longitude.
Runge-Kutta is a staple in astrophysics that predicts where an object will be in the future. Believe it or not, the two-body Kepler problem (where a small object orbits a much larger one) has no exact solution for future positions! (unless the orbit is 100% perfectly circular) So, we must use approximations.
This code has a 2nd order Runge-Kutta, meaning it's less accurate than 3rd order but more accurate than 1st.
WiFi Setup!
For WiFi, we’ll use WiFiManager. Here’s an amazing guide that gives more detail WiFiManager Tutorial.
When you power up the chip for the first time, it will show up as an available WiFi network. Connect to it from your phone or computer, enter your WiFi details, and you’re good to go, the chip is set!
Libraries Used
All of these are fairly common:
Arduino code is attached below!
Assembly

First, Solder the SMT Components
There are two resistors, a capacitor, a slide switch, and a neopixel. If you're feeling nervous about SMT soldering, this is a great video SMT Soldering Tutorial.
Then, Solder the Chip and Screen
I almost always use headers for my chip so I can easily remove it later but that's up to you. Solder the chip, 5 volt pins, and then the screen. Then the buttons.
Powering the Board and an Issue :|
The board can be powered with 5 volts or a USB.
Unfortunately (and this could be fixed in the PCB/Schematic design), the top switch doesn't really work but it's still needed. As a complete circuit, it works great. However, when switched off, it turns off the screen but not the chip, and flipping it back on causes a miscommunication between the chip and screen. You'll need to press the reset button on the ESP32 chip after turning the board's switch back on...
Enjoy the Show!

Watch the ISS and planets move across the screen as they (and you) travel thru space! Thanks for checking this instructables out!