Basil Watch!
In a perfect storm of events, I found myself with a raspberry pi that was not being used for anything, a raspberry pi compatible camera, some recently acquired basil seeds, and a few hours of free time. Naturally, the thing to do was set up a timelapse camera to monitor my basil’s growth. This was accomplished simply enough with an extension cord, some duct tape and a bash script.
1#!/bin/bash
2
3while true
4do
5 HOUR=$(date +"%H")
6 # This saves us from having 8 hours of black frames every night.
7 if [ $HOUR -lt 20 -a $HOUR -gt 6 ]
8 then
9 DATE=$(date +"%Y%m%d_%H%M%S")
10 raspistill -ex auto -o /home/pi/camera/$DATE.jpg
11 convert /home/pi/camera/$DATE.jpg -scale 50% /home/pi/camera/plant.jpg
12 scp /home/pi/camera/plant.jpg webserver:/location/of/website/plant.jpg
13 fi
14 sleep 120
15done
I am aware that the raspistill utility has timelapse capabilities, but since I wanted to publish each snapshot to my website, I found it easier and more flexible to write a bash script (Even if I made a stupid mistake with it and lost a day of footage). The script takes a snapshot every 2 minutes and saves the picture locally. It then makes a resized copy of the last saved picture and sends it to my webserver. That picture can be found here. Meanwhile, every few days, I will manually move the pictures saved on the pi to my desktop where I have more storage. After a month or so, I will hopefully be able to make a nice little timelapse movie of a plant growing from (almost) seed to maturity.