Raspberry Pi timelapse project

By | January 19, 2014

When I found myself living in a flat on the 29th* floor of a building in Paris, with very few line of site obstructions, I decided I had to do something to capture it.  I grabbed a Raspberry Pi and Camera module.
* For those keeping score, it’s the european 29th floor, which makes it the US 30th. Then it’s on top of a 3 story shopping mall, making it effectively the 33rd floor I guess?

Gear:

  • Raspberry Pi rev 2, 512MB (PI1)
    • 64GB SD Card
    • Raspbian Wheezy, 12-20-2013 release
    • Camera Module
      • Filesize ~ 2.8MB
    • Logitech USB c930e
      • Filesize ~800KB (sadface)
      • Lots of awesome bells and whistles, like auto exposure control for low light
    • Realtek wireless module
    • The only cable is the USB Power cable to keep it as out of the way as possible
  • Raspberry Pi rev 2, 512MB (PI2)
    • 64GB SD Card
    • Raspbian Wheezy, 02-09-2013 release
    • 1.5TB Seagate USB Drive
    • Hardwired ethernet
  • Gaff tape (cause it’s what I had on hand)..I know…not duct tape; sorry!
  • Plastic zip seal sandwich bag (also…on hand)

So basically I have 1 cam inside looking through a window, and 1 cam outside wrapped in a baggy (with my fingers crossed it’s sufficient weather proof).

Most of the timelapse projects I’ve seen were all for short video captures, over the course of a few hours at most.  I intend to capture this from start (Jan 18) to move out (July 31, or so)….so I needed to do a little muddling around myself.  This is entirely a learn as you go sort of thing.  I’ve had all of about 2.5 hours of debian experience to date, so I’m learning the hardware and OS nuances at the same time.  So far tho, really not so bad.

The raspberry Pi camera module is definitely awesome considering the cost and size, but I have to say I’m not really a fan of the ribbon cable; tho obviously given the price I have basically nothing to complain about.  The Logitech camera is actually performing quite amazingly as well.  I ended up using 2 different software packages for the 2 cameras since the rPi package is specifically for the official camera module.

PI1 has 2 cronjobs running to handle the image capture:

*/10 * * * * /home/alathers/bin/timelapse.sh /home/alathers/TimeLapse/Paris/AveDItalie/picam
2,12,22,32,42,52 * * * * /home/alathers/bin/timelapse-usb.sh /home/alathers/TimeLapse/Paris/AveDItalie/usbcam

The angle on each camera is different, but I also added a 2 minute timing offset to see if I could catch different lighting scenarios and such as well.

 

/home/alathers/bin/timelapse.sh
#!/bin/bash

 

path=$1
shift
timestamp=date +%Y%m%d-%H-%M-%S
/usr/bin/raspistill -q 100 -ex auto -awb auto $* -o ${path}/${timestamp}.jpg

 

 

cat timelapse-usb.sh
#!/bin/bash

 

path=$1
shift
timestamp=date +%Y%m%d-%H-%M-%S
/usr/bin/fswebcam -q -d /dev/video0 -r 1920x1080 -D 3 --no-banner $* -S 5 ${path}/${timestamp}.jpg

On PI2 I did the follow:

sudo apt-get install dosfstools
sudo mkdosfs -F 32 -I /dev/sda1
mount /dev/sda1 /mnt/Stills/

setup Samba to share this as well

cat /etc/samba/smb.conf

 

[Stills]
comment = TimeLapseStills
path = /mnt/Stills
writeable = Yes
only guest = No
create mask = 0777
directory mask = 0777
browseable = Yes
public = Yes
guest ok = Yes

scp PI2:~/.ssh/keyfile.pub PI1:~/.ssh/authorized_keys
crontab -l
*/10 * * * * /usr/bin/rsync –remove-source-files –progress –stats -rltDv 192.168.1.123:TimeLapse /mnt/Stills/

What’s next?
I’m considering using the advice from here:

Debating if I’d rather build the video on PI2, or if I wanna do it from a more powerful desktop, since by early summer it looks like I’ll be rendering a multi gig file. Likely gonna do it on the desktop (hence the samba install)

Issues so far:

  • Mundane things like keeping the external camera lens clean without moving it too much, or keeping the window clean in front of the Pi-cam
  • Exposure control on the PiCam, and maybe the USB cam as well.  The PiCam seems to get awful photos at night.  Worst case I might just dump them from the final project, but I’d rather hack around and figure out how to control the exposure settings more effectively.  If it requires me manually feeding it smart exposure settings, I might find myself going crazy with stuff like…grabbing sunrise and sunset times from some weather source…maybe even weather reports, and then wrapping the cronjob in more elaborate logic to drive correct exposure for the given conditions
  • I had to move the PiCam to properly catch the sunset.  Cause…come on!  It was like 5 degrees out of frame on my first setup.  (Which was done mid morning on hour 27 of a jetlag recovery no sleep adventure)
  • Side angle glare from things hitting the window in front of the PiCam.  I think I’ll just solve that with more Gaff Tape.
  • WiFi access on PI1 is abysmal.  Probably power related, but might be other stuff.
    1. Packet Loss
    2. Throughput ~ 50Kbps

Issue #1: Suspicion this either due to absolute saturation of WiFi channel overlap, or also potentially a known issue with the RealTek driver, ala this article:.

So I created the file: /etc/modprobe.d/8192cu.conf
# Disable power saving
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

More to come?

Video Samples:

https://vimeo.com/84525734