Even before I joined MailChimp a couple years ago, I recognized the company's affinity for geeky, interesting ideas and services. It was obvious that MailChimp employees had a thing for building powerful and fun stuff for their customers.
And so early last year, when John Foreman posted this inspirational video—featuring a kid's toy train being sent into the stratosphere via weather balloon—to our internal social network, it seemed only fitting that MailChimp try a launch of our own. We chose one of our Freddie plushies as a passenger, and I immediately set to work.
Our CEO Ben was psyched on the project. He mentioned Ham, the first chimpanzee launched into space, under the U.S. spaceflight program Project Mercury. Just like that, our endeavor had a sweet, Queen-referencing name: The Freddie Mercury Project.
One big question remained, though: Could we send an email from the stratosphere?
OK, maybe a couple other questions remained. Such as, "Why?" But also, "Why not?"
Out of this world planningWe spent the next few months trying to figure out the best way to send an email from 100,000 feet above the earth. Sending an email would be easy, but establishing a data connection from that elevation? Maybe not so much.
We researched using an amateur radio to broadcast the data to a central machine on the ground—but that meant the machine on the ground would be sending the email instead of the device in the balloon. And cell phones generally don't work higher than 20,000 feet, so it wouldn't be wise to depend on one for connectivity. In order to use a radio, we'd need a computer on the ground that could capture the data from our payload and then send the email out. Our balloon would need to be self-sufficient from the time we let go of the string to when it reconnected with the earth.
Instead, Larry Ellis of Earth, Air, and Space helped us figure out an alternative data connection. He referred us to Git Satellite Communications, which specializes in Iridium satellite modems. They loaned us a fairly hefty Iridium 9522a satellite modem with all of the connections and cables that we would need to establish our data connection during Freddie's stratospheric journey. Thanks, Git Sat!
Let's get technicalOur goal was to create a payload that would be carried by a balloon into the stratosphere without any interaction from us once the balloon was launched. Our setup was fairly elaborate. Below are the components that made up the payload:
- Thick, medical grade foam cooler that housed all of the items. (Temperatures in the stratosphere can drop way below freezing, so many people use these type of coolers for high-altitude balloon projects.)
- Kaymont HAB-3000 weather balloon filled with hydrogen. (Helium is expensive and difficult to obtain.)
- Six foot recovery parachute
- Raspberry Pi Model B running a minimal install of Raspbian Linux
- Raspberry Pi camera module pointed down for pictures of the ground as the payload floated upwards
- Iridium 9522a satellite modem with external antenna (The modem was connected to the Raspberry Pi via a RS232->USB adapter. We used wvdial/ppp to connect to the modem.)
- Two Anker 10,000 mAh external battery packs: one to power the Raspberry Pi, one to power the modem
- SpotGPS to retrieve the payload once on the ground
- Two DS18B20 one-wire temperature sensors connected to the Raspberry Pi: one internal, one external
- Byonics GPS4 connected to the Raspberry Pi via a RS232->USB adapter
- Four-port USB hub to accommodate all of our devices connected to the Raspberry Pi
- Logitech C910 webcam connected to the Raspberry Pi
- Two GoPro Hero2 cameras used to record video of the flight from ground to sky and back (Our goal was to create a 3D video after the fact, but it ended up less impressive than we'd hoped.)
- Nichrome wire attached to the balloon's rope (Nichrome wire glows red with heat when voltage is applied across it. This was our cutting mechanism to release the balloon from the payload, should anything have gone wrong during the flight.)
- 9.6 Volt NiCad battery with a custom circuit for the cutting mechanism (The cutting relay was interfaced with the Raspberry Pi using the GPIO pins on Pi.)
- Two Freddie plushies: one in front of the webcam, one in front of the GoPro (Both Freddies were attached to opposing wooden dowels.)
- Packing foam surrounding all payload contents
Our test setup components
Gathering dataAll of the information included in our emails was captured in real time by the Raspberry Pi. The altitude, speed, and climb rate were all captured from the Byonics GPS. The internal and external temperatures were captured from the DS18B20 one-wire sensors. CPU temperature and the amount of time in the air were pulled directly from the Raspberry Pi.
To calculate the distance traveled, we used a PHP script using the Haversine formula. The distance was calculated using the payload's current latitude and longitude by using the static latitude and longitude of our launch location.
The "distance from team" value was pretty fun to put together. I used an app on my iPhone called Btraced Track and Trace, which ran during the duration of the balloon's airtime. The application ran on my phone and recorded the current coordinates of the tracking team. The developers provided methods to push location using a web call to a remote server. We set up a Linux machine on the web running a web server. And periodically, my phone would reach out and post the coordinates of the tracking team to that server. Upon sending the campaign, the Raspberry Pi would make a web call to find out my iPhone's last location. From there, the value for "distance from team" was calculated using the Haversine formula. (Here is the Haversine PHP script we used to calculate the distance between two points.)
Interfacing our code with MandrillWe toyed with sending the email through MailChimp, but when we were trying to include a live image for the webcam, we realized Mandrill's inline attachment option with the API would be much easier. Without Mandrill, we would've had to figure out a way to upload the image to a remote server, then reference it in the email. The uplink on the Iridium satellite modem was very slow (2.4kbps), and we wanted to minimize any data that we were sending. By including the image in our Mandrill API call, we could upload the image and send an email all in one swoop.
My teammate Van put together the sending code for Mandrill using curl and PHP. The backend data—temperature, GPS coordinates, speed, altitude, webcam image, down camera, etc.—was captured via a handful of shell scripts, then sent over to the sending code. (Here is the PHP script we used to send our data through the Mandrill API.)
Stratosphere or and bustLarry put us in touch with Stuart Enroe of Balloon Atlanta, who helped us with the filling, projected flight path, and launch of the balloon. He also gathered all of the hydrogen and mechanisms needed to fill the balloon.
It took us three test launches (Jan. 27, March 9, Sept. 10—all 2013) to figure out how to send emails from the stratosphere. Our inaugural mission helped us get a feel for what it would be like to launch a high-altitude balloon. That mission didn't include our satellite modem, either, as we wanted to test the GoPro, the Raspberry Pi, and the Spot GPS.
Our second launch was supposed to be The One, but we ran into a critical issue with some of our code. Our campaigns sent fine in testing, but we were working up to the last minute to finalize the payload and all the code. In our rush, we never got to actually test the code in an automated way. It's embarrassing to say, but our failure to send email on the second launch was caused by not specifying the full path to PHP in our Mandrill API call. The code worked fine as we were testing on command line since the location of PHP was known by our shell, but once the code was added to cron for automation, the location of PHP wasn't known, and the scripts continuously failed to send.
On our third—and what would be final—launch day, Stuart filled the balloon as our team secured the payload contents and prepared Freddie for his stratospheric journey. This required quite a bit of duct tape and zip ties. Once the balloon was filled, we turned on the power supply for the Raspberry Pi and GoPros. We were ready to launch.
As soon as the balloon took off, we grabbed our phones and started refreshing our email. We waited until we saw the subject line we were looking for: "Freddie is here: 34.106713333,-84.45062."
It worked! And 10 minutes later, another email! We were ecstatic, but we still had to follow the balloon to the end of the mission.
Pre-launch, we'd used the Cambridge University Spaceflight Landing Predictor to predict where our payload would fall. Based on the prediction, we started driving west of Atlanta, watching the emails show up every 10 minutes.
We drove out to Cedartown, Ga., which was within 20 miles of the predicted landing area. There, we got lunch and watched with anticipation as the emails flowed in, focusing on the altitude: 85,744 feet, 89,642 feet, 93,351 feet, 96,726 feet, 66,207 feet... Wait, what?
The balloon had popped.
From our previous two test launches, we knew that even after the balloon had fallen we'd have to wait for our SpotGPS to update so we could find the payload. We took the coordinates of the last email (sent during the balloon's fall at 29,994 feet) and started moving toward that location. While driving, we received confirmation that the SpotGPS was working and that the payload had landed.
It ended up on the edge of the woods in a town called Centre, Ala. We spoke with the property owners, who seemed fascinated that a) we were from Atlanta, and b) a weather balloon we'd launched from Atlanta ended up in their yard. They happily let us walk the property until we found it.
Freddie's fall back to earth from peak altitude took 30 minutes. The distance the payload traveled from launch to landing was 62 linear miles and took approximately 3.5 hours, from ground to sky, then back to ground. During the mission, our setup delivered 20 emails, 14 of which were sent from the stratosphere.
The campaign sent from peak altitude
An airplane flying by airborne Freddie
Mistakes were madeNow that I've been at MailChimp for a couple years, I've realized that one of the best things about working at this company is that we're given the permission to be creative. And what that really means is that we're given the permission to try something new, permission to fail, permission to embarrass ourselves, permission to have crazy ideas. Sending a plushie chimp into the stratosphere definitely qualifies as a crazy idea. And we definitely failed multiple times along the way. But that's part of any successful journey, right?
One of those mishaps occurred during our second launch. We realized we needed to use a much larger balloon than we had on the first launch, because when we added the satellite modem, that upped our payload weight, which necessitated a bigger balloon to carry it. The rope connecting the balloon and parachute wasn't long enough to compensate for the balloon burst, and when it popped in the stratosphere, the leftover latex got wrapped around Freddie's dowel. With everything tangled, the payload fell to the ground way faster than we'd anticipated. The dual GoPros were nowhere to be found once we recovered the payload on the ground. To this day, we still believe a couple of "the world's most versatile cameras" are at the bottom of a small pond outside Athens, Ga. Guess that's just the price you pay for putting the first plush chimp named after a beloved dead rock star in space. Cue triumphant ballad.