RaspberryPi/Timelapse/Old
From charlesreid1
Old crud, please ignore.
Raspberry Pi Timelapse Photo
Software
Since I hadn't connected my Pi to the net in a while, the first thing I did was to update the package manager:
sudo apt-get update
Next, I upgraded the operating system:
sudo apt-get dist-upgrade
With all of the updating and upgrading out of the way, I moved on to the actual Raspberry Pi camera itself. There is a Python module to control the Pi camera, available through aptitude:
sudo apt-get install python-picamera python-picamera-docs
However, I was still not able to use my camera, because I had to run the Raspberry Pi configuration program. To run it:
sudo raspi-config
You enable the Raspberry Pi camera in the configuration menu.
Setup
The setup I had used one of these as the camera. This is a whopping 5 MP, which is as good as a point-and-shoot, except it's extremely tiny. I was able to get it hooked up to my Raspberry Pi and working just fine with the above steps.
You can use Python code to trigger the camera to take a picture, and you can specify a filename to save to. Here's a quick script I hacked together to take a picture every 2 seconds, and save it to sequentially-numbered files (0001.jpg, 0002.jpg, etc.):
# pic.py
import picamera
import time
camera = picamera.PiCamera()
i = 0
while True:
filename = "%04d.jpg"%(i)
camera.capture(filename)
print "Saving photo to %s"%(filename)
i += 1
time.sleep(2)
To run this, I use screen. I log in remotely, then run the screen
command. In that screen I run python pic.py
. It will print out as it progresses. Running it with screen allows you to disconnect and leave the Pi unattended.
Flags