Aerobatic Flight Data Recorder

by Joe Havelick 13. November 2010 14:48

Note: to view the .kml files in the article, you must download and install Google Earth.

The Concept

Among my various hobbies, I fly aerobatics and I dabble with electronics. When flying competative aerobatics, which I started last year, you a gauged on the accuracy of your performance of certain maneuvers.  ex. A loop should be a perfect circle, otherwise, you lose points. That being said, it's hard to do these things correctly, and you never get to "see" your own performance.

I needed a project to occupy my mind, so I decided to that I should build a flight data recorder that would allow me to track certain aspects of my flight such as 3d coordinates in space, G forces, roll rates, and possibly even cockpit voice. But certainly, the most useful would be the 3d position data. This could be done with a basic GPS unit, as they are able to not only determine your point on earth, but your altitude as well. With the help of an Arduino, I was able to build a device that would capture 1 data point per second and write it out to an SD card. I could then feed the data to a very cool utility, GPS Visualizer, which can take standard NMEA output:


...and convert it to a number of useful outputs, most particularly Google Earth, such that the flight could be viewed in a 3d world.

Flight Test Alpha

The first flight was a bust. The unit never got a GPS lock, so I collected no good data. My passenger ended up barfing. I was not a good day for technology or aviation.

Flight Test Beta

1286892046-21655- (217.07 kb)

I decided that it would be quite expensive to go flying every time I needed to test the unit, so I asked a friend to take the unit up on one of his flights. The pilot was doign 3 ILS simulated approaches, which brought him from Hanscom Air Force Base to Manchester to Portsmith and back to Hanscom. It was a total success. You can not only see the entire flight track in detail, but pan around and see the elevation of the flight as well.

Note: Color coding is used to indicate groundspeed.

Flight Test Charlie

1286892076-21704- (120.55 kb)

Having had a successful test completed, I decided to take it up for aerobatic testing. Everything appeared to work well, until I looked at the results:

Basically, the GPS unit I was using didn't like being inverted, or moved around a 4+ Gs. The altitude data was all wrong, and it "flattened" the whole flight. Also, my (different) passenger got sick. Back to the drawing board.

I decided I would replace the unit with a better unit that would sample at up to 4 times per second, had a omni-directional antenna, and was able to be configured to expect to be diving at 100 knots and pulling 5 Gs. Upon testing, I found that the unit would only reliably sample at 2 times per second. So with the unit rebuilt, and some coding modifications to handle the higher throughput more efficiently, I set out for...

Flight Test Delta

1289677643-30373- (118.64 kb)

Instead of bringing someone for this flight, who would inevitably get sick and force me to truncate it prematurely, I decided to go it alone. I spent about 25 minutes doing loops, spins, half cubans, and the like. It was a good flight and I thought would yield some interesting data. When I got back on the ground, my heart sunk to see that the unit was not running. The power was still on, and the connections were solid. I concluded that the battery had been drained. It was a new 9v to begin with, so this think was sucking power. I would have to wait and see how much data I collected.

Once I got home, I eagerly uploaded the data, expecting to be disappointed. I was not.  It got all of my acro.  It died seconds after my last loop. I didn't get to see my landings, but this was cool.  As for accuracy, it was well beyond my minimum expectations. Take a look:

A loop, looking a little pinched, but not bad.

Two separate 45 ups to a 1 turn spin (foreground) and 1 and 1/4 turn spin (background).

The whole ride.

Clearly, I'm very happy with the results and look forward to continued progress on both this project and my aerobatics. I highly recommend downlaod ing Google Earth and viewing the above .kml file. It's way cooler when you can pan around.

The Unit

So here's what it looks like:

The black box (no pun intended) contains the 9v battery to power the unit.

On the right is the unit itself.  It contains:

That's it.

Future Potential

Here are a few things I'd like to do with it in the future:

  • Capture  up to 9 degrees of motion. This includes acceleration, rotation, and magnetic direction. This will allow me to better present the flight, since the current data indicates nothing about flight attitude. If I feel like getting real geeky, I could use this data in coordination with the GPS to get a more accurate display of the flight track
  • Audio. I would love to be able to "playback" the flight with narrations about what's going on, and my thoughts for later anaysis.
  • Migrate to a Netduino. Writing code for the Arduino is not exactly fun. I spent hours debugging my code, and going for test drives in my car. I'm a .NET guy, so the prospect for building this thing in Visual Studio with the Compact .NET framework sounds too good to be true.  I believe it has more memory and a faster processor as well. for $5 more, it's a no brainer. Sadly, I didn't find out about this until after doing it all on an Arduino.
  • Better power efficiency. Chewing through a 9v battery in just over an hour sucks.
  • Better battery. Perhaps a rechargeable lithium battery will also serve to give me more runtime.


Aviation | Tech Tips


by Joe Havelick 1. November 2010 19:05

I've recently been caught up in Minecraft, a simple but elegant game. Think of it as a giant walkthrough Lego kit. Although, I can't say I've been as caught up as others:

I've always been a fan of "creation" style games, where the objective is whatever you want. This really shows a lot of potential, while still in alpha.



Send email notification if databases are not backed up in specific duration.

by Joe Havelick 10. May 2010 14:15

Backup utilities may notify you when a backup fails, but don't provide coverage for you forgetting to set the job, or not having permissions to a certain resource. As part of my protection plan, in addition to regular notifications, I like to know if a database HAS NOT been backed up for any reason within the past two days.  The following script accomplishes this.

Note that this utilizes Database Mail and a DBMail profile called "Default DB Mail Profile". These must be manually configured.  More information can be found here.

DECLARE @Threshold DATE = CONVERT(DATE, Getdate()-2) --The cutoff from when we consider backups to be current (2 days before the end of today)
DECLARE @SendEmail BIT = 0
DECLARE @emailbody VARCHAR(2000) = 'The following databases have not been backed since before ' + CONVERT(VARCHAR(32), @Threshold) + ':
 @DatabaseName VARCHAR(256)
 @LastBackupTaken VARCHAR(256)

  SELECT                                                              AS databasename,
         Coalesce(CONVERT(DATE, MAX(t2.backup_finish_date)), 'Not Yet Taken') AS lastbackuptaken,
         Coalesce(CONVERT(VARCHAR(32), MAX(t2.user_name), 101), 'NA')         AS username
  FROM   sys.sysdatabases t1
         LEFT OUTER JOIN msdb.dbo.backupset t2
           ON t2.database_name =
  WHERE  database_name NOT IN ( 'TempDB' )
  HAVING Coalesce(CONVERT(VARCHAR(32), MAX(t2.backup_finish_date), 101), 'Not Yet Taken') < @Threshold

--Open Cursor
OPEN emailcursor
FETCH NEXT FROM emailcursor INTO @DatabaseName, @LastBackupTaken, @UserName
      SELECT @SendEmail = 1
      SELECT @emailbody = @emailbody + '<LI>' + @DatabaseName + ' (' + @LastBackupTaken + ')</LI>'
      FETCH NEXT FROM emailcursor INTO @DatabaseName, @LastBackupTaken, @UserName
CLOSE emailcursor
DEALLOCATE emailcursor

SELECT @emailbody = @emailbody + '</UL>'

IF @SendEmail = 1
      EXEC msdb.dbo.Sp_send_dbmail
        @recipients= '',
        @copy_recipients = '',
        @subject = 'SERVER Database Backups',
        @body = @emailbody,
        @body_format = 'HTML',
        @profile_name = 'Default DB Mail Profile';


Tech Tips

List SharePoint site owners

by Joe Havelick 6. April 2010 11:21

I recently had some issues with site owners on my SharePoint sites.  Specifically, one of the sites didn't have one altogether.  The frontend and command line tools all reported "User could not be found".  This also derived from the error "You cannot delete the owners of a Web site collection" when attempting to remove a user for a dead account. 

If you find yourself in that predicament, the following SQL query can be run on any of the content databases to determine who (if anyone) is currently the owner or secondary owner of each site:

SELECT webs.fullurl,
       webs.title,                 AS siteid,
       owner.tp_login           AS ownerlogin,
       sites.secondarycontactid AS owner2id,
       owner2.tp_login          AS owner2login
FROM   sites
       INNER JOIN webs
         ON = webs.siteid
       LEFT OUTER JOIN userinfo AS owner2
         ON sites.secondarycontactid = owner2.tp_id
            AND = owner2.tp_siteid
       LEFT OUTER JOIN userinfo AS owner
         ON sites.ownerid = owner.tp_id
            AND = owner.tp_siteid 

Tags: ,

Tech Tips

Determine how my SQL memory is being used

by Joe Havelick 26. March 2010 12:22


Tech Tips


by Joe Havelick 5. March 2010 20:31

It was a beautiful weekend, warm and clear skies.  I decided to take a spin in a Cessna 172GA.  I convinced Naomi, who expressed some concern about flying in such a small plane, to come with.Being alumni of Worcester Polytechnic Institute (WPI), we decided to take  spin by the old alma-mater; a short trip out and back.

A fairly normal preflight was contrasted by an unusual run-up.  In testing the magnetos, I found that the engine would flat out stall on the left only setting.  Usually, a dirty injector can be cleaned by leaning it out and running the engine hot for a minute, but this only seemed to make the problem worse.  No sense in flying on one magneto, so we taxied back to the ramp, and traded in for a plane that won't leave us halfway to Worcester on the side of I-90.  This made Naomi happier.

Took off, did a little flying around, steep turns, stalls and the likes, and then did a flyover of the Worcester airspace.  Then we setup for a straight in approach to runway 29.  This put us in perfect range of the WPI campus and gave us the shots we wanted.  A quick touch and go in mild crosswind, and we were on our way back to Bedford.

Naomi described it as "better than she thought it would be".  And no one threw up.  Mission accomplished.



About Me

Joe Havelick is a reasonable facsimile of this photo.

profile for Joe on Stack Exchange, a network of free, community-driven Q&A sites