Follow the Data: Interplanetary Edition
Published: 2021-05-11 03:39:14

Heres one of the best pieces of advice that I could give for any aspiring software developer: follow the data. When in doubt, trace the path of your information through the course of your application and analyze it at every step of the process. If you follow this advice, you will without a doubt begin to see the larger context of your program and eventually gain the understanding you need to move forward. 

That being said, let's have some fun with it.

I want to "follow the data" on an insane interplanetary scale. At the end of this blog I'm going to post a picture taken by Ingenuity, NASA's newly deployed helicopter drone. Between now and the moment you see that photo we are going to follow it all the way from the surface of the Red Planet straight to your personal device.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gp2g877tkntsmqamkebm.png)

Ingenuity has been equipped with two cameras, each with its own purpose. The primary navigation camera is downward facing, black-and-white and a mere 0.5 megapixels. The secondary camera, sometimes referred to as the "terrain camera", is full color, 13 megapixel and horizon-facing. Thankfully this is the one our picture was taken on.

Now that the picture has been taken we just need to send to Earth, right? Easy peasy. 

Not so much. Ingenuity is equipped only with a short range communications antenna located in the middle of it's solar array, so it actually needs to route the data through a Helicopter Base Station (I'm not making that name up, it's super cool) on Perseverance. Here's a short blurb from the official [NASA press documentation](https://www.jpl.nasa.gov/news/press_kits/ingenuity/landing/mission/spacecraft/) about Ingenuity and the base station's relationship:

>Ingenuity and the base station use a UHF telecom link (900 MHz) to communicate with each other. The system can relay data at up to 250 kilobytes per second over distances of up to 3,300 feet (1,000 meters). During flights, a one-way data stream will be sent in real time from the helicopter to the rover for storage and subsequent retransmission to Earth. After landing, the helicopter will re-transmit the inflight data stream and additional data from the flight.

Now the data is on Percy, but where does it go from here? Well, depending on the time of sol (Martian day), Percy will send it to one of the several Mars orbiters waiting just outside the atmosphere. It could be the European Space Agency's [Trace Gas Orbiter](https://exploration.esa.int/web/mars/-/46475-trace-gas-orbiter), or perhaps it's NASA's [MAVEN](https://www.planetary.org/space-missions/maven#:~:text=NASA's%20Mars%20Atmosphere%20and%20Volatile,the%20planet%20lost%20its%20water.) orbiter. For the sake of continuing our journey, lets just say Percy happened to catch [MRO](https://mars.nasa.gov/mro/), the Mars Reconnaissance Orbiter, which was placed into martian orbit in 2006. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8djvr24o9r7regkizhd5.png)
 
It's important to note what kind of technology is being used for these data transfers. Percy is most likely transmitting from a low gain antenna, which basically means it's a wide and weak signal. What MRO is about to do, transmit from Mars to earth, will be done with a high gain antenna, which is a highly concentrated and narrow signal meant for long distances. Here are the stat's on MRO's transfer rates straight from [NASA](https://mars.nasa.gov/mro/mission/communications/commxband/#:~:text=At%20its%20maximum%20distance%20from,making%20higher%20data%20rates%20possible.)'s own documentation:

>The X-band communication system on the orbiter uses a 3-meter-diameter (10-foot) high-gain antenna and a 100-watt X-band radio traveling wave tube amplifier to transmit signals to Earth. Each of these devices is more than twice as powerful as those used by most Mars missions. As a result, Mars Reconnaissance Orbiter is able to send data back to Earth more than 10 times faster than previous missions.
At its maximum distance from Earth of about 250 million miles, the orbiter sends data at a rate of at least 500 kilobits per second. At closer ranges, the signal strength is greater, making higher data rates possible. For several months when Mars Reconnaissance Orbiter is at its closest range of about 60 million miles, the orbiter sends data to Earth at 3 to 4 megabits per second. 

 
Depending on how close Earth is to Mars at the time of the data transfer, it can take anywhere between 3 and 22 minutes to get that signal from one planet to the other.

So here we are, arriving at Earth. One would assume that our photo is heading straight to NASA HQ, which you probably assume is somewhere in Florida, right? 

You'd be wrong on both counts (NASA's HQ is in Washington DC, duh). Because our signal has traveled anywhere between 33.9 million and 196 million miles to get to us, chances are it's now pretty faint and hard to pick up via ordinary means.

That's where the [Deep Space Network](https://www.nasa.gov/directorates/heo/scan/services/networks/deep_space_network/about)(DSN) comes in. The DSN, another awesome name, is a network of three high powered antennas located at roughly equal distance of each-other all across the globe. It has been around since the 50s, and is the first point of contact for nearly all of man's communication to the stars. 

The three antennas are located in California, Spain and Australia. This insures that no matter the time of day or position of Earth along its tilt, a signal from any direction can be intercepted. I don't know which of these three locations our photo really landed at, but let's say it was the one near Madrid, Spain. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wonlejj3ifzu8y86cygf.png)
 
Our photo only has a couple more stops. First it will most likely travel under the Atlantic via seafloor internet cables, through the heart of the continental US and straight to NASA's Jet Propulsion Laboratory in California. Here it will be processed, and eventually sent out to the public via a mixture NASA's own servers and word of mouth through the press. 

It will sit around for a while before some presumptuous tech blog writer copies and pastes its URL into a middling DEV.to post, for you to now enjoy. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82e2qywj3g920pdckll7.png)
 
It's glorious, it's everything I dreamed, it's...

Some tracks in the dirt. 

Well, *I* think it's neat! And now that you know how we got that picture you also know how we send data back to Ingenuity. That's right, if you reverse our steps throughout that entire process, you'd travel the same exact route that that first "deploy" command ran from the type of a keyboard on Earth all the way to our friendly little Helicopter buddy on Mars. 

Follow the data!