From charlesreid1

Third Timelapse

Timelapse number 3: accomplish a few improvements in the timelapse process.

What's working:

  • The camera is working and is able to capture images. There was a problem initially, but after trying to re-enable the camera several times, and rebooting several times, the camera started working.
  • The script to dump images into a directory works great in concept. Easy to keep everything segregated.

What to do differently for this timelapse:

  • LED off
  • 64 gb thumbdrive for space
  • camera angles - better control mechanism
  • case: improved housing for Pi and for Pi camera (integrated?)

In Progress

Weatherproof case

Pelican case ordered.

Camera LED (No Success)

I tried unsuccessfully to set the camera LED state from Python script:

import picamera
camera = picamera.PiCamera()
print camera.led
camera.led = False

According to the help page for the camera object, help(camera), this attribute is supposed to control the camera. I also read you had to be root, so I also tried doing this as root by running Python via sudo:

$ sudo python
>>> import picamera
[...]

No success there. The LED light would come on once I had created the camera object, and would not turn off by setting the led attribute to False.

Camera LED (Success)

To turn off the camera LED, you can edit the file /boot/config.txt and add a directive to turn off the camera board's LED. Add the following to the top of the file:

# disable the camera led
disable_camera_led=1

Reboot will be necessary, but once you do that, there will no longer be an annoying glaring red LED every time the camera is on and talking to the computer!

USB Flash Drive

Plug in 64 GB flash drive.

To mount and make readable/writable by default Pi user, start without the jump drive plugged in. Run this command to monitor hardware that is plugged in:

tail -f /var/log/messages

Plug in your USB drive. It should probably be called /dev/sda1. Once you know the name of the device, you can mount it to a folder (which must exist ahead of time):

sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /home/pi/timelapse

Test that you can indeed make stuff in the new jumpdrive:

cd /home/pi/timelapse
touch file

Hooray! Now move all the scripts there:

cp /somewhere/else/lapse.py .

Here's that lapse.py script again:

import picamera
from datetime import datetime
import time
import os

camera = picamera.PiCamera()

lapse_dir = datetime.strftime(datetime.now(),"timelapse_%Y%m%d-%H%M%S")
os.system('mkdir '+lapse_dir)

###print "Don't forget - to turn off the LED - run this as root!"
###camera.led = False

while True:

    prefix = datetime.strftime(datetime.now(),"%Y%m%d-%H%M%S")
    filename = lapse_dir+"/"+prefix+".jpg"

    camera.capture(filename)
    print "Saving photo to %s"%(filename)

    time.sleep(2)

Finished

Idea Bucket

RaspberryPi/Weatherproof Camera Case

RaspberryPi/Rainberry

Inspiration: OpenCV to identify (and target) squirrels: https://www.youtube.com/watch?v=QPgqfnKG_T4

Flags