Today we’ll talk about using the Raspberry Pi Zero W to make a Time Lapse camera that can also be used for home security. But first, I’m going to get a little meta with The Blog.
I haven’t been posting a lot on The Blog lately, mostly because I’ve been quite busy with Real Life. My wife deals with a rather severe form of a disease called Gastroparesis. Imagine that you woke up one day and your stomach decided it didn’t want to do anything except just take up space. That’s gastroparesis. It’s awful, painful, miserable and overall a wicked disease. She has ups and downs with that, and lately has had more downs than ups. So, amateur radio, electronics and what not have been pushed aside lately.
We’ve reached a new equilibrium, however, and so it’s time for me to dive back into doing what I love to do in my spare time: Build stuff!
Prelude
I have, in the past, enjoyed Time Lapse photography using Canon Powershot cameras and the Canon Hack Development Kit (CHDK). CHDK gives the ability to automate photography and also do things you’d never be able to do without it, expanding the cameras abilities far beyond what Canon intended. The following is a video that I took with such a setup:
CHDK and a Canon Powershot are great, but this setup does have some pretty significant limitations, however. Without hardware modifications to the camera, or somewhat expensive wifi connected SD cards, it’s not possible to extract the images from the camera without powering it off and taking out the SD card. The same is true when it comes to programming the camera: The SD card must be inserted into a computer to make the needed changes.
Overcoming these limitations was difficult in 2010 when I made the above time lapse. But here we are in 2018 and a whole new market has opened up to the electronics experimenter. Arduino, Raspberry Pi and clones have taken over and given us fully programmable custom hardware solutions that are approachable to Mere Mortals. Which brings us to my latest project.
Raspberry Pi Zero W Time Lapse Security Camera
Well that’s a mouth full! But it describes my most recent, and current, project. I have the need/want to put up a security camera at my house, and so I started off by looking at off the shelf solutions that I could plug in, connect to the wifi, and be done with.
I was not impressed.
First, my budget for this was fairly low. I didn’t want to spend more than $75 on a solution. When I started looking at the available products in that price range, it became clear that I’d need to ‘roll my own’ if I wanted the quality, resolution, and capabilities I had in mind. I wanted high resolution, as some of the things I want to see will be up to 150 feet away. All the solutions in my price range were 1080p at best, although one was 4MP. I wanted more.
Having read about the Raspberry Pi Zero and the Raspberry Pi Camera, I thought perhaps that I could do better for the price.
Procurement
First I had to pick a Raspberry Pi and Camera. Because of price, size, and capability needed, I went with the Raspberry Pi Zero W. This is a wonderful little machine that’s tiny price and size belies its huge capabilities. It’s impossible to buy a Raspberry Pi Zero W by itself, but for a few dollars more you can buy a bundle kit that includes a simple case and a power supply as well as the special Camera cable needed.
Next I needed to pick the Raspberry Pi Camera module. I decided to go with the “NoIR” version, which means that it has no Infra-Red filter. This allows the camera to be more sensitive in low light situations, which fit my need for a security camera. During the day, it causes the coloring to be unusual. For example, my grass is now pink! Switchable IR filters are available for very little, and I’ll be adding one of those soon. I’ll talk about that more in Part 2.
Lastly I needed a Micro SD card. I decided on a Samsung 32GB micro SD card so that I’d have plenty of room for images.
Starting the Build
I had been googling around for information about how to build a time lapse camera with a Raspberry Pi, and I found two tutorials that got me started. First, I needed to install Raspbian Linux on the Pi Zero W and get it connected to the Internet via wifi. This tutorial on Adafruit had me up and running far quicker than expected:
https://learn.adafruit.com/raspberry-pi-zero-creation/install-os-on-to-sd-card
A quick Google search helped me to figure out how to properly plug the Raspberry Pi Camera into the Raspberry Pi Zero W. I powered on the whole thing, and logged into my home wifi router to check to see if it saw the connected device. It did! I jotted down the local IP address, and opened up an SSH session to my home Linux server. From there I SSH’d to the Raspberry Pi Zero W. I could hardly believe it- Here I was, connected to a little tiny circuit board, over wifi. And it’s running Linux! Truly remarkable. And only $25!
Setting up the time lapse
When starting with a new project such as this, it’s good to use sample code and figure it out from there. I’m familiar with the basic tenets of programming, having some experience with Bash and a wee bit of PHP, but I don’t really know Python. So, it’s time to learn Python, the favored programming language of the Raspberry Pi platform.
A bit more Googling around and I wound up at RaspberryPi.org’s own Time Lapse Camera tutorial. I followed it carefully. In very short order, I was taking photos!
The real project begins
Now I have a sample time lapse script running, and I can even make minor modifications to such things as the resolution and frequency of the photos. But I need more for my project. The photos aren’t time stamped except in the filename, and I need to get the photos off the Raspberry Pi Zero W and into a format that anyone in the house could easily view, even away from home. Just like a Big Boy security camera.
It will involve learning more Python, some linux programs like ffmpeg, and eventually a rain proof enclosure so it can be mounted outdoors.
Stay tuned for updates!
2 comments
1 pings
Hello,
I started a related project, this is about putting a camera to an isolated area and it should monitor the area and push notification on your phone in case of infraction.
For the moment I’m using a cheap IP camera that is connected to Rpi. The internet access is done by a USB
GSM modem with 4g capabilities. The whole system is powered up from a battery, and the battery is charged using a 100W solar panel.
I think would be cool to put everything into a single product like a platform that can be configured by customer to fit several usage scenarios.
If you want to know details about my project, let me know 🙂
I wish you good luck!
Author
That sounds very interesting! If you have it documented anywhere please do share a link 🙂
[…] April of 2018, I posted the article “Time Lapse Camera with the Raspberry Pi Zero W: Part 1” and introduced the project. At the end of that article I said that I needed more progress to […]