[singlepic id=13 w=480]
On my adventuring blog, I’ve grown to enjoy posting GPS track logs and photos as well as text upon returning from a trip. Since I was going to be on the road/water for a long period of time, I wanted a means of posting updates with the same rich content from the field – not just when I returned.
I’ve had a Nokia N800 internet tablet for a few years now, having received it as a gift from a very generous customer. I’ve gotten a surprising amount of use out of it, taking it with me a few times when traveling to keep in touch, check email, etc. It seemed the logical choice as a platform to use to cobble together a system for doing field reporting for my blog.
One thing the N800 does not have is a physical keyboard. This was addressed on the N810 with a slide-out keyboard. I haven’t used one myself, but I imagine it’s a vast improvement for light typing like typing in URLs and instant messaging and email use. I tend to be a little more wordy than the N800’s on-screen keyboard, or even the N810’s slide-out keyboard would support, so I sought a better keyboard solution. Thankfully the N8xx devices support standard Bluetooth keyboards, and iGo makes a cool folding keyboard that packs down very small when collapsed. I had picked one of these up before traveling to Sweden last year, and was mostly happy with it once I got used to the extra modifier keys required for numbers and symbols.
The next problem that needed addressing was power. The N800 has a tiny, but fairly stout lithium battery that lasts 5 or 6 hours under average use. I was planning to kayak tour for a week and then bike tour for another week, neither scenario giving me nightly power for recharging. I was concerned about battery life, so I looked into different solutions for keeping the unit charged while away from civilization. I looked quite a bit into solar solutions, and ended up quite taken with the Powerfilm rollable solar panels. I envisioned being able to strap such a panel to the deck of a kayak, or across the top of the BOB trailer that I was towing on the bike, to recharge my gear during the day. Ultimately, I decided the cost was a bit too high for these trips, so I gave up that daydream.
Instead, I decided that a simple auxiliary battery pack to recharge the Nokia in the field would be a better solution for the kind of usage I was planning for. I happened across the charging spec for the 2mm connector that many Nokia devices use. I figured a 6 cell AA NiMH pack would be ideal – very simple, no boost converter, and it should put the device into the proper charging mode. So, off I went and spent some quality time with my milling machine and fabricated a 6 cell AA holder (I checked the local Radio Shack first – they didn’t have 6 cell holders). Unfortunately, I should have done some homework first – I discovered that 6 cells would kick the N800 out of charging mode repeatably, so perhaps it doesn’t follow the charger spec exactly. On the plus side, I did discover that five cells seemed to work reliably. A few more minutes with the milling machine and I had created a “dummy cell” which would allow me to use my 6 cell pack as a 5 cell pack. Easy enough.
With power out of the way, I moved my attention to pulling GPS track logs from my Garmin GPSmap 60CS. I’m a big fan of the XML Google Maps plugin for WordPress, so I really wanted to be able to post daily logs of where I’d been traveling. The first issue to address was connectivity – the 60CS has a USB port and a serial port, either of which I could conceivably use to accomplish this task. The N800 on the other hand, doesn’t really offer much in the way of connectivity other than what appears to be a USB device port in the form of a mini-B connector. I’d known for a while that the hardware has supported USB OTG mode, and there were some software hacks available to flip the port into being a host. I kludged together some cabling to test this out and it indeed worked – I was able to get a USB thumb drive to enumerate on the device, so I knew that USB had a good chance of being the best path.
I set out and made a USB mini-B to mini-B cable by cannibalizing a couple of leftover USB cables I had lying around. While I could have carried a heap of odd adapters and such to accomplish the connection between the N800 and the GPS, I wanted something compact. I also knew I didn’t want to mess around with flaky adapters and such in the field. Once I built the cable, I was able to plug in the Garmin and see that it enumerated, but the OS2008 kernel on the N800 did not have the proper Linux drivers for the device.
This was rectified by installing the Maemo development environment on a Linux virtual machine on my desktop PC, and recompiling the kernel to build the drivers as modules. This is kind of a pain in the neck, but I found some documentation that helped. To save you the pain of this, here’s a tar file with the needed drivers! Untar them someplace on the filesystem of the N800 and then just insmod them.
Once the drivers are loaded and the port is flipped to be a host, the Garmin device will enumerate and the drivers will load. A USB serial port device will appear, typically at /dev/ttyUSB0. The last piece required to do something useful with this is a utility to pull track logs out of the device. Thankfully, gpsbabel is a nice open source command line tool for doing just that. I built gpsbabel in the Maemo development environment and copied it to the filesystem on the N800. From there, I could execute it and pull out track logs, waypoints, etc., from the Garmin. Here is a tar file with the gpsbabel files built for OS2008. It’s not a nice installable package or anything, so you’ll need to find a place to untar them. I made a directory /opt/gps for all of this stuff.
Blog posts are a bit dull without photos, so I needed a way to collect a couple of pictures each day to include with the post. I recently picked up a nice point and shoot and a waterproof enclosure, so I was at least able to take lots of photos and video while on the water and on the bike. Handily, the camera uses SDHC cards, and the N800 can read SDHC with the latest OS2008 release. This at least made the files accessible on the device, but scaling the images down to reasonable size before uploading was paramount. Especially since I was going to be piggybacking on whatever connections I could find (cellular data, wifi, etc.), small file size was important to keep upload times low.
Thankfully after trying to build ImageMagick for OS2008 and having it mysteriously fail to work, I discovered the built-in image viewer, while rudimentary, could at least scale and rotate images. Good enough for this project, I figured. I decided the easiest technique would be to find the photos I wanted to include using the viewer on the camera, since this was much faster than browsing on the N800. Once I noted the file names of a couple of photos, I used the file browser and copied the files to a particular directory on my internal memory card. From there, I’d view, resize, and if necessary, rotate the images. The scripts that did the collating and uploading would check that directory for files and link them into the blog post as well as make sure they were uploaded to my host.
Gluing It Together
All of the major pieces were falling into place, but I needed some glue to tie everything together and at least make the process easier to deal with every night when writing up the day’s events. I realized early on that trying to use the WordPress user interface to write up the posts was going to be cumbersome, and didn’t allow for me to write up posts on nights when I was unable to get internet access. I decided I could live with a bare-bones editor, and installed Leafpad on the N800. This editor seemed fast and light enough for the purpose of banging out a few hundred words each night.
The rest of the glue came in the form of a series of shell scripts which automated some of the mundane tasks of pulling the track logs off of the GPS, creating a bare blog post file that contained references to both the GPS track log file as well as any photos present in a particular directory, and finally, uploading it to my host and pushing the post into WordPress. Here are each of the scripts that I wrote. They’ll obviously need to be modified for your own purposes if you decide to try to do this yourself.
The gpsdrivers script is simple – it loads the GPS driver kernel modules.
#!/bin/sh cd /opt/gps insmod usbserial.ko insmod garmin_gps.ko echo GPS modules installed.
The gpsgetlog script pulls the GPS track log from the GPS, saving it as a GPX file with a filename containing the current date.
#!/bin/sh GPXDIR=/media/mmc2/gpslogs DS=`date +%Y%b%d` TS=`date +%H%M%S` OUTFILE=$GPXDIR/$DS-log.gpx cd /opt/gps/gpsbabel chmod 755 gpsbabel ./gpsbabel -i garmin -o gpx -t -f /dev/ttyUSB0 -F $OUTFILE echo log file line count: wc -l $OUTFILE sync
Next, the editblog script creates a blank template post, and includes references to any images it finds, and today’s GPS track log. It then fires up leafpad to allow editing of the post.
#!/bin/sh GPXDIR=/media/mmc2/gpslogs IMGDIR=/media/mmc2/images DS=`date +%Y%b%d` TS=`date +%H%M%S` OUTFILE=$GPXDIR/$DS-blog.txt if [ ! -f $OUTFILE ] then echo "Live blog entry created $DS $TS" > $OUTFILE cd $IMGDIR for f in *.JPG do echo "<A HREF="http://www.someblog.com/wp-content/uploads/live/$f" rel="shadowbox">" >> $OUTFILE echo "<IMG SRC="http://www.someblog.com/wp-content/uploads/live/$f" width=360></A>" >> $OUTFILE done echo "<A HREF="http://www.someblog.com/wp-content/uploads/live/$DS-log.gpx">[gpxelevation=hide]</A>" >> $OUTFILE fi leafpad $OUTFILE wc -l $OUTFILE sync
Lastly, the postblog script does what it says on the tin. It is responsible for copying images, the GPX track log, and the blog post up to my host via scp. Then it executes a script on the remote end that injects the post directly into WordPress. It’s worth pointing out that I set up SSH host keys ahead of time so I wouldn’t have to type in my password for all of the scp/ssh operations.
#!/bin/sh HOSTNAME=bloghost.domain.com USERNAME=user UPDIR=/path/to/wp-content/uploads/live GPXDIR=/media/mmc2/gpslogs IMGDIR=/media/mmc2/images DS=`date +%Y%b%d` TS=`date +%H%M%S` GPXFILE=$DS-log.gpx BLOGFILE=$DS-blog.txt cd $IMGDIR for f in "*.JPG" do scp $f $USERNAME@$HOSTNAME:$UPDIR done scp $GPXDIR/$GPXFILE $USERNAME@$HOSTNAME:$UPDIR/$GPXFILE scp $GPXDIR/$BLOGFILE $USERNAME@$HOSTNAME:$UPDIR/$BLOGFILE ssh $USERNAME@$HOSTNAME "~/wp-post/post.pl $UPDIR/$BLOGFILE"
There is one final script, which I will not include in its entirety here. This script runs on the blog host and is responsible for injecting the post into WordPress. I based this on some code I found from Tim Johansson, which required only minimal modification to work for this purpose. I have it installed in my home directory on my hosting server, under the wp-post directory. You can see the last instruction of the above script is to run that script on the hosting server.
All of the scripts can be downloaded as a tar file for your own use. No warranty, no guarantee, no nothin’!
One difficulty when you’re out on the road or on the water and away from civilization is network connectivity. On the kayak trip we lucked out and were able to get cell phone access each night. With the use of a Palm application called USBModem (a bit of a misnomer since it works over Bluetooth as well), I was able to get a data connection and push blog posts each night. The bike trip proved trickier, as my friend had an un-jailbroken iPhone which didn’t support tethering. I was able to find occasional Wifi access and made a couple of posts. I am sure if I made more of an effort, I could have found access when we were near civilization and could have pushed up posts more often.
The N800 and the iGo keyboard are both relatively fragile devices. I wouldn’t want to leave them unprotected, banging around with camping gear, or in a position where they could get submerged during a wet exit in a kayak. To address this, I shopped around a bit for a case that would afford some level of water proofing and shock protection. I found that a Pelican Micro Case 1060 was a good size to fit my technology that I wanted to carry and keep dry. With some brainstorming and a small amount of custom foam work, I managed to find a way to package the following into the case: N800, iGo keyboard, custom battery pack (with 5 batteries), four spare AA NiMH batteries for the GPS, one spare Canon battery pack for my camera, power cable, USB cable, cell phone. Conveniently, the case also can be used as a makeshift work desk, holding the battery pack and N800 as well as propping up the keyboard.
Pelican claims the case is not really intended for submersion, and I agree – it’s not built as well as their nicer cases. But it’s small, fairly cheap, and waterproof enough that I wasn’t too worried about it. The kayak trip certainly was the worst possible environment for it, and the bike trip was quite a bit less demanding. It sailed through both with ease.
The system is definitely a motley collection of machining, electronics, cables, software, scripts, bailing wire, and chewing gum. It is not for the faint of heart, or those without a perverse affinity to technology even when out adventuring in the wild. However, it was a lot of fun to write up posts each night, while the thoughts of the day were still fresh in my mind. I know a few of my friends enjoyed following the progress of the trips while I was away, and I’m sure it gave some extra piece of mind that we hadn’t sank the kayaks or crashed the bikes.
The GPS logs generally required some hand-massaging to clean up a few errant data points. It would have been nice to have figured out a way to automate that process, as I basically had to leave goofy looking track logs posted until I got back to civilization and could use a GPX editor on my desktop PC to fix them.
Many improvements would make the system more usable, such as actual support for writing blog posts and backlogging them until connectivity was found. As it was, I had to do some manual script editing if I couldn’t make a post each night before midnight. Also, integrating the various pieces into a single GUI application on the Nokia would really be ideal. Command line tools and raw HTML text editing is fine for someone like me, but I think there is potential for this to be an interesting tool for less technical people who travel a lot and want to post to a blog. Newer devices like the iPhone integrate a lot of the pieces such as camera and GPS into one platform. While the GPS or camera aren’t particularly great, the iPhone’s virtual keyboard is miserable, and the battery life is a major issue, I think the future success of something like this will come from integration.
All in all it was geeky and fun, and I’m glad I put the effort into it!