Building notes, projects, and occasional rants

GPS fun

So there are all this ingredients floating around:

  • a nice Fortuna GPSmart BT: it has a mini usb that can be used for power, but I still prefer to fetch the NMEA feed over Bluetooth;
  • a Macbook with BT;
  • a 3G phone with good connectivity in Portugal, also with BT;
  • a ejabberd server with PEP support, so I can publish my User Location.

The glue of course will be Perl, and the first step is already working. This program will print my location once per second:

use strict;
use warnings;
use lib 'lib';
use GPS::NMEA;

my $gps = GPS::NMEA->new(
  Port => '/dev/cu.GPSmart-SPPslave-1',
  Baud => 9600,

while(1) {
    my($ns,$lat,$ew,$lon) = $gps->get_position;
    print "($ns,$lat,$ew,$lon)\n";

This is a pure copy-and-paste version of the script in the GPS::NMEA manual page, it just works (after you set the correct Port), and it was my first version.

I did get some warnings, so be sure to download and install the latest development version of perl-GPS (You must specifically tell cpan to do it).

Next steps: hack some bot with Net::XMPP2 to publish this information.