Jason Madigan

He's just zis guy, ya know?

High Altitude Adventures - Part 2

Following on from my previous post, I’m going to go into a little more detail as to what we’re planning and what I’ve built so far - hopefully it will be of interest!

The payload (or safeload as I’m now calling it) is now complete. It consists of:

Payload

It took a while to piece together the kind of parts I needed. I originally thought I could use an old Arduino Diecimila that I had lying around, along with a nice EM406-A GPS module that I’d used before. Unfortunately, the Diecimila only had 16KB of flash (2KB taken by the bootloader), and it looked like I’d need at least 32KB.

I bought an Uno and initally everything was going well - I had the EM406-A hooked up and was processing NMEA with relative ease, thanks to the great TinyGPS library. The NTX2 arrived a little later - this is when the problems began.

Software Serial Ports

I planned to transmit telemetry throughout the flight with the NTX2. To do this, I was going to use RTTY (simple frequency shift keying) to encode telemetry and transmit. This worked fine in isolation, so I then hooked up the GPS again and tried to send some telemetry. There were weird errors in the RTTY transmission that I spent a few days tracking down late at night. The problem in the end turned out to be the SoftwareSerial port I was using.

Uno’s only come with one hardware UART, and it’s wired into the USB port via FTDI. It was available to use, but it’s fiddly and it’d mean swapping things around when it came to programming over USB (which I needed to do a lot of, since nothing worked!), so the EM-406A was hooked up via a software serial port. Arduino’s SoftwareSerial is interrupt driven so NMEA data coming in on the SoftwareSerial port would trigger an interupt - RTTY transmissions are timing sensitive, so these interrupts interfered with transmission and introduced errors.

Once I’d figured out was going wrong, disabling interrupts and having a “quiet period” for RTTY transmissions seemed to mostly fix things. Half way through uncovering the fix, however, I got frustrated and ordered an Arduino Mega (which has 4 hardware UARTs). When the Mega arrived, things got a lot simpler - lots of complicated timing logic could be removed.

RTTY

I’ll post more about this later, but here’s a short video of an RTTY transmission of some telemetry:

High Altitude Adventures

A few weeks ago, I spied a video on YouTube via Reddit - some guys had gotten together and put some cameras high up into the atmosphere (100,000ft, ~30km). I looked at it and thought it seemed like a good use of time. I got talking to a friend of mine at work about the possibilites of launching something like this from Ireland. As it turned out, some people from launched successfully from Kerry a few years back.

My initial plan was to launch something simple: a helium filled 800g balloon with some kind of cheap Android phone taking snaps every now and then. After watching lots of YouTube footage, and lots scouring through resources such the UK High Altitude Society, our plans evolved. Dan was keen for a more elaborate payload (it involves a fixed wing glider, some servos and a death spiral - I’m sure he’ll tell you all about it). Eventually we settled on the idea of sending two payloads on one flight.

Initial Questions

One of the first things that I wanted answering was whether or not it was actually legal to launch a high altitude balloon in Irish airspace. As it turns out, the IAA have a pretty comprehensive document on the subject here. I’ve yet to receive permission to launch from them, but I am hopeful.

Problems

In the first few days, with some whiteboarding during lunches and late night conversations, we came up against some issues.

  • Initially, Android devices looked like a good idea for simple flight computers. We had some ideas to develop some FeedHenry powered Apps to record and relay basic telemetry to a Node.js app - we’d use WebSockets to pipe data back in realtime. Knowing how flakey your average cellular data network is, I had my doubts this would work. A bigger problem, though, was that GSM was unlikely to work at anywhere near the altitudes we were interested in.

  • We largely started out with no idea of how much this was likely to cost. Our guestimates of maybe €200 each were blown in the first week of parts acquisition (for me at least).

Lifting Gas

Helium looked like the best lifting gas, since it was inert and it’s relatively cheap. Or it was - this isn’t the case anymore. Poking around, we found many places offering balloon helium for party balloons. This, as it turned out, wasn’t good enough for our purposes. Your average party balloon gas is only about 30% helium - the rest is usually air. We’d heard some estimates from others that 9cubic meters of industrial helium from BOC costs about €600 (including tank rental) - which is pretty extraordinary.

Jekyll

Way back in November, 2008, I read an article by Tom Preston-Werner which detailed his approach to blogging and blogging software. For years I’ve been trying to use one terrible CMS or another. The idea of sitting down to write yet another CMS to tackle some of the issues I have with blogging software really didn’t appeal to me. Remembering his article, I started poking with Jekyll. I had a pretty good idea of what I wanted:

  • Simplicity
  • CLI-based editing
  • Posts in a plaintext format, with formatting in a really lightweight markup language like Textile
  • Static content generation – if you post something popular, chances are you’re going to start flushing “dynamic” content out to disk as static HTML. Why bother waiting to write posts out as static files?
  • No comments — as far as I’m concerned, the effort required to manage spam and user comments simply isn’t worth it.

Irish Weather App Live on the App Store

I was bored three weekends ago and had an idea for a simple Irish weather app. Met Eireann have tons of great data available to the public, but finding the good stuff was a little fiddly. Anyway, after a weekend of work in Photoshop and Xcode, I had a pretty nice app. It was finally approved late last night. It’s free to download, so feel free to give it a spin.

Irish Weather 1.0

The Day a Time Capsule Died

This is the first Apple product I’ve owned that’s died since my old Apple ][. The hard drive seems to be fine though. Plugged it into another machine and it works just fine. I guess all that heat killed the logicboard. I guess it had been warning me with a few months though – its DHCP server had become very flakey over the past few weeks.

Oh well, time to dust off my old dependable WRT54GL.

Node.js - Event Driven, Non-blocking Web Servers Written in JavaScript

I’ve been fiddling with Ryan Dahl’s Node.js event driven I/O framework for the V8 JavaScript VM over the past couple of days. It’s probably the coolest piece of software I’ve come across in ages, and it really builds upon one of JavaScript’s core strengths: event driven programming. If you’ve been looking to brush up on your event driven programming, it’s seriously worth taking the time to play with. As part of his work on Node, Ryan has also released a seriously cool tiny HTTP parser in C (and used by Node). At 128 bytes per connection, it’s perfect for use in any embedded environment which could do with some HTTP love, like the Arduino.

Bluetooth/USB Tethering & MMS for O2 Ireland With iPhone OS 3.0

Update #2: These carrier settings will work with Beta 2 also. Also, Safari likes to attach a .zip extension to the ipcc, so either rename the downloaded file minus the extension or use Firefox/curl something else to download the updated carrier settings.

Update: Updated the MMS proxy settings, the previous version was using an old (dead) proxy. To update just re-download the carrier settings and apply an update once more.

After a little dicking around prompted by some stuff I noticed on twitter, I cobbled together this updated carrier bundle for O2 Ireland to enable USB/Bluetooth tethering for iPhone OS 3.0. This also enables the sending/recieving of MMS messages a new photo button will appear in Messages.app to send pictures as MMS messages.

Grab it here.

To install, option (alt) click update in iTunes, and select this updated IPCC.

If something terrible happens, you can grab a backup of the old one to restore here.

Trip Report - #fowadublin

I attended FOWA Dublin Friday last, and had a pretty good time. The speakers were the main reason I attended, with DHH & Simon Willison delivering particularly great talks. There were a couple of things that bugged me about the event setup. Not to be a jerk or anything, but there’s a few points I hope the Carsonified guys take a look at and fix in time for next year:

  • Poor WiFi – I know the guys have apologised about this already, but it stuck in most people’s craw and I guess it bears repeating. With 400 odd people milling about with iPhones and Macs some decent WiFi would’ve been nice.
  • Socialising is kind of hard when you’ve got absolutely no room to move.
  • I don’t really care about toilets, but I heard there was only one bathroom for guys and one for girls.
  • Lack of freebies. The tickets were pretty pricey (although I’d guess individuals paying for their own tickets were in the minority). Basically the only thing given away was a name-tag & holder. Free coffee for breaks or something would’ve gone down nicely.

Using Cookies to Calculate a User’s Timezone

A few days ago I discovered a quick & easy way few to use cookies to help your Rails app get a user’s timezone, without prompting. It’s pretty easy to implement:

First up: set a cookie, any cookie:

1
2
3
4
5
6
var date = new Date();
// returns offset from GMT in minutes
var offset = date.getTimezoneOffset();

// set a cookie however you see fit, I like to use jQuery.cookie
$.cookie('timezone', offset);

Then, in application.rb or wherever you like:

1
2
3
4
5
6
7
def browser_timezone
  return nil if cookies[:timezone].blank?
  @browser_timezone ||= begin
    min = cookies[:timezone].to_i
    TimeZone[(min + (-2 * min)).minutes]
  end
end

The cookie gives you minutes from GMT, but ActiveSupport::TimeZone expects seconds from GMT.

Anyway, hopefully someone will find my pointing it out useful. It may buckle under pressure (with daylight savings), but guessing and getting it right 50% of the time is better than forcing user interaction. Probably.

An iPhone App Is Born

We finally saw our first iPhone app land on the App Store a couple of days ago. iPhone app development is pretty wonderful in comparison to some of the other crapheaps out there, but it’s also pretty damn nice by itself too. It was a ton of fun to write, and it was nice to do something like it for a local paper, The Munster Express.

Check it out here