Time lapse photography with a Canon Powershot G2 on Linux


This is something that’s sort of been bugging me for a while. Not that I really want to do a lot of time lapse photography, per se, but that I want to be able to tell my camera to take a bunch of pictures, say one every 15 seconds for a certain amount of time (which is essentially what time lapse photography is). Out of the box, my ancient PowerShot G2 doesn’t support this. There’s software that can do it for you, but most of it a) costs money and b) runs on Windows. Which is a problem since the only device I have that could potentially use this feature — e.g. something that is mobile — is my laptop, which runs Linux Mint. So, here’s the setup, what I needed was:

  • Remote capture software
  • …that supports automatic, timed images
  • …from an old Canon Powershot
  • …that runs on Linux

Too much to ask? Actually, no.

Google is your friend

The first thing I found — after hitting several photography forums and finding various Windows apps — was Canon Capture. It hits the nail on the head, but indicates that it might not work with older Powershot cameras, including the G3. I figured the chances it would work with my G2 were pretty slim. But it also referenced gPhoto, so I took a look at that.

gPhoto is pretty much everything I could hope for with the small exception that gtkam — which says it’s a “graphical front-end for gphoto” in the documentation doesn’t actually have all the controls available of the commandline interface. It’s really just a memory card browser, which isn’t what I wanted. When I did a apt-cache search gphoto I also found Entangle which is pretty awesome. It lets you remotely capture the camera from your computer — everything you can do on the camera (and then some), you can do inside the app, including take a picture and automatically download it to your computer instead of the camera’s memory card. However, it still falls short of letting you take a bunch of pictures over a period of time, you can trigger the shutter, but you can’t automate that.

Back to gphoto

Finally, I did some more Googling and found this tutorial which uses gphoto’s commandline interface which is really robust. He used a command like this to take a bunch of shots, but acknowledged that your mileage may vary with regard to specific settings and features, whether they are enabled or controllable from gphoto (not all are):

gphoto2 --set-config beep=0 --set-config flashmode=0 --set-config resolution=3 -I 20 -F 3150 --capture-image-and-download --filename "%Y%m%d%H%M%S.jpg"

Well there were a couple things with that that didn’t work. First of all the resolution on the G2 said it wasn’t configurable. And the filename was saving everything as December 31, 1969. But I found that the filename is getting renamed anyway, so I could just drop that and the resolution setting. After some tweaks, this is what I came up with:

gphoto2 --set-config beep=0 --set-config flashmode=0 -I 20 -F 10 --capture-image-and-download

The -I is how many seconds before each snap and the -F is how many pictures to take. This worked great, but I didn’t want to have to enter in a bunch of code and remember all the parameters every time I wanted to do this. So I wrote a bash script.

bashing my head into the keyboard

Bash scripting is not my strong suit. To the uninitiated, bash is the command line language of unix-like operating systems, and a bash script is something that will execute a bunch of stuff on the command line. But you might want to do things like add variables or get user input, so you’d write a script that could do it. I wanted my script to ask how often to shoot and how many shots to take and then start the process. I had to do some research to refresh my memory on how to take user input, but once I did, the script was simple and effective.

The script

echo "How frequent do you want the images (seconds)?"
read seconds
echo "How many images?"
read number
gphoto2 --set-config beep=0 --set-config flashmode=0 -I $seconds -F $number --capture-image-and-download

PeppermintOS: Minty Fresh!

A while ago, I decided it was time to get a laptop.  I’ve been meeting with local clients more and having a laptop handy would make a lot of that stuff go more smoothly.  I’m also on the web committee for my kids’ school, and have had to borrow someone else’s laptop to do WordPress demos and show them things.

So, I started looking around at netbooks and my first thought was to (of course) install Ubuntu.  But after initially throwing a distribution of Linux onto a thumb drive and finding out that the thumb drive installation of Ubuntu is 2GB and requires you to format the drive (meaning I couldn’t use it for other things as well), I instead used Puppy Linux, which worked well for that.  Then I became aware of PeppermintOS via someone on Empire Avenue.  I took a look at the screenshots and read the descriptions and the mission statement and thought it would be perfect for the netbook I didn’t have yet.

Fast forward to now.  I don’t have a netbook, but I do have a hand-me-down Dell Latitude from my father-in-law who was looking to get a new laptop as well.  I helped him pick it out (a sweet Acer Aspire with 6GB of RAM and a 640GB hard drive — most of which will go unused since it’s been set up to do most of his work on the cloud) and I set it up and migrated his old Outlook file over to keep his email archives while he migrates to using Google Apps for email and docs.  (The conversion process went remarkably smoothly with the help of Dropbox for backing up his entire My Documents folder and syncing it up on the new machine.)

Once I said goodbye to his brand new laptop, I said hello to the old one and immediately pulled out an old Ubuntu 10.04 disc I had lying around.  I started the install — wiping the hard drive clean of Windows XP — and in an hour or so was looking at an Ubuntu desktop with one problem — though the sound worked beautifully, I wasn’t connected to the internet.  I quickly realized/remembered that most Linux distros don’t really like the wifi adapter in Dells and require ndiswrapper or some other hack to get them to work.  I tried to dig out the documentation and remember how I dealt with this last time, but gave up quickly — having no internet access (and being too lazy to dig out my extra ethernet cable) as well as running an old version of Ubuntu just didn’t seem worth the trouble to get it running right.  I decided to download the current version and use that instead.

Of course, part of the problem with Ubuntu is that it’s bundled with Firefox, and I rarely — if ever — use Firefox these days.  I wondered if there was a fork of Ubuntu that came with Chromium instead and started looking around when I remembered Peppermint, with its two flavors — one built with Firefox and Prism, and the other built with Chromium and Ice (a variant of Chrome’s application shortcuts).  I downloaded the light (478MB for Peppermint Two vs the 699MB crammed onto the Ubuntu installation disc) .iso file and burned it and started a Peppermint install.  The process was more or less identical to the Ubuntu install I just finished.

Like Ubuntu, I had no wifi.  This I expected.  I had the recommended drivers I found from somewhere and discovered ndiswrapper already installed in Peppermint (vs. not being installed in Ubuntu 10.04) — in fact, I later found a gui for ndiswrapper, which I thought was pretty cool, even if I didn’t use it.  However, after using ndiswrapper from the commandline to get my driver installed, the wifi card was still not detected.  I did some Googling and found that Peppermint has a utility to scan the hardware and look for third-party drivers.  That required an internet connection, so I got it hooked up, ran the scan, and found some Broadcomm drivers.  I clicked the little activate button and, after a restart, it worked!  Wow, seriously?  That was easy.

That wasn’t the only thing that was easy, though.  I recalled from when I was dual-booting Ubuntu and Windows 7 on my desktop that creating application shotcuts in Chromium on Linux was a losing proposition.  It was a pain to get the shortcut set up and actually functional and I ended up giving up on the whole thing.  Not so with Ice.  All you need to do is tell Ice what the url to the webapp you’re trying to create a shortcut for is and chose an icon you want to use and you’re done.  More than that, the “create application shortcut” (my first impulse being a Chrome user) option actually works!  Maybe this is just a result of the updates to Chromium since last I used it, but I kind of suspect not (if they cared that much about that option on Linux, it wouldn’t be a menu item — at least, it shouldn’t be).  This makes me think it has to do with the Ice app that was specifically designed for PeppermintOS and Chromium.

Peppermint is designed for netbooks — which is good, because that’s how I wanted to use my laptop.  It’s built to be a work laptop that I can take with me on the road, so most of the stuff I want will be web-based.  So Peppermint comes with integrated Ice (or Prism, depending on your flavor of Peppermint) shortcuts to web-based applications like Gmail, YouTube, Pixlr (rather than coming with GIMP installed), Seesmic Web (which I replaced with HootSuite), and Google Apps.  It also has a shortcut to Dropbox which — upon a first run — will download and install the Linux Dropbox client to get you synced up with your Dropbox files.  Possibly my favorite part is that there are no bundled obnoxious sounds for everything.  As much as I appreciate the quasi-tribal boot-up sound of Ubuntu, in almost every case for every install of Ubuntu I’ve ever done, the volume is set to deafening, and that sound quickly loses it’s novelty when the volume is cranked up to eleven.  Peppermint — focusing on being a stripped-down, lightweight netbook-style distribution — doesn’t come with any of those sounds.  To the extent that I started wondering if I even had the sound set up at all and, after deciding I didn’t really care if the laptop had sound or not, tried popping a CD in there to finally test and was surprised when it started playing.

The only possible criticism I have is with the built-in music player Guayadeque, which, while it has loads of tools for streaming and playing local media files, has a clunky interface for playing CDs and no real way (that I can see) to drag and drop tracks from the file manager to the music player or create a playlist without clicking on each track from the CD.  That’s not a huge issue for me, particularly since there’s so many web-based options that are already built into the OS like Last.fm and Pandora could be added easily with an Ice shortcut.

Peppermint is my new favorite Linux distribution.  It beats Ubuntu by a longshot with extra credit for being small, not bundling a bunch of crap I don’t want (particularly Rhythmbox, a bloated music player that I’ve never liked — only tolerated because I had to — and generally ignored in favor of some flavor of XMMS), and making the setup and customization processes a snap.  Even though I had to go online to get a driver for the wifi card, that itself was so easy an idiot could figure it out, and once it was installed, I haven’t needed to plug in my ethernet cable (as opposed to Puppy which often dropped a local wifi connection and forced me to reconfigure the thing every time).  Peppermint compliments my style of computing, which is to give me the bare essentials and let me put on my own damn apps, thank you, rather than assuming some software bundle that would be most useful for the average user the way most Linux distributions (and Ubuntu, in particular) do.  I’d also like to give props to the Software Manager, which pulls from a variety of repositories with an easy-to-use-and-navigate interface that makes installing new packages super-easy.

If you have even a casual interest in either Linux or just dumping Windows and trying another operating system, I highly recommend checking out and downloading yourself a copy of Peppermint.

Why dual-boot Linux when you can run it from a USB flash drive?

I’ve been a sideline fan of Linux for a long time.  My very first experience with it was buying one of those 800 page, dictionary-sized technical manuals for Linux which came with Red HatSlackware and Caldera.  I effectively destroyed my Windows 95 box trying to get Red Hat installed and failing.

After that, I was much more cautious, but I’ve always had an active interest in Linux.  For about a year I trolled Distrowatch to keep up-to-date about distribution updates and what was hot.  While I was working at Albertsons, I randomly decided to install 5 of the most popular Linux distributions into a VirtualPC environment to test them out and see which one I liked best (I ultimately decided I still liked Ubuntu best, with Fedora being a fairly close second – if it wasn’t for the fact that I dislike KDE).  I’ve tested more Linux distributions than I can count on my fingers and for about a year I ran Ubuntu as my primary operating system at home, only booting to Windows for games.  I gave that up when I left my job at Albertsons to do web design full time.  As much as I like Linux, running virtualized versions of Adobe applications was just going to unnecessarily eat up resources, and I’m still not ready to switch to GIMP (though I could probably ditch Dreamweaver for just about anything else as long as it runs well).  For a few months I had an Ubuntu partition on my main system, but I never used it, so I got rid of it.

Linux on a stick

For the winter holiday, I got a USB thumbdrive.  The main use I had in mind for this was pretty much the same as my old zip drive when I was in college – to store large files – mostly graphics — that I could transport and use on other systems.  We don’t have a printer because for the amount that ink cartridges cost vs. the amount we actually print anything on paper, it’s just not worth it, so I end up going to FedEx/Kinkos to print stuff, using their online form to upload files from home.  This is fine and dandy, but when I have something that I know would take them 3 minutes to run if they just got off their ass to do it, it’s annoying to wait a half hour or longer for them to call and say it’s done.  Enter the thumb drive: I can save whatever document I need to print on that, take it to the FedEx/Kinkos office, and print it myself.  When I noticed they had USB ports for such purposes, it was instantly on my list.

Realistically, I only need maybe 500 MB for anything I might possibly need to print, if that.  The USB thumb drive (which now lives on my keychain) is 2GB – so what to do with the remaining 1.5GB?

My first task was to export my data from LastPass to the thumbdrive.  I’ve been using LastPass and updating all my passwords to more secure ones (14 characters, alphanumeric with symbols, randomly generated), so this way I could have a backup of my passwords that was always on me and encrypted.  That’s 138KB.

Then I saw a blog post on LastPass’ blog that talked about how to install a portable browser onto a USB flash drive and install their plugin on said portable browser – that way you can take your entire password vault to any computer you want and run the browser from your USB drive.  I went straight out and downloaded Google Chrome Portable, installed the LastPass extension (and, actually, ran Chrome’s sync to grab all my other extensions and bookmarks).  Now I have an entire browser with all my ridiculously encrypted passwords that can run straight from my USB drive on any (Windows) computer.  That was another 150MB or so.

I started toying with the idea of running Linux from a USB drive and started looking into how it was done.  Most of the manuals and blogs I found on the subject were a couple years old, so that didn’t help when many (if not most) Linux distributions release updates at least once a year if not more.  I did, however, learn that running the portable version of Ubuntu took between 1-2GB and would wipe out any existing data on your drive – not ideal, so I started looking at alternatives.

I chose Puppy Linux because it’s designed to be small and portable (100MB!).  It also doesn’t seem like it gets updates every 6 months which, in this case, is a good thing (since I won’t be updating an operating system that lives on a USB drive).  The documentation on the Puppy site is a bit of a nightmare, though, so I waited.  Then I stumbled on Pendrive Linux.  Pendrive Linux has a Universal USB installer that will install any from an exhaustive list of distributions (and any distro you want that’s not on the list) directly to your USB drive without you needing to do much of anything (other than download the actual ISO).  The link built into the installer for Puppy Linux Lupu 5.2 was broken, but I was able to navigate through the FTP server to find where it actually lived.  After downloading the ISO, the actual installation took maybe 5 minutes.

From what I’d already read, I knew that I’d need to go into the Boot Menu during startup to select the USB drive as a boot device.  About 45 seconds later, after being greeted by a friendly Puppy logo, I was at the desktop.  I was surprised by how quick the everything moved – I was used to LiveCDs where you clicked on something and have to wait a minute for the system to respond.  Everything behaved as if I was running an operating system directly off my hard drive.  The other thing that I found pretty cool about Puppy is that you can save your settings onto your flash drive, which means that when I clicked on Browse and was prompted to install a browser (Chromium, onto which I again installed the LastPass extension and then synced my bookmarks and preferences), it would be able to save everything I downloaded into its save file.  LastPass bitched at me for using the autologin option, so when I was prompted to save my Puppy preferences when I went to shut down, I encrypted the save file, so you’d need to enter a password to get to the Puppy desktop.  You can choose the size of your save file – I chose 512MB, the default – in sizes which range from very small (I didn’t pay attention, but I think it was as low as 64 MB or less) to 2GB.  All told, with Chromium installed and my 512MB save file, the entire operating system takes up just 640MB, leaving me with more than a gigabyte to do whatever I need to.

Now, not only can I run a personalized browser on any Windows computer from my USB drive, I can run an entire freaking operating system from my USB drive, presumably (though this is, as yet, untested) on any computer anywhere.  And it fits in my pocket.  If I wanted, I could install a LAMP onto Puppy and tell people I had a webserver in my pocket.  But that’s a little insane, I think.  The whole process was surprisingly, ridiculously easy and I never once needed to boot from a LiveCD or otherwise boot into Linux to run the install except to actually test the fully-installed OS.

The idea that I can carry around a ready-to-go operating system in my pocket that I can use on any computer is pretty awesome (as well as the fact that you can get a drive to run said operating system for less than $20) and I’m sure has implications I haven’t even fathomed yet.

wp-o-matic trick

discovered a trick about wp-o-matic as i was building the new site. for wp-o-matic to work and not lag, you need to set up a cron job. but said cron job doesn’t *necessarily* need to happen on the host server. so, if you have a server that allows cron jobs (which i do, at home) and a *different* server hosting your site (which i do, at 1and1), you can set up a cron job on the other server that will control your wp-o-matic updates on your non-cron-enabled website.