Saturday, November 26, 2011

Data Analyses

Ideally we should have collected data from the following sensors (in addition to the photos):
  1. Accelerometer
  2. Magnetometer
  3. Gyroscope
  4. GPS
To save power we allowed the phone screen to turn off a few minutes after loading it into the payload. Unbeknownst to us, SL4A or Android decided to shut down the motion and post sensors (1-3) in addition to the screen. We did not discover this until after retrieving the payload and as a result only have GPS data from the launch.


We logged GPS data every 5 seconds and set the receiver to update for position changes larger than 1 meter. Data were written to a text file (gps.log) with one line per reading and the following columns:
  1. system used to find location, either 1: gps or 0: network
  2. system time of update in milliseconds
  3. longitude in degrees
  4. latitude in degrees
  5. altitude in meters
  6. speed in meters per seconds
  7. accuracy in meters
We ended up with a 1751 line text file with lines 338 to 1008 containing information about the launch, ascent and descent. The log can be found here: Please post a comment if you find it useful.


Maximum Altitude

After recovering our payload, driving back to Cambridge ("our fair city"), we reconvened at the Rowland Institute to take a quick stab at analyzing our data. Our first goal was to determine the maximum altitude of the flight. This turned out to be more difficult than we expected. It turns out that the GPS receiver in the phone we used suffers from the more strict interpretation of the CoCom limits. Briefly, to prevent their use in ballistic missile type applications commercial GPS receivers are not supposed to work when moving faster than 1,900 km/h and/or at altitudes greater than 18,000 km. This max-altitude limitation can be seen in our gps data below (red points).
Our first quick and dirty attempt to reconstruct the maximum height was to fit a straight line (using two points just above 5 and 17km) to the ascent and straight line to the descent (using two points just below 17 and 5km) of the payload and calculate the intersection to determine the maximum height. This initial, and most likely flawed analysis resulted in a maximum height of 23,544 meters.
There are a number of potential problems with using this method to calculate the maximum altitude. First, although the ascent is remarkably linear, the descent is definitely non-linear. Second, our measure of ascent slope is inaccurate as it only uses 2 of the hundreds of ascent data points available. To fix these problems, we ran a second analysis, fitting a regression line to the ascent points, and a polynomial to the descent. This second analysis yielded a maximum altitude of approximately 23,540 meters, remarkably close to the first result.


Next, we wanted to compare the trajectory of our payload to the prediction generated from University of Wyoming's weather balloon predictor. To do this, we had to generate a Google Earth kml file from the gps log. The format and units of the gps log were selected to make this conversion easy. We copied columns 3, 4 and 5 from the gps log into this template: The prediction (purple) was surprisingly close to the actual flight (yellow).

Dynamical model

After discussing our plans and eventual success with fellow scientists at the Rowland Institute, one took it upon himself to construct a fluid dynamics simulation to model the balloon ascent. He was kind enough to post his code at along with a detailed readme describing the assumptions, how to run the code, and where the model deviates from the actual data.

Wednesday, November 23, 2011


The launch of Team Rowland’s space balloon was an overall success! We were able to send our payload of under 2 lbs up to a height of 23,540m and successfully retrieve it, all for less than $215! 

 A video of some of the best space photos we got can be found here. Space photos

We did this for an online hackerspaces competition here, and this blog describes the details of how we did it. Briefly, we used an 8ft weather balloon filled with helium, to lift our payload. The payload consisted of a canon powershot camera (with CHDK) taking photos every 10 sec, an android phone, scripted with SL4A and a pinhole camera. Yes that’s right you heard me a pinhole camera! This last item was included, as a tribute to Edwin Land (founder of Polaroid), who also was kind enough to build the research institute we work at, The Rowland Institute. We decided it would be a nice touch if we sent up some old Polaroid style film to get a photo from space. Several things in life are easy, for example finding a german called Joerg to use as a scapegoat incase things go wrong is easy, taking a photo from space using a pin hole camera is not. But I digress.

If you have made the decision to launch a balloon into space with the intent of photographing her
wild beauty, then there are several aspects to launching a space balloon you should think about in advance. The most important ones are; Launch site, weather, balloon filling, payload setup and payload retrieval. These will form the subheadings for the rest of the blog, so if you are stuck on a problem (and trust me, there will be many problems) feel free to skip to the part most appropriate, or not, you know whatever. Hopefully this blog will help anyone who is attempting such a feat.

The most important part of the balloon is of course the payload, what you are actually going to send into space. Generally there is a trade off between weight vs reward. You want to gather lots of information but more information usually comes at the cost of more weight to measure it. Also we were interested in making it as cheap as possible, not only for the competition, but because we are by nature, cheap.


We decided that the most important item would be a camera to take photos from space (the objective of the competition). We decided upon a second hand canon powershot from ebay. You should be able to pick one up fairly cheap. We found a canon powershot A570 for $43.99. The canon powershots are ideal as they can be fitted with the canon hack development kit (CHDK). This is some software which can be added to the SD card of the camera which greatly improves the functionality. Details can be found here (CHDK wiki) but these blogs can be a little overwhelming for the first time user, a friendlier blog is here (friendly CHDK blog). We were interested in this timelapse function called the intervalometer script (timelapse). We set the time between photos to be 10 sec (on our 2gb SD card this gave us 2000 photos), the shutter to 1/1000 sec and the aperture to f5.0, since it was a sunny day (using the cameras manual settings). I would suggest using a shorter time, (eg 5 sec) as the flight can be much shorter than expected, and we ended up with about 700 pictures of flight, and over 900 pictures of it sitting in a tree. Also a slightly shorter shutter speed (e.g. 1/2000) may make the images sharper, given we didn’t seem to be limited by light. 

Android phone
The android phone was the most important part of the payload. The phone would not only allow us to measure data on acceleration, GPS position and also take photos, but was responsible for SMS ing us its position in order for us to retrieve the payload. We were able to pick up a Motorola Cliq for T-mobile for $37.00 on ebay. We chose this phone since it was on the GSM network (rather than the CDMA network) and we could put a cheap pre-paid sim card in it, from t-mobile. This allowed us to answer the most important question in sending up a space balloon.
How the &*#@ are we going to find this thing?
So balloons theory is easy. Fill them with helium, they rise and expand until the pressure difference is great enough to burst the balloon. Then your precious payload comes crashing to earth. Now comes the hard part. How do you find the landing site?
Luckily, we live in the age of smartphones. You may have in your pocket (or hand) a device that contains a wealth of technology. The two most important bits for solving our lost payload problem are the cellular radio and the GPS receiver. The cellular radio allows you to make and receive calls, data, and text messages and the GPS  allows you to precisely determine your position not only on land but also in air! Combine these two parts, and we have all we need to transmit the location of our payload. Now all we need is some glue to put the two pieces together.

To control the phone during the balloon flight and after touchdown we wrote a short (~100 lines) script in Python that ran in the SL4A (scripting layer for android: app that runs on top of the Android operating system.  The script needed to read location data from the GPS receiver on the phone and the latitude, longitude and altitude as a text (SMS) message to us, the recovery crew. Although this portion of the script worked like a charm, we also included code to log the accelerometer, magnetometer, and gyroscope sensor data on the phone. However, this sensor logging was unsuccessful. Android (or SL4A) stops updating sensor data when the screen turns off. We decided that having the screen turn off was essential as it would drastically reduce the total power consumption of the phone (which was also taking pictures) to increase our chances that the phones battery would last throughout the launch, ascent, descent, and landing. I highly recommend adding an external battery if you decide to log sensor data during your balloon flight (you are doing this right? everyone should). The script we used can be found on my github account here:
In brief, the code has 5 parts:

1. (lines 5-12) Settings: The phone number to send messages to (more on that later), and various logging periods. The main period (line 6) determines how often the script will update. All other periods are relative to the main period. For example, a gps period of 5 means that every 5 updates of the script a new gps coordinate will be polled and logged. So, if period is 1, this means you will see a new gps coordinate every 5 seconds. If period is 10, you will see a new gps coordinate every 50 seconds.
2. (lines 15-23) Testing flags: These flags are for enabling or disabling individual parts of the script, limiting the number of update (maxtick) or controlling how the script logs data (logmode, bufsize).
3. (lines 25-28) Droid initialization: Get a copy of the android object (see SL4A for more info:, start the sensor (accelerometer, gyro, magnetometer), make sure the screen does not turn off, and fire up the gps.
4. (lines 30-37) Log file initialization: Open log files for writing, and other log related setup.
5. (the rest) Main loop: This loop runs for maxtick number of updates so be sure to set this to a very large number before launch or make it an infinite loop (e.g. while True:). Each section of the loop is checking if the update counter (tick) is a multiple of each period (gps, acc, pic, sms, etc...). If true, the script grabs and logs new data, takes a picture, or sends an sms.
Whew, now our payload is setup to transmit it’s location at regular intervals. Now, where should we send the message? This may seem like a simple problem, “send it to a cell phone of course!”. What happens if you have people in two cars, and/or a person at home acting as a base station looking up gps coordinate on a fast internet connection? The solution we found was the setup a Google Voice number ( that would forward the text messages from the payload to multiple phones. This allowed us to have a phone in each car receiving updates from the package.

Pin Hole Camera

First off, I do not recommend doing this. It ended up taking a long time (about 85% of total time!) to setup, and was only capable of a single shot. But since it took so long I feel someone need to know the pain we went through to set this up. Our first problem was opening up the shutter. This would have to be done onboard. We considered various options such as a servo motor, but in the end we found a cheap online shutter for $5 from surplus shed
It used a mirco-controller M51081P, but we were unable to find any information on this. We simply followed the traced the wires to the motors, and triggered them manually. The mechanism worked using a sliding catch, which when released by a motor on the back would allow the shutter to open untill the second motor was released. Which meant it could be controlled with a single pulse, the duration of which determined the shutter opening time.  
The pin hole itself was a 0.25 mm circle printed on a transparent plastic sheet, which was glued to the underside of the shutter. The shutter unit was then glued to a box, which would contain the negative. The depth of the box here is determined by the formula d= 1.9 sqrt(f . w) where d is the diameter of the pin hole, w is the wavelength of light (about 500 nm), and f is the focal length or depth of the box.                   
                                            So.... f = (0.25/1.9)^2 / 0.0005 = 34.62 mm. 

Getting the right film was difficult, i wanted to get a color photo which turned out to be a mistake. I used fuji films FP-100c type of film, which after several test shots meant i would need to have the shutter open for half a second. I thought this was short enough, but as you will see later, it was not. Instead i should have opted for the black and white FP-3000b film.
Finally to control the shutter we needed a micro-controller. I decided to use the MSP430 from TI, for its one amazing feature, its price! At $4.30 you cant beat it. We toyed with the ideas of adding an accelerometer, and having the sudden drop following the balloon bursting as the trigger for the shutter, but after some consideration of the potential problems this might cause we opted for a much simpler timing code, which simply waited for an hour before triggering the shutter. Finally the whole thing was powered with a 3.7 V lithium battery.

Box to put it all in
So you have assembled all the bits and pieces you need to take photos of space, and find your payload again. Now you need something to put it in. We used a Styrofoam box, which was about 27 cm wide x 22 cm deep x 16 cm high. We had one lying around the lab which we were able to use, but they can also be bought from for under $5. We used an old soldering iron to make the holes in the box such that the cameras can see out. Be careful at this stage, you want to make the holes large enough so that the camera can see out, but no so large that the camera will be exposed to the cold air of the upper atmosphere. The placement of the cameras inside the box is important to. We opted for a horizontal view, so we could see the horizon with the blackness of space above, but you could also face them straight down for different effect. We also tried to put the battery sections of the cameras and phones next to eachother. This was important as it reduced the number of heat packs we needed to add to stop the electronics from freezing. We found some heatpacks online (Grabber Warmers) and placed two inside the payload next to the batteries. We filled in the remaining space with some low density foam to act as a buffer incase of a hard landing. 

 Parachute for a soft landing
The payload is almost ready. Now you need the parachute, so that after the balloon pops, it will float gently back down to terra firma. We didnt want to cheap out on the parachute. We ended up buying our parachute online for $11, which was 30 inches across and claimed it would support 2 pounds, about the weight of our payload.
Attaching the parachute is a much more difficult task, which strangely we were unable to find much information about online. We tested a few strategies, but the most successful one is shown below in a diagram. The payload is suspended by 4 lanyards which come to a point about 25 cm above the box (these were actually the name tag holders that get given away at any conference). The strings for the parachute was then also attached to this point, but before we did, we threaded the strings through a thick plastic washer. The washer was large enough to freely slide up and down the parachute strings, but not large enough to let the chute itself slide through (we also added little beads to the top of the strings). The string from the balloon was then tied to the washer. In theory it works like the figure above. When the balloon is filled it pulls the washer up the strings closing the parachute, and reducing the drag. But once the balloon pop, the weight of the stopper on the balloon will pull the washer down, allowing the parachute to open, and float down to earth. Whether this worked or not we cant tell, but the video of the flight (link) shows it was quite stable during its decent (see 48 seconds onwards), and we had no damage to our box.    

In the end our payload weighed a little less than 2 pounds (877 grams), when ready for launch and cost less than $120.

Breakdown of the cost is:

Canon powershot = $43.99
Motarola Cliq = $37.00
MSP430 = $4.30
Camera shutter = $5.00
Parachute = $11.00
Box = $5.00
Heatpacks = $5.00

Total = $111.30

Finding a launch site is actually much harder than we originally thought. There are two important aspects to consider when finding a suitable launch site, typical weather patterns and FAA regulations. We found the University of Wyoming’s weather balloon predictor to be a valuable source of information. We would save the file as in klm format, then open it up in google earth

It turns out that the predominate wind direction in Massachusetts is from the South-west, this means our balloon was likely to travel north-east of our launch site. This ruled out Boston (the Home of the Rowland Institute for Science), as this would land the balloon in the icy seas off the coast, not an ideal outcome. Its a good idea to start checking the balloon’s predicted path a month or so in advance of your launch date so you have an idea of where you can expect it to land. In the end we opted to launch from New York State, as this showed the best chances of landing on dry land. At the end of a month my google earth map looked like this. You can see a second possible launch site we had identified in western Massachusetts was also rejected due to a large probability of splash down.
The second thing we had to consider with our launch sites was the FAA regulations. You are not allowed to launch the balloon within Air space classes A through to E
To avoid doing this we found the skyvector website very useful which shows a map of the airspace around the New England area (and also has maps for the rest of the US). We chose a site that avoided and purple rings, both at launch and importantly during the decent. Again predicting where the balloon is going to comedown is not easy, but the University of Wyoming’s balloon predictor turned out to be quite accurate. Here is a google earth image of the predicted pattern (purple) and the actual travelled pattern (ugly green and yellow).
Finally once you have found a general area which fits all these criteria, you have to narrow it down to an actual launch site. You should try to find an open area, without trees, or power lines. Generally school ovals are a good bet, especally if you are planning for a weekend launch, you might get lucky and no one else will be there. It is also a good idea to scout the launch site a few days in advance, to make sure there are no surprises when you get there.    
The weather itself on the day is important. The most ideal conditions are clear skies with low wind. Clear skies are important, since the FAA does not allow balloon launches when there is more than 50% cloud cover, so an early morning launch might give better chances of success. Finally low wind speed means that your balloon will travel less distance, and make payload retrieval easier for you.  

We got our balloon off ebay for $25.00 (with $15.00 shipping). It was a military surplus balloon made in 1982, so i was a bit worried about it. But it turned out to be quite good, apart from the skirt which we could not figure out a use for and ended up cutting it away. A second strange feature is that it fills from the top of the balloon, but more on this below. Firstly...

Where on earth do you get helium from?

Helium was critical to our ambitions, and it wasn't obvious where to get it from.  Some of the guys who've previously tried making a high-altitude balloon for photography have had access to Helium through work or school (for example, people on a physics degree course).  We could have gone down this route.  There are guys at the Rowland Institute who make NMR measurements; they apparently use loads of the stuff, and would have been willing to give us some.  Well, in some sense we didn't feel like this would be in the spirit of the competition.  We wanted to see if we could do this off our own backs without having to call in any `professional favours', so we hit the internet looking for helium.

There are a few places who will rent you a helium cylinder, for filling party balloons.  Most of the party shops in the Boston area that we phoned go through a main wholesale/rental place, so we were usually directed there.  The average `street' prices that we were quoted for a cylinder plus regulator (the important-looking bit with the dials that goes at the top of the cylinder!) were around $130, so considerably more than you may have expected, based on previous reports.  After some searching, we were rescued by the awesome Maureen from Boston Balloon Events who was willing to rent us a cylinder and regulator at cost price ($67), in the name of science!  This was a key moment in the project and we couldn't have done it without her - we are very grateful indeed!!  We picked up the cylinder in the back of Brett's truck, having acquired some ropes, harnesses, bungees and several large and heavy sandbags to secure it with.  A full gas cylinder is heavy and awkward, so we needed a dolly (one of those wheelbarrow things with two wheels) to carry it.

How do you get the helium into the balloon?

The helium regulator was fitted with a nozzle for filling party balloons with.  It was 3-4 four inches long, tapered towards the end and made of stiff rubber; to let the helium out you sort of bend the nozzle a bit.  It was a bit worrying having a great big metal cylinder with lots of sharpish bits on it so close to our balloon, so a filling contraption was in order.  We looked around our apartments and workplace until we found a suitably-sized piece of tubing (neoprene as it happened, though I'm sure other materials are fine), that was slightly too small for the regulator nozzle.  We then ran the tube under warm water to soften it up, and squeezed it onto the regulator.  This all happened at home, so the regulator was not yet attached to the cylinder; we were careful to avoid getting the regulator wet, as this can cause corrosion.  A couple of plastic cable ties secured the attachment. At the other end of the hose, we had to find a way of firmly fixing the hose into the balloon's filling nozzle.  The baloon's filling nozzle was made of pretty sturdy rubber, so we just pushed the neoprene hose into this.  It wasn't a snug fit so we folded a flap of the nozzle over, lengthwise with respect to the hose, and gaffa taped it as tightly as we could.  Just to be double sure, we used a couple of cable ties too, but they have fairly sharp bits on them, so we took care not to let these come into contact with the balloon.

The helium came out of the cylinder pretty fast in the end, even though we were quite careful not to let it out too fast because the gas temperature drops as it's depressurized, so we ran the risk of freezing the balloon.  `Quite fast' is kind of subjective, but if anyone was worried we just slowed down.  The whole filling exercise took about 15-20 minutes from start to finish. A necessary piece of equipment for the second stage of filling is a team member that is two standard deviations above the average height of an American male (greater than ~190 cm or 1 Joerg) to hold the hose/balloon seal once it is above the reach of the rest of the team.  In theory, once the balloon is filled the back pressure will keep the valve closed, but who trusts theory?  
 We wound, tied, wound, tied, wound, wound, and tied the bejesus out of the opening with some string to make ourselves feel better, then released the cable ties, cut the string, and disengaged the Joerg. We tested the free lift using pre-weighed bags of bolts till we achieved about 2 pounds of free lift, though this was difficult to test at the top of the balloon was still attached to the hose for filling. 

Finally we were ready to launch but what about crashing into aircraft?

This was a worry.  Apparently, there has been no recorded incident of a weather balloon/airplane crash, but we didn't want to be the first.  The FAA has some pretty clear regulations on what you should do, so we checked that out to start with.  Despite the fact that the Hackerspaces in Space rules meant that our balloon was likely to be exempt from the more serious regulations, we still thought it was worth checking out in more detail.  A couple of phone calls to various airports in the vicinity of the prospective launch site directed us towards Albany airport's FAA tower, which was apparently the local overseer of air traffic.  In fact, those guys were very helpful over the phone; they told us to give them the launch coordinates, and 15 minutes notice before we launched the balloon. 


We duly phoned this in, and there were no problems.  It's worth noting that in other parts of the world, the rules may be tougher.  For example, one thing we read led us to believe that the UK's CAA (FAA equivalent) seems to want a 28-day advanced warning before a balloon launch, though this may only be for special cases.  Either way, it's worth looking into the matter before launch day - you don't want to be breaking the wrong kinds of records!

The result? 

Up, up, up, and away. 

now the fun part. Getting it back.


The exact place that your balloon lands is still somewhat a mystery. We knew the approximate area from the University of Wyoming’s balloon weather predictor, and after we launched the balloon we quickly got into cars to the area where we thought it would land. There was a period of about an hour where we stopped receiving txt messages from the android phone in the payload. We had expected this since we expected it to be out of mobile reception range, and even even if we could we could not get its position since GPS units are restricted above 60,000 feet. Apparently up there, its pirate airspace.
Anyway after about an hour of radio silence, i was pretty sure the balloon was lost, and i would never see my new cell phone again (which i had become somewhat attached to). 

Then we got the first message. It was on its way down!! and was only 20 miles from our location!! A second message confirmed that it had landed, somewhere in the green Mountains about 10 miles north of Route 9. We were over-excited. We rushed there, following the GPS location, which led us up a driveway, and to a log cabin in the mountains. Our GPS told us that the balloon was about 200 m behind the house, so we knocked on the door, and we greeted by a lovely couple Lisa & Carleton “Toby” Munsill. They allowed us to go into their backyard and retrieve the balloon. 
However their backyard ended up being a mountainside, and so we accended the mountain looking for our payload. 40 minutes later Laurence spotted it, 40 foot up in a tree!!
Our first attempts to bring it down were fruitless, and so we went back down the mountain to fetch the climbing gear that we had thought to bring along. Also our hosts, Lisa and Toby, much to my delight, lent us a bow and arrow, and a length of yarn. Back at the tree, we attempted climbing, but there was almost no way to get up the tree who’s lowest branch was a good 25 feet up. Our idea now was to try get a line up over the branch, then pull up successively heavier ropes. We attempted the bow and arrow with limited success as the weight of the arrow was not enough to overcome the friction of the yarn with the bark. Eventually the winning formula was to attach a heavier rope to a short heavy bit of wood, which had enough weight to pull down the length of rope. Luckily we also had Andy, our resident sports star, who’s arm was good enough to throw the stick 40 feet in the air. Once we had a rope over the offending branch, we hauled up some heavier rope, then attached some several bungee cords with hooks on each end (an ingenious idea from Laurence). We brought the hooks up close to the payload, then swung the rope around to hook one of the lanyards....and SUCESS! a retrieved package! 

So what did we get out of it? Well here is a look at the timelapse video from the Canon power shot
In the end our accelerometer data didnt work as the sensors in the android appear to turn off when the screeen is turned off. However, we did get GPS data, and from this we were able to estimate a top height of 23,500 m or about 77,100 feet. Not bad for a first attempt. 
In the end our project cost under $215.

Here is a breakdown of the costs

Canon powershot = $43.99
Motarola Cliq = $37.00
MSP430 = $4.30
Camera shutter = $5.00
Parachute = $11.00
Box = $5.00
Heatpacks = $5.00

Helium = $63.00 
Balloon = $40.00

Total = $214.30

 Brett has promised to write a following blog detailing more about the data we managed to collect, but untill then there is nothing left to do but thank everyone involved, and everyone who helped us. John Chervinsky for the pin hole camera, Lee and Alyssa Whitcher for allowing us to stay in their house in New York, and finding our launch site, Maureen from Boston Balloon Events , and Lisa & Carleton “Toby” Munsill from vermont, and of course, TEAM ROWLAND.