About a year ago, I got my first Raspberry Pi, and sometime in the past year, I have come to understand it as a powerful computer that I can dedicate to a specific task. A couple weeks ago I got the Raspberry Pi Camera Board, a simple camera that...well...takes pictures.
The obvious thing to try is time lapse photography since I know I can make the RPi take a lot of pictures, and another piece of software can stitch them into a movie. So I have the method I used for doing it here. There are lots of ways to do this. I am just showing how I was able to do it in a short period of time.
Connect the Camera
This was pretty straightforward, and there is a tutorial for this here.
Take a Picture (probably a selfie)
No additional software is needed to do this. You just need a simple command:
raspistill -o picture.jpg
This captures a picture and stores it on the Pi. If you want to specify a location for it then you can put that in there (/home/pi/camera/picture.jpg). I am a folders kind of guy.
Now you can set up for your actual experiment. This is actually the hard part. You want to find something that changes dramatically, but does it very slowly. Obvious things include clouds, traffic, etc. I didn't have access to a good view or anything I would consider to be weather-proof. So I went with lettuce leaves changing their color when placed in a small amount of food coloring. Here they are at the start of my experiment.
Over time, through capillary action and some other processes, these lettuce leaves should absorb the food coloring in the beakers. So now I am ready to get it moving.
raspistill -o /home/pi/camera/lettuce/lettuce_%04d.jpg -tl 60000 -t 43200000 &
This command has a few basic parts
- raspistill - the name of the program I am calling up
- -o /home/pi/camera/lettuce/lettuce_%04d.jpg - an output file to a specific folder. This command will automatically make a new file with a four digit number. So the first file will be lettuce_0001.jpg. The next will be lettuce_0002.jpg and so on. This is very handy when it comes time to sequence them.
- -tl 60000 (this is the letters 't' and 'l'. I tried the number '1' and a capital 'I' and failed both times). This is an interval. The camera will take a picture every 60000 milliseconds, or 60 seconds.
- -t 43200000 - the total time for this experiment. It will run for 12 hours.
So when all is said and done, I should have one picture every minute for 12 hours, which comes out to 720 pictures. Unless you change something about the size of the photo you take, each picture will be about 2.4MB.
Getting the pictures from the camera, can be a bit of a trick. There are a couple methods you can use. In the big picture sense (pun!), you will probably want to transfer these pictures to a computer with a little more processing power than the Raspberry Pi. There area few methods for this. Below are the ones I researched before settling on something that I really liked.
- Rsync - This method will sync a folder on the Raspberry Pi with a local folder on another machine. This uses an SSH connection between the two machines.
- Dropbox - This method makes a lot sense (though I haven't tried it yet). It basically allows you to save the files to your drop box folder as it goes. There are a lot of benefits to this method as you can access the pictures from anywhere.
I finally settled on using WinSCP. This is something I ended up using for other web work I was doing. It occurred to me that knowing the IP address of the RPi, I could SFTP to go in there and transfer the files I needed. This worked great, and allowed me to use some software I was already familiar with.
With all of the files selected and organized, I could use another piece of software to sequence the pictures into a time lapse movie. Some photographer friends recommended Cineform Studio, which is the free software that accompanies the GoPro camera. Just a word on this kind of thing. I am already well outside my comfort zone, and trying to discern between different photo editing packages is like asking me to learn Shakespeare in Latin. There probably lots of ways to go here, but this one seemed intuitive for me.
This would be the part where I put the finished video, but I am letting this run for another few hours, so that will have to wait. But until then, I hope you have found this helpful!