
Raspberry Pi Zero W as a headless time-lapse camera - geerlingguy
https://www.jeffgeerling.com/blog/2017/raspberry-pi-zero-w-headless-time-lapse-camera
======
geerlingguy
Happy Pi Day everyone! Since the SpaceX launch was scrubbed this morning, I
thought I'd go ahead and finish off this post and kick off the Pi Day
celebration early.

Every year I try to do a new Raspberry Pi-based project on Pi Day, and this
year I finally plugged in the Pi Camera I bought about 3 years ago to build
this time-lapse camera. It was a fun project, and I hope you enjoy the build!

------
kogepathic
For anyone who wants to do time lapse photography but doesn't want to expend
the effort to build something like this, check out the Xiaoyi Yi. [0]

It has WiFi, the firmware is Linux (you can get telnet IIRC) and it also
supports scripts for more advanced configuration and control. You can buy it
online from China (e.g. AliExpress) for around $80

Sample timelapse video [1]

[0] [http://en.xiaoyi.com/xiaoyi_en.html](http://en.xiaoyi.com/xiaoyi_en.html)

[1]
[https://www.youtube.com/watch?v=6zlb2VFGVbs](https://www.youtube.com/watch?v=6zlb2VFGVbs)

~~~
asaml
You'll notice that the internal battery only lasts for ~1hr. But the yi-cam
can run completely without the internal battery. I'd suggest plugging it
directly into a powersupply or an external battery for this purpose.

------
bschwindHN
I did basically the same thing!

[https://github.com/bschwind/timelapse-
zero](https://github.com/bschwind/timelapse-zero)

I even have the same carbon fiber case:

[http://i.imgur.com/PF5kri7.png](http://i.imgur.com/PF5kri7.png)

Though I did this before the Zero W came out so I had to have that ugly USB
hub and WiFi adapter there. Something is being built across the street from me
which is what prompted me to set this up.

~~~
nixarn
How long does the battery last? I'd like a camera at our summer cottage to
take a timelapse during the whole winter (in Finland, so snowy), turn itself
on each day, take a pic, shut down, repeat for like 6months, not sure it's
possible?

~~~
icebraining
On my home server/NAS, I use rtcwake to sleep the computer for a few hours,
then wake up, check if there's work to do, then sleep again. I'm not sure if
it'd work with a Pi, though, since its hardware is different from a typical
motherboard.

Alternatively, you could use something like an Arduino, and connect it in some
way to an independent camera. Since it doesn't need to process the picture,
you don't need a powerful processor or MBs of RAM.

~~~
makomk
The Raspberry Pi doesn't support power management of any kind. It simply can't
go into suspend or soft power-off because it doesn't have the hardware to do
it. In theory the C.H.I.P can but I'm not sure if the software support for
that feature is there yet.

------
smcl
If you're into this but don't need the WiFi connectivity I bodged together my
own DSLR shutter release triggered by my Arduino:
[http://blog.mclemon.io/hacking-the-canon-dslr-trigger-
releas...](http://blog.mclemon.io/hacking-the-canon-dslr-trigger-release-
using-arduino)

~~~
geerlingguy
Nice little project and writeup! I thought about using my SLR but I don't want
to bump it's shutter count too much, and since I have young kids in the house,
there's no good place I can set it up on a tripod for long periods of time
without it taking a tumble :(

~~~
smcl
Ah yeh this was an old-ish DSLR (Canon 450D) that has seen better days so I
didn't mind too much about running it for a few hundred pics every few days -
it's on its way out anyway :)

I had a similar concern with my dog experimenting with the camera setup -
luckily he managed to resist the temptation!

------
Jaruzel
Similar, but not quite... The way I've done timelapse in the past, is via an
old laptop plus an old USB camera, and any number of freeware tools to take a
jpg every X minutes.

I happen to have a registered copy of Webcam32 from years ago, so with that
and copy of XP, I've been able to timelapse things for zero-cost. Then it's
just a case of FFMPEGing the jpgs into an mp4.

However, nothing comes close to a proper DSLR doing it - it's all about the
optics. So I might do the hack described in this comment (I have a 350D):

[https://news.ycombinator.com/item?id=13865967](https://news.ycombinator.com/item?id=13865967)

~~~
glenneroo
I have also been shooting with a various laptops, USB cameras (mostly Canon
PowerShot A-series), software (including my own badly rolled C++ tool using
CanonSDK) before finally settling on GBTimelapse, which ended up being the
killer "app" for controlling multiple cameras at once. I just did a count of
~3 million images, here are some of my more dodgy installations using my now
defunct beloved waterproof Panasonic touchbook:
[https://imgur.com/a/jyNLP](https://imgur.com/a/jyNLP)

I still continue to shoot but I've moved on to using GoPro 5 and various Nikon
DSLRs and I have to absolutely agree: nothing comes close to DSLR and decent
optics! The only problem is that you get slight fluctuations in image
brightness even when shooting identical shutter speed, etc. which necessitates
a non-free tool like GBDeflickr or LRTimelapse to get flicker-free video.
Alternately just stick to using non-SLR cameras such as GoPro or other Compact
with the function builtin, which I've noticed is becoming quite standard in
most cameras.

As for controlling your Canon, if you want to skip a step (and extra hardware
requirements) you could just put MagicLantern on an SD card and write a LUA
script (or download one of the many available ones out there).

------
mcjiggerlog
Has anybody found an easy way to power a zero via solar? I haven't been able
to find any cheap or lightweight solutions. It'd be perfect for a project like
this.

~~~
Jaruzel
I explored this once. The camera actually draws a fair bit of current, so you
need big (1Msq) panels to run the Pi-Zero properly and/or charge a battery.

~~~
geerlingguy
Yeah, the only way to get it to work reliably is to also employ other energy-
saving tricks, like using a Sleepy Pi HAT and a rechargeable battery. The cost
starts inching towards $1k+ at this point (not to mention the time involvement
as well).

However, it's definitely doable, and if you have something like a year-long
construction project... it's not really that expensive for what you'll get in
the end!

------
Nexxxeh
Thanks geerlingguy, your Pi-related content is always useful and enjoyable to
read.

------
chaz6
This is a nice write-up :-) Any chance you could provide a dd image to get up
and running quickly?

~~~
geerlingguy
Before the Pi Foundation released Raspbian Lite, I used to distribute a semi-
popular 'diet' image of Raspbian for headless Pi servers, but found that in
addition to extra bandwidth costs, there were many little security risks
associated with maintaining an OS image. So I'm not interested in taking on
those risks again, unfortunately.

I would like to get the packaging and installation of this script a little
more streamlined, though!

------
blackout-314
i've created an awesome for raspberry [https://github.com/blackout314/awesome-
raspberry-pi](https://github.com/blackout314/awesome-raspberry-pi) :D

------
laxentasken
I'm building this at home too. Quite exciting!

~~~
geerlingguy
Nice! Are you using the Zero W or one of the other Pi models?

