Fish Cam – Basic Software

The basic goal of the fish camera is to take a still photo at a fixed interval, put on a time/date stamp, and send the photo via FTP to my blog. I use the same name for the photo every time, so the old photo continually gets overwritten by the new photo. Very basic, and very simple. From my old Weather days, if you wanted to do some sort of SkyCam, it would work exactly the same way.

Timing on the still photo is done via a crontab entry on the Raspberry Pi Zero. Since it is running Raspbian for an operating system, all the linux type stuff works. The crontab entry for user ‘pi’ is:

*/10 * * * * /home/pi/Pictures/ >/home/pi/Pictures/rpicam.log 2>&1

Meaning, every ten minutes of every hour, of every day, run the command, and send any status or error messages to the file rpicam.log.

As for the script, the comments explain it all:


# take a still picture
/usr/bin/raspistill -o /home/pi/Pictures/rpi-cam.jpg -w 1240 -h 720 -n
# overlay datetime from picture data
/usr/bin/convert /home/pi/Pictures/rpi-cam.jpg -pointsize 72 -fill white -annotate +100+100 %[exif:DateTimeOriginal] /home/pi/Pictures/dtg-rpi-cam.jpg
# send to the webhost
/usr/bin/lftp -c 'set ftp:ssl-allow true ; set ssl:verify-certificate no; open -u USERNAME,PASSWORD -e "; mput /home/pi/Pictures/dtg-rpi-cam.jpg; quit" FTP-HOST'

Since the Raspberry Pi Zero is getting it’s time data from the Internet, it should be accurate. Therefore, the time data stored in the still photo’s EXIF information should be accurate, and less subject to change than the timestamp on the file.

I have a Pimaroni Enviro pHat on order, which is an addon board to the Raspberry Pi. The addon will give me access to ambient temperature, barometric pressure, and light level along with several other sensors I don’t anticipate using. In the next major revision of the software, I’d like to overlay the temperature, and barometric pressure at the time of the photo on the photo. Possibly I could use the light sensor to report if there is enough light to justify a photo, and if not, pass on taking a photo.

Leave a Reply