Greg Klein's Blog

Archive for the ‘spaughts’ Category

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 hibal.org specifically for this sort of thing.

A full write-up, graphs (via sensor.network), 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.

IMG_0682

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.

IMG_0729

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.


IMG_6978

And we're off!


IMG_9415

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

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
                    ESSID:"Sun"
                    Mode:Master
                    Channel:1
                    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:tsf=00000017288f01d0
                    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: ap_scan_and_format.sh.

#!/bin/bash

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

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

done
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:

001E4EABCCDF
Sun
-29

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
./ap_scan_and_format.sh > /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.

        out.write("\n".getBytes());
        do {
            byte[] buffer = new byte[in.available()];
            in.read(buffer);
            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 sensor.network. I’m running a project called Yggdrasil on my Spot so that I can report my sensor readings back to sensor.network.com.

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

wifi_chart

How about for all of the access points in the building?
All_Wifi_APs
The cool thing about using sensor.network 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

Ubiquiti and Spots

leave a comment »

A significant part of sensor networks, is, well, the network. The radio on the SunSPOT is designed for low power consumption, and works well in relatively short ranges, something like 50-100 meters at the very most. When a stronger radio is required, you’ve got to do something else.

Spot_and_ubnt

The black PCB in the picture is an Ubiquiti NanoStation2, with a range of several miles over Wifi. Below, of course, is a SunSpot. They’re talking to each other over serial, which is provided on the Ubiquiti (actually, as it would turn out, most routers seem to have serial on the board). To make it a bit easier to use, I put OpenWRT on it so that I could take advantage of their package management (I can run Perl!), and other niceties.

Anyhow, the whole thing was remarkably easy to do once I disabled the existing output on the serial. Apparently OpenWRT, by default, has a console running on the included serial.

I had to edit /etc/inittab and remove the line:

ttyS0::askfirst:/bin/ash –login

Once the serial was free, I just set the parameters using stty, and can now write to the serial using the command

cat > /dev/ttyS0

And read from it with

cat /dev/ttyS0

Writing to serial is easy with a Spot:

StreamConnection serialStream = (StreamConnection) Connector.open("edemoserial://usart?baudrate=9600&databits=8&stopbits=1&parity=none");
InputStream in = serialStream.openInputStream();
OutputStream out = serialStream.openOutputStream();

Pins D0 and D1 are Rx and Tx, respectively.

I think I’ll tie it up with some Perl to report values back to sensor.network.

Written by gregklein

July 30, 2009 at 5:18 pm

Posted in java, spaughts, sun

Tagged with , , , ,