Building my own Raspbery Pi time-lapse camera system

Building my own Raspbery Pi time-lapse camera system

Something about capturing time is a slight obsession of mine. Watching the tides come and go, clouds forming and blowing in different directions depending on their altitude. The blue sky transitioning to the dark night-sky. Or an oncoming storm, bringing lightning, howling winds and massive energy. It’s the cyclical theater of nature, and the crazy calmness of it being speed up to makes for its own dramatic impact.

Prior to this project, the longest time-lapse sequence I had captured was about 8 hours. And honestly, that was a big project in-itself. Supplying power, having the right storage, getting consistent images for smooth playback. A few years ago, it was difficult and the niche market for this means it’s not your standard type of shoot. The goal of this project was to build a camera that could capture days and days of images, which could then be sped up a warm speed to show a full day in under a minute. Or faster, if I wanted. So, here’s my first crack at a little montage.

Days of Day-to-Night-to-Day – Captures with my Pi Zero

Shot with my own software, a homemade Raspberry Pi Zero case and hours of trial and error.

Building has taken a lot of effort and it’s still a work in progress. At it’s core, it’s 1) the camera (a Raspberry Pi+HQ Camera, I’ll just call this the camera), 2) the software to make it function, and 3) the case to hold it together. All three areas of this project have plenty of faults and areas for improvement. Which I’ll work through.

The software has two parts; 1) Python code to make the camera shoot, store and do basic photo analysis. And 2) Image blending in in post-processing to help overcome some hardware limitations. More on this below. Ideally, I would do as much as possible in-camera, but the computer is a low power Raspberry Pi Zero.

The ‘Camera’

It’s a  Raspberry Pi Zero +  HQ Camera Module and a CCTV C-Mount Lens. Pictured below are the basics of it, as well as home-made case that it’s housed in. The CPU and power of the Pi Zero is pretty low – but for capturing images with basic analysis – it’s good enough. It’s small, power efficient and while it can’t do as much as a Pi 4b, for example, the lower power use means it can run for days off a standard USB battery.

The camera quality is pretty great. The sensor is a small Sony IMX477R back-illuminated12.3 megapixels sensor – good enough for 4K shooting. Having full control and RAW capability, I felt this would be good enough to capture decent results.

The camera on its own is nothing without the software. It’s also very little without its case, figuratively and literally.

The Software

Starting off, and as a general methodology, I like to not over-complicate things (I should really say “keep it simple”). For example, I tried to keep the camera code very basic. Let the camera decide the white balance, shutter settings, ISO. Basically, keep settings as ‘auto’. But as seen in the photos below – auto capture really introduces some horrible flickers. And these were captured directly after each-other in the space of only a few seconds. Not good enough.

On realising that auto settings weren’t good enough, I opted to manually set image settings. But again, this introduced issues. Taking a photo with manual settings when I don’t know if it were too bright or too dark can’t be done with real accuracy. So, I spent hours and hours (and hours) testing with set shutter speeds and ISO settings from bright daylight, dusk, dawn, midnight and so on. But this was just stupid. Heavy cloud at sunset would make the sky go black when the sensor and software were expecting more light. There were too many things that could change and my approach of pre-programming exposure settings wasn’t going to work; I had to be more dynamic and review the image to analyse the brightness. But doing this in PHP – oh, dear. This was where I started to realise PHP running shell scripts was hitting a wall.

I needed to code a better camera system and I started to look into open-source libraries and it was obvious I had to make the change from PHP to Python. I’d never coded in Python, so no better way of starting than just starting.

I re-wrote all my functions and then started looking into libraries which could read images, extract image histograms, measure how much light and dark was in a shot. Basically for every picture, I check the brightness and if it’s too dark, then shoot for longer in the next time. Too bright – shoot for less time. Kinda simple, but I really had doubts the Pi Zero would manage that type of workload. But it was able to handle this with no obvious problems. I think cooler people would say “handled it like a champ”.

Armed with Python and my basic image analysis, I had no need to pre-program exposure settings depending on the time of day – thank fuck. Looking back, that was so dumb. Now it just works. Heavy cloud, unexpected brightness – whatever. It will just manage and set the right exposure for light. With this brightness monitoring, I didn’t want to change every image with tiny changes in light, so there’s a basic range where some variance is allowed. For example, if a cloud covers the sun, the image should naturally get a little darker. With that basic tolerance, it seems to work alright in standard day or night conditions. That said, I’m still not 100% happy with sunset / sunrise. And – I don’t want to talk about it, but I know I have to – color temperature / white-balance is a problem. Especially at sunrise / sunset, or when the environment is lit by unnatural light at night. Urgh, more on this in the future, but now and at the time of writing this, it’s hard-coded to be set for daylight / natural light settings. Even that was a task.

No simple color temperature settings exist with the HQ Camera Module. I’ve got to code a gain offset to work with at the sensor level where I can increase the gain of red and blue (not green). I still don’t really know what it means, but I’ve managed to get it working well-enough for now. But I want this to be better and this is a major task for me.

Post Processing

A big goal of this was to try produce great quality video. In general, time-lapse shots during bright light use ND filters during the day, and at night, you don’t want to block light – so no ND filter in low light. For those unaware, a ND filter is basically like sunglasses for your lens. It stands for Neutral Density and it blocks light and allows for longer exposures in bright conditions. The reason this is so important is based on the need for playback to look smooth. Payback where every frame is played in sequence doesn’t look great if the image has lots of hard edges that change frame-by-frame.

Frame by frame playback of fast exposures

Notice the roughness (or sharpness) of the water in each frame in the video below. It’s super messy and not very ‘calm’. This is the result of every frame playing back where there’s motion inside each image that doesn’t blend into the next image. And oh yeah, the flickering is when the camera needs to adjust the shutter time, along with horrible white balance capture. Basically, this sucks. But with software, some improvements can be made.

Blended playback

This is the same image sequence, but blended for smoother playback. Basically, we have 11,00 images. Some of which are 1/200th of a second, some are 1 seconds (and some even longer). Rather than playing back each image one-by-one as we did above, we blend images within a timeframe of (in this case) 60 seconds. This results in dramatically less images – 72 actually. Where there’s lots of light, we merge 12 or so photos into one image – it make a much softer and nicer image. And when played back in sequence, far out, it’s much faster and much smoother. Still not smooth enough in the example below, but this is a work in progress.

Blended image vs image-as-captured – two quick examples… 

Here’s another example of two clips played one after the other. First is without blending, second with blending. Please excuse the colour grading – this was an older test shoot where my color settings were a little whack.

While this isn’t an invention, by any stretch, I do think this functionality I’ve integrated with photos for time-lapse is a real game-changer for higher quality playback using lower end equipment. Adobe Premiere, DaVinci Ressolve – they just don’t do this. Playback at higher frame-rates, even with their own implementation of blending, just doesn’t blend like my solution. This brings a much higher quality look to images and video in playback.

Not only, but it re-times playback to keep the speeding up of time to be consistent. For example, if bright light conditions allow for 25 or 30 photos to be taken in a minute, 10 seconds of day playback takes 10 minutes of captures. At night, each image might be 30 seconds. To get 10 seconds of at night playback, we need to shoot for almost 3 hours. Basically, with less light, playback looks absurdly fast and it’s not always what we want.

Grouping of images by a timeframe allows for consistent playback – with the added benefits of smoothing out for a more professional look and no need to change filters. Changing filters isn’t always possible  possible. For example, the tide will come in and make the camera inaccessible. This blending solution gets right around that problem.

The Case

This seems like the simplest component, but for me – a software and camera guy – it’s been a little troublesome. That said, it’s nice to ‘get on the tools’ and mean it when I use the expression. Starting off, the case wasn’t really functional, just held it together for testing. It’s so cute and tiny, basically the standard Pi Zero Case with some cable ties. 🙂

Obviously, very un-weather proof.

Given the idea was to put this device in the outdoors, I had to come up with something more robust. Looking at my case now, and the evolution is somewhat embarrassing to be honest. But at each iteration, I just made improvements.

The big problem with the white case above was it caught way too much wind. And it was stupid and big. It blew around in gusts and had way too much free space on the inside. I mean, I did have plans to put the battery inside / have scope for a Pi 4B, and so on – but it was horribly big and bulky.

With the faults obvious, I gave the case some consideration and realised the Pi Zero would actually fit inside a basic plumbing tube. So – keep it simple, and make it smaller. It introduced some issues, though. By having everything crammed in a small space, it made retrieval of the MicroSD card quite hard which didn’t matter too much as I was happy to use WiFi to transfer the images. But the case was a much better design – and it allowed for simpler weather sealing. Also had the added bonus of a circular shape which closely fit a 58mm UV filter. Perfect for some better protection.

Alongside the evolution of the case, was enhanced software too. Better functionality, testing out the capture methods and refining things like ISO / Shutter Speed, and so on. So it’s nice to have made some real progress and looking forward to making this even better.

Sydney Mobile Phone Wallpapers – Free Downloads

Sydney Mobile Phone Wallpapers - Free Downloads

Sweeten up your phone, Sydney!

After the lovely feedback yesterday from my Melbourne mobile phone wallpapers, I've decided to go one up and share some Sydney shots.

Once again, download them, take a picture of your phone or screenshot and let me know how it looks. Or don't. But I hope you like them.

Just click on the one (or few) you like, and download to your phone.

Japan Photoshoot with Mindful Matcha

Japan Photoshoot with Mindful Matcha

2 Weeks In Japan

The past two weeks have been pretty big. 2 days to myself in Tokyo, 10 days with my client, Sahra from Mindful Matcha, and now a couple days to myself in Osaka. To call this job a simple photoshoot, would really be underselling it. As much as this was a photography trip, much of the time was spent on all-things-business. From strategy, marketing, web tech, website development, social and content marketing, customer service and so on – this was a pretty encompassing.  Continue Reading..

Mount Agung, Bali. An Eruption Looms.

Mount Agung, Bali. An Eruption Looms.

We arrived in Bali around the end of July, and the main volcano of the island, Mount Agung, started stirring. Not that you’d really know. Minor earth tremors, things of that nature. Needless to say, it’s been a slow build. Up until last week – that’s where things have really reached boiling point.

We had planned a road trip around the North East and as such, got some great views of the massive structure that stands around 3,000 meters above sea-level. And sea-level is kinda where this mountain starts. It’s incredible. The roads, all around it, just gradually go up and up and up. Continue Reading..

Black & White Koh Lanta

Black & White Koh Lanta

I’ve been in a bit of a photography rut

Given my amazing surrounds of Thailand, that might be a slight surprise, but I never quite anticipated the hangover of my 2016 photo-a-day conquest I forgot it was a leap year – that 366th day really got me. Something about needing to find a subject or scene, every day, that was compelling, interesting, etc… It just got me down a little by the end and resulted in me being a little reluctant to pick up my camera in 2017 (well, so far). Continue Reading..

Week One in Phuket, Thailand

Week One in Phuket, Thailand

Our South East Asia trip started in a really casual manner. First job after getting off our flight ( which was as smooth as you could hope considering we were delayed in Melbourne due to lightning and landed in lightning) was getting to our Airbnb joint. Instructions were a little vague, we were a little tired, but we figured it out. I mean, obviously. Our place was past most of the action of Patong and Karon, down the Southern end of Phuket in a town called Kata. A pretty sweet little find, in hindsight. Continue Reading..

The Pinnacles of Phillip Island – Seriously Epic

The Pinnacles of Phillip Island - Seriously Epic

The Pinnacles at Cape Woolamai on Phillip Island are pretty close to Melbourne. All up, the drive is about 2 hours from Melbourne, but living in Australia, that’s not massive. As you walk down to the beach, it’s a pretty typical Aussie surf beach. Big waves, lots of sand, mist in the air, windy, and cliffs on the horizon. The entrance to the walkway is about 1km east (left) from the beach car park, so it’s pretty cruisy walk to the walkway which is the beginning of Cape Woolamai. You start to climb and get a better picture, but it doesn’t really prepare you.

The walk from the car park is about 45/60 minutes (depending on how often you stop for a click), and it’s not a tough mission. Along the way, there’s plenty to see, but nothing really prepares you for the real highlight of The Pinnacles. When you get there, you’re looking down from an observation platform and things look amazing, but still a little small. When you head down, it really gets put in perspective, and you really appreciate how large those rocks actually are. Each on of those pebbles are big enough for two to stand on. And there are thousands of them!

Lucky for me, this weekend I decided to head down and see how I’d go. To be honest, I thought it was going to be a bad move. The weather was wild, and I thought this could be a real fizzer. So, have a look through the photos below. You can see the weather starting off pretty rough, and as time goes on, the clouds blew over and the colour in the sky comes on strong to put on a show. Loved it!

Icing on the cake

Just to put icing on the cake, at one point we saw a pod of dolphins about 20 strong! Talk about an awesome little mission. Too far out with my wide lenses on, but still, it’s about more than the photos.

And a little freebee

You can download pretty sweet resolutions here, but if you’d like a super high original resolution of “Saving the best moment for the end. Amazing.”, I’ve got a download link for my favourite Pinnacles Sunset Photo. Feel free to use for personal use however you’d like – just don’t sell it…

Mornington Peninsula – 90 Minutes from Melbourne

Mornington Peninsula - 90 Minutes from Melbourne

Stuck in a routine

It’s funny how when you’re a local, you tend to not really absorb the great things around you. Using myself in Melbourne, as an example, how much does it take to do something like visit the Aquarium? Or go for dinner on the Restaurant Tram? Or even head down to the Dandenong Rangers for a day out? What I’m getting at, is there is so much to do for locals, yet we often wait for friends of family to visit (from afar) as justification for doing something interesting.

Weekend road trip to the Mornington Peninsula

This last weekend, a group of friends headed down to the Mornington Peninsula, and considering it’s only 90 minutes out of Melbourne, it’s pretty remarkable how much of a change of sights we get (and the fresh, sea air!). I mean, you know it’s going to be different, but it’s easy to forget that beautiful nature isn’t really that far away when you get stuck in a routine of work-eat-sleep-chores-socialise, then repeat. And the photos below really only represent the beachy side of things; the winery and food missions we did were awesome! Only they were more about food and boozing (um, tasting) than photography.

So, needless to say, I tried to make the most of it, and for me, that means getting up at sunrise and trying to get that beautiful glow. Walking around with my camera really is how I find my own space, and I’m always wanting to capture something different (at least for me).

And on with the photography

I hope you enjoy the random splattering of shots from the weekend below. And feel free to download them as your wallpaper – they are pretty high resolution, so just right (or option on a Mac) click and chose to ‘save link as’  for the image. Let me know what you think, share it round/up-vote on social if you dig!

Cheers, Steve

P.S. For a bunch more Mornington Peninsula stuff, check out the Tourism Victoria Visit Melbourne site.

Streets and Laneways of Ho Chi Minh City

Streets and Laneways of Ho Chi Minh City

Ho Chi Minh City (i.e. Saigon) is wild. The roads are a sea of scooters, where the scooters swim like a school of fish, but between the main roads, there are connecting pathways which allow for a much calmer way of life.

Coming from Melbourne, Australia, Laneways are just an iconic part of the city, and as much as Ho Chi Minh couldn’t be more different, the back streets and laneways share some similarities. They’re more relaxed, while still being a place to eat; just not as mainstream. You still get traffic, you still get a bunch of people, but for something so close, you see something very different at a much calmer pace.

In terms of exploring, the laneways tend to keep tourists away for some reason. I think it’s got to do with the tribal mentality of ‘hanging out where my people are’, but that doesn’t seem to matter for locals. It just allows curious people to get a bit more of a real look at the daily life. And it’s really cool.

While in Vietnam, I shot a tonne of streets, people, laneways, traffic, etc, but with this post, I’ve tried to put a little more focus on people in the environment. As for a look at broader crazy traffic or specific shots people, those posts and pics will coming soon.

And just for good measure, there’s a few photos of some of the busier streets with people mixed in.

Exploring Dương Đông in Phú Quốc

Exploring Dương Đông in Phú Quốc

Phú What?

Phú Quốc is about 40 minutes by air from Ho Chi Minh City, Vietnam, and is a small island about 50Kms tall, and 25Kms wide. The main town of  Phú Quốc is Dương Đông, and I had the pleasure of spending a couple days here to see out the end of 2014. Such a nice little town, and a real change of pace from the craziness of Ho Chi Minh City.

Dương Đông

About half way up the west coast is the main town Dương Đông. It’s got a great night market open from 4:30pm, and up the end of the market is the Dinh Cậu Lighthouse. It’s an awesome spot, with a great view of the town and market below. There’s fisherman, people, and at sunset, a great atmosphere.

So, that’s where I ended up on Saturday 27th December, 2014.

Scroll on for some photographs, and click to see a higher resolution version.