Timelapse number 3: accomplish a few improvements in the timelapse process.
- 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?)
Note on Weatherproof Case
Weatherproof Pelican case is on order, but it's going to take two more days. In the meantime, we need to make some progress on this camera stuff. Move on with it.
Putting off the weatherproof case for Timelapse number 4 or number 5.
My goal was to house the camera and get better stability/control than the terrible botched christmas-present wrapping of scotch tape that I did last time in RaspberryPi/Timelapse2. Shouldn't be too hard.
The big improvement will come when the weatherproof Pelican case arrives, and I'll attach a weatherproof port for the camera on the outer housing of the Pelican. But in the meantime, here are some short-term improvements.
I went to the craft store to get a a big stick, and I laid everything out in a natural way and taped it all into place. One of the big mistakes I made last time was trying to bend the ribbon cable attaching the camera to the RPi out of a natural position, which led to it popping loose inside of the camera housing. With this configuration, things have the space they need.
It is nowhere near weatherproof... but the weather has been nice lately.
If you love the Rasperry Pi... You're gonna love the Raspberry Pi on a stick!!!
Outfitting for a Tripod
I was able to drill a hole in the center of the wood to create a hole that could be attached to a tripod-mountable screw I had. This enabled me to attach the camera to a tripod, and adjust the angle of the camera. I even tied a piece of cord around a hole at the end of the plank to tie to the balcony, in case of massive failure of the tripod.
The only part I forgot to secure was the back of the camera. Upon completing my brilliant tripod design, I promptly attached the tripod, tilted the camera, and spilled the back of the camera overboard and onto a second-story roof awning.
So much for being a hardware hacker.
Running the Camera
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 .
Run Timelapse Script
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)
Serving Up Photos
To serve up the photos, SSH into the Pi, and cd to the directory where the photos are located. Start a screen session by running the
screen command. Now run a Python simple HTTP server by running the command:
$ python -m SimpleHTTPServer 8080
Now the directory of photos from the Pi camera should be accessible at the Pi's IP address, port 8080. For example, if the Pi is at the IP 192.168.0.111, then the photos can be viewed by pointing a browser (also on the local network, of course, along with the Pi) to the address:
This is typed into the browser, and the files in the directory are served up by the Python simple HTTP server.
Inspiration: OpenCV to identify (and target) squirrels: https://www.youtube.com/watch?v=QPgqfnKG_T4
Raspberry Pia tiny tool for performing extraordinary acts beyond good and evil - with an ARM processor.
Basic Pi Information and Operations:
Organization/Layout of SD Card: Kali Raspberry Pi/SD Card ·
Disable IPV6 on the Raspberry Pi: Disable_IPv6_Pi
Kali Linux on Raspberry Pi:
Debian Raspberry Pi:
Raspberry Pi Circuits:
Raspberry Pi Timelapse Photos:
Flags · Template:PiFlag · e