Garden Timelapse Camera
Expanded from my garden log.
This project is predicated on three things: my love of plants, my insufferable impatience, and my absolute insistence to do everything the hard way.
flowers + impatience = morning glories
flowers + do it the hard way = start from seed, train on trellis
flowers + impatience + do it the hard way = make a timelapse camera to watch them
(This is real math)
- Raspberry Pi Zero (would've been easier with a Zero W but I have no money!!!)
- RPi Zero Camera Module + connector
- Micro USB cable for connecting Pi to PC
- Housing (sour cream container )
Step one is setting up the Pi... I got the latest version of Raspberry Pi OS Lite from the official source. I used the official RasPi Imager to flash the image to a 32GB microSD from an old cell phone. There are more detailed instructions for this bit elsewhere on the Web. After it was flashed, I connected the camera to the Pi, inserted the microSD, and plugged it into my laptop via the USB IN port (not power).
Step two was communication with the Pi. The Pi Zero doesn't come with WiFi and Bluetooth like the Zero W, so it took a little thinking and searching. I found this blog post that explained how to connect it via USB as an Ethernet device, allowing you to ssh into it, essentially enabling you to use the command line from a remote device as long as the Pi is connected. When I tried this on Linux Mint, I had to go to Network Connections > Wireless Ethernet 2 (or whatever number it has assigned itself) > IPv4 Settings and change from DHCP/Automatic to Link-Local only. When I tried it on Windows, I didn't have to do anything special. Yay!
Step three was programming the Pi. I followed this official tutorial, minus any LED stuff. When programming the Pi, I realized I needed to download the PiCamera library! I couldn't figure out WiFi sharing on Linux, so I had to reboot into Windows. Once there, I had to go to my WiFi connection's Properties (my VPN, technically) and under the Sharing tab allow other devices to connect through it. Again, I had to figure out which Ethernet connection it was, but it was listed under Network Connections. After that, I was able to ssh into the Pi and use apt-get to download PiCamera. Everything else follows the tutorial pretty exactly, although I set it to photograph every 5 minutes — plants only grow so fast — and made the picture resolution 1920 x 1080 because I go big or go home. Then I used chrontab to make the script start on boot.
Step four was rigging it up. I don't have access to a 3D printer, and I don't have the money or patience to wait for a case to be printed custom and shipped. Soooo I took a used plastic container, made a few holes, and taped the camera inside with the cable (connected to power this time) sticking out the side. Then I plunked it outside and let it rip.
After a few hours outside, I brought it in and set about actually making the timelapse. Turns out 340+ frames of 1920 x 1080 photos is a lot of data. I used ffmpeg to make it into a video that ended up being over 300MB! Ahh!! And when I used ffmpeg to make it a GIF it was still 185MB!!! Ahh!!! So instead I fiddled with ffmpeg and figured out how to make a downscaled GIF with a few fewer frames — here's the final result.