Winter on Georgian Bay

Back in late December, I planted a Raspberry Pi camera at a cottage on Georgian Bay, in Northern Ontario, set to take a picture once every two minutes.  I had been planning the shoot for a couple months prior to the deployment: There were two Raspberry Pi’s involved, in case one failed somewhere during the winter.  One of the Pi’s was set to reboot once a week, just in case the software crashed but the Pi was still awake.  I had also written some software for the time-lapse to ensure that pictures were only taken during the day time, and to try to maintain a balance of well-lit, consistent images over the course of each day.

In spite of all the planning, I had a sense that something would go horribly wrong, and, indeed, when we showed up to the cottage, the windows were completely frosted over.  The cameras had to be placed inside, so we figured we would mainly see the back-side of an icy window when we retrieved the cameras.  Or that the camera boards would literally freeze after about a week of sub-zero temperatures in the unheated cottage.  Or that a raccoon would find it way in and gnaw through the shiny Lego cases.  Or something else entirely unplanned for.

So it was a bit of a surprise when it turned out that the shoot went perfectly.  We retrieved the cameras about a week ago, on May 7th, and found over 42,000 photos waiting for us on one of the cameras and somewhat fewer on the other.  Both cameras had survived the winter just fine!

All told, I think the result was really cool!  The video at the top is the ‘highlights’ reel, with all of the best days.  It comes to 13 minutes at 18 frames per second.  Turns out it was a fantastic winter for doing a time-lapse, with lots of snow storms and ice.  There’s even the occasional bit of wildlife, if you watch closely.  I’ll post the full 40-minute time-lapse on Youtube sometime next week.

Continue reading

Advertisements

Know Your Sensor

Recently I’ve been playing with building a regression model for the brightness of images produced with the Raspberry Pi’s camera board. Essentially, I want to quickly figure out – hopefully from a single image – what shutter speed and ISO to choose to get an image of a given brightness.

This is a pretty standard regression problem: We some data, extract some information from it, and use that information to make a prediction. To get a better handle on the algorithms involved, I wrote my own code to perform the regression, using NumPy for fast linear algebra operations. You always learn something from re-inventing the wheel, after all.

Data from images of my back yard.  Each point is one image.  The y-axis is the brightness of the image, the x-axis is the ISO the image was taken at, and the color indicates the shutter speed the image was taken with.
Data from images of my back yard. Each point is one image. The y-axis is the brightness of the image, the x-axis is the ISO the image was taken at, and the color indicates the shutter speed the image was taken with.  The shutter speeds and ISO’s chosen were evenly spaced (except for a few rogue images).  We can see there’s a kind of ‘sweet area’ for SS/ISO, with some upper threshold where things get too bright/dark very quickly.  We also see that the increase in brightness as ISO increases is non-linear.

Continue reading

Pi-Lapse 3: Toronto Skyline

A still from a test-reel of timelapse taken at Owen Sound, in North-ish Ontario last week.
A still from a test-reel of timelapse taken at Owen Sound, in North-ish Ontario last week.

I’ve done quite a bit to improve my Raspberry Pi-based timelapser.  I have a pretty good system together now, thanks in part to recent firmware updates to the Pi which allow me to directly control the shutter speed and ISO of the camera sensor instead of relying on auto-exposure settings.  The auto-exposure is pretty unreliable from one shot to the next: the camera makes a different decision each time it snaps a picture, which leads to quite a lot of flicker.  Previously, I was dealing with this flicker by manipulating the images in post-production, but I’ve now written some code to get the camera to try to maintain a constant image brightness across a long shoot.

The code now consists of a ‘timelapser’ class, which keeps track of its current shutterspeed and ISO (SS/ISO henceforth), and the brightness of the last few images taken.  It then adjusts SS/ISO to try to get the image brightness to 100.  By keeping track of the last few images, it is a bit less susceptible to being upset by one strange image (like, say, if I put my hand over the lens for one shot, producing a black image), or more standard movement within the frame.  On the other hand, it takes a while longer to settle down to the ‘right’ SS/ISO.  So it’s currently set up with an initialization step, where it finds a good SS/ISO pretty quickly, and then transitions to actually taking pictures.  The result is very little flicker as the timelapse goes on, and a pretty constant level of image brightness when light levels gradually change: like when we watch dawn or dusk.  (If you’re interested in playing around with the code, I’ve set up a github repository here.)

As an example, this is a video that we shot over about three days on my friends Ketan and Ananya’s balcony.  They have a great view over Toronto, from the CN Tower to Honest Ed’s.

Continue reading

Pi-Lapse 2: Wychwood Barns Farmer’s Market

Aerial raspberry pi installation. The boxy-head is the pi(s), attached to a tripod held up by a jib arm.  A ten-port powered usb hub is duct taped to the tripod, providing lots of data storage and internet to the Pi's.
Aerial raspberry pi installation. The boxy-head is the pi(s), attached to a tripod held up by a jib arm. A ten-port powered usb hub is duct taped to the tripod, providing lots of data storage and internet to the Pi’s.

Almost immediately after my first foray with the Raspberry Pi timelapse I was contacted by Cookie Roscoe, who coordinates a weekly farmer’s market for The Stop.  The Stop is a community food center here in Toronto, providing lots of programming and emergency food access for lower-income people.  My partner, Elizabeth, worked with them for about three years, so I was super happy to try doing a time-lapse of their market.

Here’s the results!  Lots of technical stuff about what went into the video after the break!

Continue reading

Pi-Lapse Test Footage

A camera made of legos!  I've built two of these; the photo was taken with the _other_ raspberyy pi camera.
A camera made of legos! I’ve built two of these; this photo was taken with the other raspberry pi camera, during a three-week time-lapse shot.

My recent DIY electronics project has been putting together a Raspberry Pi-based camera.  The Pi foundation sells a camera board which plugs into the Pi; it’s sold as ‘a bit better than the average camera in a mobile phone.’ But the Pi’s default Raspbian Linux installation comes with a couple programs for controlling the camera, and lets you take still pictures and videos easily.

In the interest of using the camera for something you can’t usually do with a store-bought digital camera, I wrote a short python script which takes a photo assigns it a file name based on the date and time taken.  It then does some sampling of the picture, and only keeps pictures which aren’t ‘too dark.’  And then cron runs the photo script once every five minutes.  In other words, the Pi is set up for long-form time-lapse photography.  The resulting pictures are then easy to compile into a movie.

Continue reading

Tips on Running a Headless Raspberry Pi

A Raspberry Pi with a head.  Well, not the usual meaning of 'head,' I guess.  (Giraffe and Carcassonne box included for scale.)
A Raspberry Pi with a head. Well, not the usual meaning of ‘head,’ I guess. (Giraffe and Carcassonne box included for scale.)

I was recently helping out a friend with a headless Raspberry Pi setup, and thought it would be helpful to consolidate a few useful bits here. From here, you can set up all kinds of cool projects using the GPIO pins, set up a headless web server, or anything else you can think of. For my part, when I hurt my ankle a few months ago, I hooked the Pi into a hard-to-get-to stereo system and logged in remotely from the other side of the room to play music… I also used a headless setup to run the really long compile for the Sage computer algebra system a few months ago.

Continue reading

Amagoro Library Visit

Playing Set with primary students.
Playing Set with some primary school students at the new Amagoro library.

This weekend I took another trip out to Amagoro to meet see the new Amagoro library, opened by a joint effort of Kiwimbi Global and the Amagoro city council.  The library opened on February 15th, while I was on a trip to Nairobi, and by all accounts has seen heavy traffic ever since.

I set the groundwork to leave a couple Raspberry Pi computers at the library some time after elections; right now they’re still working on getting electricity together.  In the meantime I left a Pi with Jevin, the tech-guy for the Elewana project, so that he can become familiar with the system.

I also met with three groups of primary school students, about to take their final exams before going on to secondary school.  With all of the groups, I talked about how computers work, and the importance of math and computers to all of the various future occupations they were dreaming about, ranging from nurses to engineers.  (One students wants to be a ‘computer wizard’ when he grows up!)  Hopefully planting some Pi’s with interesting resources will help some of the students get where they want to be.

Continue reading