RasPi Time-lapse Camera

Raspberry Pi Camera Board

Raspberry Pi Camera Board

I have had a Raspberry Pi camera board since they were first available in May 2013.

One of the big advantages of the Pi camera is that it can be program controlled.  That means you can write a program, in my case in Python, that can control when you take one or many photos.

I had seen a post on time-lapse photography and thought “I can build one of those“.  So I did.

 

I think it looks fantastic when it is finished. If you can’t wait, fast forward to 42″, and watch a rain shower followed by brilliant blue sunshine. Don’t forget to watch in 1080p if you can.

It took about 75 lines of python code and now I have a time-lapse camera program. Thanks for the inspiration and example code link here.

Well, I have the program which takes the pictures. The images then need to be stitched together. And finally converted to something like an MP4 file.

Why 75 lines? Sounds like a lot?  I wanted the program to be variable, so using inputs I can decide how many shots to take, and how far apart the shots are taken. This allows me to do a trial shot. Look at the results, check that the camera is pointing in the right direction, then go for the full run, for example 2,400 shots at a 6 seconds delay. Most of the code actually sorts out file names and directories. Just to be difficult I decided to use numbers for my file names, not just a time date stamp, so a lot of the code enables that.  It is possible to write a much shorter program, or even just use the time-lapse feature in raspistill.

To make an 1080P HD movie you need to take 1920(w) * 1080(h) pictures, and stitch them together at 25 frames per second (in the UK).  So for 1 minute of video you need to take 25 * 60 = 1,500 pictures. At 6 seconds delay between shots this is going to take 2½ hours.

(You will need to set some times  aside to do this, make sure that the camera isn’t going to be moved, or become obstructed.  Tip: Start with shorter runs.)

Time-Lapse Camera

Time-Lapse Camera

My set-up is simple, a Pi, WiFi dongle, and an Duracell emergency mobile Phone charger battery. I run the Pi headless, which means without a monitor and keyboard. I connect through either my laptop or a tablet.  And if I am out and about then I can use open a hotspot on my phone.

I even bought a case for my Pi that looks like a camera. Not bad for about £10.

(Update: I have since added a magnetic lens, glued a washer to the front as a mount, and upgraded to a 12,000 mA-h PowerBank battery for even longer life. I am currently working on a tripod mount.)

Smart Pi Camera

Smart Pi Camera

I have recently bought a second camera case, a SmartPi, which has a GoPro tripod mount. This is designed for a B+ / B2. I have used a RasPi B+, which uses less power than the original B, and my PowerBank lasts even longer 🙂

(The SmartPi case has Lego mountings, which opens up a whole nother world of possibilities!)

Just a note: You can do all of the video encoding and conversion on the Pi, but I use my desktop PC. It is a lot quicker. For example 50 minutes+ on the pi = 5 minutes on the desktop! And all of the software is open source i.e. ‘free‘.  The only additional expense need be the RasPi Camera Board.

This is great, but I can do all this with my tablet and I don’t need to fiddle about with any of this Raspberry Pi stuff.”  Well, yes, you can.  But you are much less likely to stick your tablet in a Tupperware box, and leave it in the middle of a field for 24 hours, than you are with a Raspberry Pi. And where is the fun in using a tablet?  With the Pi you have the satisfaction of knowing that you ‘made it‘.

One more that I made earlier:

PS. Avoid the sun being in the shot for long periods as here. This shot burnt off the IR filter and left a blue line across every subsequent image.  The contrails look great though 🙂