Greg Klein's Blog

BMP085 Pressure Sensor at High Altitude

with 5 comments

Tim, Alex, and I launched a balloon in September of last year. On it, we flew an IR camera, pressure sensor, and a GPS on an Arduino and an APRS tracker.

IR view from 85,000 feet.

An IR photograph taken from about 85,000 feet.

Sensors and Arduino

The sensors and Arduino getting ready for flight

With this sensor configuration, we were able to get GPS data from above 60,000 feet (at which GPS usually shuts off), and compare this with the pressure sensor we were flying, a BMP085 we bought from sparkfun. The datasheet for this sensor states that it’s rated for pressures as low as 30000 Pascals, or about 30,000 feet above sea level.

Pressure vs. Altitude

Pressure vs. Altitude

However, it seems that it worked for higher altitudes, too. At the highest altitude we reached, 26898 meters, the BMP085 recorded a pressure of 1781 Pa, or about 27350 meters above sea level.  So it seems that the BMP085 works at altitudes above 30,000 feet, just not as accurately.

Written by gregklein

January 19, 2011 at 6:45 pm

Posted in arduino, balloon

Tagged with

Maker Faire

leave a comment »

For those of you who don’t know, May 22-23 is Maker Faire in San Mateo. I’ll be there with my friends presenting our balloon from September and discussing our newer plans.

If you’re interested, here’s our maker profile.

Written by gregklein

May 18, 2010 at 2:41 pm

Posted in balloon

Tagged with

Balloon Tracking with a Mobile Phone

with 2 comments

Okay, so please read my last post if you haven’t already.

Anyway, now that we had a cheap tracking device, we decided to do what any reasonable people would do: send it into near-space. Or, at least, that was the plan.

So our last balloon cost $800. While $800 is pretty cheap considering what we did, we’re all college students, and we haven’t got that sort of money to spend all of the time. Last launch, we spent over $250 on our tracking system (by the way, an excellent device), some $80+ on our balloon, another $80 on helium, $30 on our radar reflector, and $50 on the parachute.

So we decided to replicate a typical launch, but this time to do it as cheaply as we possibly could. We’ve already got a $50 tracking unit (the i290 cell phone uploading data the, so now we just need some way to lift it and make sure it lands safely.

In order to do this, we needed a cheap balloon, a parachute, and a radar reflector.

We built the radar reflector out of aluminium foil and foam, sewed the parachute, and found a cheap, 6′ party balloon. $45 for helium at the local Diddams and we were set.

Just before launch

We launched on December 31st, 2009 from just outside of Los Banos, CA. We inflated the balloon with several pounds of lift, and the balloon rose very quickly. At 641 feet, the phone left cellular coverage and began queuing up GPS readings, ready to send them off when back in cellular range, and all we could do was to wait.

We were periodically checking the internet for tracking information, and about an hour later, we began to get readings back from the balloon. We quickly discovered the the balloon had landed after only going to an altitude of around 6,000 feet (more about this later).

We jumped into our cars and drove to the landing site about 30 miles away.

Alex and Tim standing over the payload after landing.

The payload was in perfect condition, and the i290 phone was still on and reporting data just fine.

Now, about the 6,000 feet: it looks like we cheaped out when buying our balloon. There’s still a bit of contention over this, but it looks like a ‘real’ weather balloon has a higher percentage of latex than that of a party balloon. Our party balloon simply was not designed to expand to the same extent as a weather balloon, and burst at 6000 feet. Really, we should have just gotten a weather balloon — it looks like the small ones are just as cheap as the party balloon we bought ($20).

The good news is that we were able to successfully demonstrate that our tracking system worked. I threw together a little webpage that we used to track the thing on the day of the launch. Forgive me, it’s very rough around the edges.

And, if you’re too lazy to click that link, here’s a picture of our GPS trace.

The GPS trace for our balloon.


I also threw together a Google Earth KML file of our GPS data; download it here.

All in all, a wonderful time.

Grand total for this project (not including burritos and gas): $145. Not bad.

Tim has also got written about this on his blog.

Oh, and about the code for the phone. I’m not going to release it (at least right now): it’s far too ugly and hackish for me to release to the public. If you email me, I’ll probably send it to you with a long note explaining why it’s no good and you shouldn’t trust it.

Written by gregklein

January 10, 2010 at 2:41 am

Prepaid Phones, Sensor.Network, and Java

with one comment

So school is out for the year, and I’ve got some three odd weeks off — plenty of time for side projects.

Anyway, I picked up a really cheap prepaid cell phone a while back for $50, with $5 prepaid credit on it. Neat thing is that it runs JavaME and has a cheap GPS unit built in. Overall, the thing feels pretty flimsy and cheap, but I still can’t believe it was $50.


The phone in question.

Anyway, Tim and I wrote a small bit of code to read the latitude, longitude, and altitude coordinates from the GPS unit on the device and upload it to via a $0.35/day internet connection on the phone.

The code to post the sensor data was just a slightly modified bit from yggdrasil (actual source file is here).

HttpConnection conn=(HttpConnection)"/data");
conn.setRequestProperty("X-SensorNetworkAPIKey", APIKey);
conn.setRequestProperty("Content-Type", "application/xml");
conn.setRequestProperty("Content-Length", sampleDataXML.getBytes().length + "");
OutputStream os = conn.openOutputStream();

If you do take a look at the original source, you’ll notice that I had to change only a very small bit around; Java ME doesn’t have the URL class, so I had to open things up with a Connector; other than that, it was pretty straightforward.

So with a bit more code to sample the GPS, I’ve got a $50 GPS tracker that uploads data to the internet.

With Sensor.Network, I can graph where the phone is.

GPS Trace

A trace of the phone's location; you can tell that the GPS isn't very good.

Fun stuff.

Written by gregklein

December 15, 2009 at 1:47 am

Posted in java,

Balloon Follow-up

leave a comment »

As promised in previous posts, we’ve now got a website dedicated to our balloon; we’ve reserved the domain specifically for this sort of thing.

A full write-up, graphs (via, and all of the photographs are posted.

Written by gregklein

October 22, 2009 at 8:10 pm

Posted in balloon, spaughts

Payload Recovered!

with 2 comments

If you’ve been following the blog, you’ll know that my friends and I put a balloon into near space. You’ll also know that we didn’t get the payload back immediately.

Well, we’ve got great news; the payload was successfully recovered!

We gathered a team of 3 bicyclists and 5 hikers and went to Henry Coe Park today. The bicyclists made it to the landing site well before us hikers, and they found our payload.

Fortunately, we had some GPS coordinates come in over APRS on Saturday, which made the search much more likely to succeed. The bikers found the payload in a tree.


Considering how far off course the balloon went, it’s remarkable that we were able to recover the thing.

When we got back to the cars, we disassembled the still-intact payload.


Everything was in remarkably good condition, so we took a look at the images; we’ve got 9 gigabytes of photograph; a little under 3000 pictures in total. A SunSPOT in the science payload was also able to record some 600 sensor readings.

We’re totally swamped with sensor readings and photographs, so I can’t post everything here (yet!). I’ve found a few images I consider to be some of our best; I’m still trying to find somewhere to put the rest.

The balloon is still tied to the jeep.

The balloon is still tied to the jeep.


And we're off!


This was very close to the highest altitude we reached.

The entire San Francisco Bay is visible from up here.

The entire San Francisco Bay is visible from up here.

I’ve got thousands more, but I’m going to stop uploading for now, until I can find some sort of sane hosting that we all agree on.

I’ll be posting some our sensor data and more pictures later, and hopefully a full breakdown of the project.

Written by gregklein

September 13, 2009 at 9:31 pm

Posted in balloon, spaughts

Balloon Launch!

with 2 comments

My friends and I launched the high-altitude weather balloon today. This morning at 5:00 AM, we set out to drive down to our launch site. A bit of scouting later, and we had found a nice quiet spot to launch. At about 10:15 AM, the fog burned off and we got our balloon off the ground.

Anyway, quite a few things here didn’t go to plan. If you were following me on Twitter, you noticed a few things:

  • The balloon went North instead of East. We ended up in Henry Coe State Park rather than the central valley, as we had planned. This is an issue because our landing site in Henry Coe is much harder to reach, as the terrain is much more rugged.
  • The balloon had very little buoyancy. I had thought it would be useful to have the balloon rise slowly so that it could make its way over the hills, but it seems like it was far too slow. We were planning on a 3 hour flight-time and we ended up with something like 5 or 6 hours in the air. I don’t know yet how our experiments and imaging responded to the longer mission.
  • Telemetry failed to function on the ground. We were relying solely on digipeaters to relay our information to the internet and then to us.
  • We were not able to recover the payload today. We’ll be looking a bit more closely tomorrow for the payload, and we’re all still quite hopeful that we’ll find the thing.

All in all, it was a very fun experience. Hopefully we’ll recover our payload — stay tuned for updates.

Written by gregklein

September 9, 2009 at 10:08 pm

Posted in balloon


leave a comment »

Okay, so it looks like we’re going to launch tomorrow.

I’ll be keeping a twitter feed of everything, you can follow us through the day here:

Even if we don’t recover it, I’ll have a few more posts on the contents of the payload.

Written by gregklein

September 8, 2009 at 8:34 pm

Posted in balloon

Balloon Parachute Test

with one comment

Okay, so my internship is done at Sun Labs, and I’ve got about 3 weeks until I’m leaving for Santa Cruz.

In the time that I’ve got, I’m working on a project with my friends, Tim and Alex. We’re planning on sending a high altitude weather balloon into near space (roughly 90,000 ft).

The parachute arrived in the mail the other day. It’s 5 ft wide and designed for rockets. We weren’t actually very sure about the size, so we decided to test before the actual flight. We’re pretty sure our payload will be about 5 pounds, so we tried to figure out how fast a 5 pound weight would fall with the parachute attached.

So how do you test a parachute?

Well, our first thought was to drop it from somewhere high. So Alex climbed up on the roof, and we dropped the thing.

Unfortunately, the roof wasn’t as tall as we would have liked it to be, and the parachute did not inflate. Not terribly useful for finding descent rate.

So we thought about the problem for a while, but couldn’t find any taller places from which we could drop things.

The only other option was to test horizontally rather than vertically.

The idea is as follows: we attach the parachute to the back of a car and drive. When the parachute pulls on the car with a force of 5 lbs, the speed at which the car is traveling is the terminal velocity of our 5 lb payload and parachute.

So, in lieu of a proper scale for this sort of thing (likely a fish scale), we found a kitchen scale and made that work.

Tim and Alex got into the car and I chased behind to make sure the parachute got airborne and didn’t drag too much.

When the scale hit 5 lbs, Tim stopped accelerating and noted his velocity. We measured a terminal velocity for a 5 lb payload to be 12 mph.

More to come on the payload and other details.

Written by gregklein

September 1, 2009 at 8:07 pm

Posted in balloon

Tagged with

Using the Ubiquiti as a Yggdrasil Sensor

leave a comment »

My last post focused on using the Ubiquiti Wifi Access Point as a gateway to connect a SunSPOT to the internet (in this case, Twitter).

But we can also use the Ubiquiti as a sensor. The immediate utility that appeared to me was to use the Ubiquiti to scan for wireless networks and to get their signal strength. So let’s get started.

If you’re using a Linux box at home, you can scan for wireless networks using the command

root@localhost:~# iwlist scan

You’ll see an output something like this:

          Cell 01 - Address: 00:1E:4E:AB:CC:DF
                    Frequency:2.412 GHz (Channel 1)
                    Quality=97/100  Signal level:-29 dBm  Noise level=-127 dBm
                    Encryption key:on
                    IE: Unknown: 0007426967526F6F6D
                    IE: Unknown: 010482848B96
                    IE: Unknown: 030101
                    IE: Unknown: 2A0100
                    IE: Unknown: 2F0100
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: 32080C1218243048606C
                    IE: Unknown: DD0700039301660000
                    IE: Unknown: DD06001018020100
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    Extra: Last beacon: 3492ms ago

Now there are three lines in this that we’re interested in. The first one states the MAC address of our access point. Next, we want the line describing the ESSID (the “name” of the network), and, finally, the line showing us how strong our signal is, in dBm.

Now whenever I have a bit of text parsing to do, I always go to Perl. Unfortunately, I haven’t got enough space on the Ubiquiti’s measly 4 MB of flash to install Perl. Instead, I’m writing all of this in Bash. So I wrote a small shell script in Bash that parses the output from our iwlist command and prints only the useful information:


aplist=$(iwlist ath0 scan|grep 'Address\|Signal\|ESSID')

for line in $aplist; do
	if [[ "$line" =~ Address ]]
			echo $line | sed 's/://g' | sed 's/.*s //g'
	if [[ "$line" =~ ESSID ]]
			echo $line | sed 's/.*:"//g' | sed 's/"//g'
	if [[ "$line" =~ Signal ]]
			echo $line | sed 's/.*Signal level=//g' | sed 's/ dBm.*//g'

echo "done"

Alright, let’s walk through that really fast. First thing I do is grab the output of our iwlist command and extract the useful lines (the ones containing Address, Signal, or ESSID), and put all of that into variable $aplist. I then step through the lines one by one and extract only the most useful information.

So the output now would look something like this:


Neat. Now I’ve got to come up with a clever way to send it back to our SunSPOT.

head -n 1 /dev/ttyS0 > /dev/null
./ > /dev/ttyS0

So now I just wait for the serial to hear a new line character ‘\n’ and then I can pipe the nicely formatted list back to my SunSPOT. Perfect.

Now I need a bit of logic over on my SunSPOT side of things.

        do {
            byte[] buffer = new byte[in.available()];
            read += new String(buffer);
        } while (read.indexOf("done") == -1);

That’s all we need to send the newline character and read in our list of APs.

Now to get that data back to I’m running a project called Yggdrasil on my Spot so that I can report my sensor readings back to

A bit of code later and I can get a nice look at how my wifi signal strength varies over time.


How about for all of the access points in the building?
The cool thing about using is that I can now, say, try to correlate these readings against humidity, or other sensor readings in the area.

Written by gregklein

August 4, 2009 at 3:26 pm