# Greg Klein's Blog

## LEDs on a String

Okay, so a friend and I got bored and decided to play with this idea. We attached a few leds to some thin string (we used dental floss), creating a pendulum. Then we turned off the lights, pointed a camera up, opened the shutter for about 25 seconds and released the led:

A 25 second exposure of a single red led.

And then we tried making a double pendulum by adding a second, green, led.

And again, but with two leds to create a double pendulum.

Double pendulums are neat! They’re incredibly complex despite their simple construction, but can be correctly modelled with math.

Here’s our setup for the double pendulum. And remember, if you decide to try this, use a resistor in series with each led.

The double pendulum with the lights on.

Written by gregklein

November 14, 2011 at 4:49 pm

Posted in math

Tagged with , , , ,

So I’m building a quadcopter. Here’s the project webpage.

A big part of the whole process is learning to fly. As I’ve never flown an rc aircraft before, it’s pretty tricky to learn on something you just designed and built. So, more often than not, I crash.

(Don’t worry, no permanent damage was done.)

Now a lot of these crashes are because I lost control or because I just can’t fly. But I think this one was very interesting. If you take a look at the video again, you’ll notice that I was tilting the aircraft back towards me when the rear motor seems to cut out, levelling the craft and eventually crashing it. I’m fairly sure that I had nothing to do with that.

What I think happened is that my quadcopter went into something similar to a deep stall. When the quadcopter is leaning forward too much, the rear rotor is sucking in turbulent air, and unable to provide enough lift.

As the quadcopter moves forward, the rear propeller gets turbulent air and can't provide lift any more.

I’ll be playing around with the thing soon and I hope to reproduce the conditions under which this happened.

Written by gregklein

October 20, 2011 at 11:51 pm

## Buddhabrot 4-Dimensional Rotation

I’ve been playing with fractals recently. More specifically, the Buddhabrot fractal.

The Buddhabrot set is closely related to the Mandelbrot set: $Z_{n+1} = Z^2_{n}+C$

The mandelbrot set is displayed on the complex plane, where one axis is the real component of $C$ (we’ll call it $C_r$) and the other is the imaginary component of $C$ (a.k.a $C_i$).

With the Buddhabrot set, we can add a few more axes. Instead of just using $C_i$ and $C_r$, we also use the real and imaginary components of $Z_0$ as axes. Whereas in the Mandelbrot set, $Z_0$ is assumed to be $0+0i$, in our 4D Buddhabrot set, we make these values variable as well.

So instead of the two dimensional image you’re used to seeing of the Mandelbrot set, we’ve instead got 4 axes: $C_i, C_r, Z_i,$ and $Z_r$.

Which leads us to our next problem — how do you visualise a 4 dimensional object on a computer? Well, it’s difficult. You obviously can’t just draw an image of it, or even just show a 3 dimensional picture of it. Instead, we show it rotation in 4 dimensional space.

So, here’s the result:

I’ve made all of this code open source — here’s the project page.

Written by gregklein

May 16, 2011 at 1:55 am

Posted in fractal

## BMP085 Pressure Sensor at High Altitude

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.

An IR photograph taken from about 85,000 feet.

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

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

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

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 sensor.network), 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.

.

All in all, a wonderful time.

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

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 sensor.network 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)Connector.open(datastreamURI+"/data");
conn.setRequestMethod("POST");
conn.setRequestProperty("X-SensorNetworkAPIKey", APIKey);
conn.setRequestProperty("Content-Type", "application/xml");
conn.setRequestProperty("Content-Length", sampleDataXML.getBytes().length + "");
OutputStream os = conn.openOutputStream();
os.write(sampleDataXML.getBytes());
```

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.

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 sensor.network, java