1 of 15

Tracking the ISS with an Arduino!

https://xkcd.com/2979/

2 of 15

What is the International Space Station?

  • A big habitable spacecraft
  • Orbits Earth at an altitude of about 420 km
  • Travels at a speed of ~28,000 km/h
  • Completes an orbit roughly every 90 minutes.
  • A multinational research laboratory where astronauts conduct experiments (and occasionally get stuck)

3 of 15

YOU CAN SEE IT FROM EARTH!

  • It looks like a very fast moving star
  • If you are lucky, you can see it more than once a night!
  • There are apps!

4 of 15

A cool birthday present

  • HackPack!
  • I'm not super into shooting things
  • C++, impress the cool kids at RC

https://xkcd.com/2979/

5 of 15

6 of 15

Finding the ISS

  • Our goal is to point an arrow at the ISS, so we know when to go outside, without looking at our phones.
  • We are on a sphere. The ISS is flying around above the sphere. How hard could it be?
  • Turns out it's pretty hard (for me)!

7 of 15

Two-Line Element Sets / SGP4

  • Data comes in a standard format - TLE
    • Where the body was at some point in the past. Updated a few times an hour.
  • Use the SGP4 algorithm to predict the position at a different time
  • Takes into account atmospheric drag, earth's non-spherical gravitational field, the gravity of the moon and the sun, solar radiation, etc. It's busy out there!
  • This outputs something in "Earth-Centered Inertial" coordinates
    • (This is a plane fixed in relation to the stars, at some "epoch")

8 of 15

Compute a direction to the ISS

  • Now we know the position of the ISS in ECI at the current time
  • We project our current position (lat / long / altitude) into ECI coordinates (via some other coordinate systems)
  • In the end you can end up with an Azimuth and Elevation, which is just 2 angles!

9 of 15

Azimuth and Elevation

  • We can use these angles to make our arrow move!
  • The Azimuth angle will make the stepper motor move, which moves the base plate
  • The Elevation angle will make the servo motor move, and moves the arrow

10 of 15

EASY PEASY

  • I got a nice C++ project going
  • It can calculate the azimuth and elevation based on your position!
  • I learned about Bazel and gTest and how you just copy/paste code from other people into your project ("vendoring")
  • Now we just compile it for the Arduino, right?

11 of 15

Just compile it on the Arduino!

  • Throwing exceptions
    • You can't do it - it doesn't know how to unwind the stack
  • Arduino redefines the `abs` function
    • (I have negative feelings about that…)
  • Parsing a raw HTTP Request
  • Binary Size
  • Time

12 of 15

Binary Size!

  • Just blindly compiling my code for the Arduino pushed me over the binary size! Gah!
  • There's the SGP4 library, Wifi library, the RTC library, the Servo library, the Stepper motor library, and all my math!
  • I had to delete a lot of unused stuff from the SGP4 library
  • I had to not use things like C++ stringstream, apparently using them needs a lot of code!
  • Updating Arduino IDE stopped it from compiling

13 of 15

Time!

  • I've never thought about needing to see if a computer can tell the time before. Luckily this one can!
  • If you want the current time, you'll need to tell it what it is!
  • The best way of doing this is with NTP
  • Connect to WiFi, then get the current time, and update the RTC.

14 of 15

3D modeling / printing!

15 of 15

Weeee Ooooo!

There's a cool space thing happening!