DIY Cannabis Grow Timelapse with a Raspberry Pi

In this guide, you will learn about the basics to timelapse your grow. Furthermore you will learn how to setup Linux on a Raspberry Pi Minicomputer, remote control it via VNC and how to use it as an FTP server.


List of items

To copy my workflow of approximately 10 minutes a week you need the following items:

Raspberry Pi 3 Model B is used as an automated photographer and FTP-Server for easy access.
  1. Raspberry Pi Minicomputer (buy @ , 35 $) (Raspi) – This is the heart if this project. This device captures the photos at the right time ,saves the photos and is also your local Fileserver. There are different versions of the Raspberry Pi. Its important that the device can run WLAN. The best Pi to do this is the Raspberry Pi 3 Model B which brings the most calculating power.
  2. Raspberry Pi Wide Lens Camera (buy @, 23 $) – There are also some PiCams without a wide lense, but the optic helps alot in very
    picture of raspberry pi cam
    Raspberry Pi Cam with wide lense optics







    narrow rooms with less space

  3. A Power source for the Pi – You actually will not get this with a purchase of a Raspberry Pi! Make sure to have a power plug with a Micro-USB dongle which can deliver 5 V (Volts) and between 700 – 1000 ma (Milliampere). Any old smartphone loading plug should do it.
  4. HDMI-Cable, USB-Mouse and USB-Keyboard – You will need that only for setup. Once you setup the Pis remote control, you can use these for other purposes.
  5. Micro SD-CardThis is your hard drive of the Pi. Make sure you have one extra because this will stay in the Pi for the course of the run. 32 GB should be OK. for a whole run.
  6. WLAN Router – Since you cant access the filesystem on the card, without a linux based system, you will need to establish an FTP connection to the Pi. This is also pretty convenient because you dont have to interact with the Pi while its in the grow room anyways
  7. Micro USB power plug
    Micro – USB Power Plug


    PC, Notebook, etc … – This is necessary for moving pictures and merge the images in a reasonable time.

  8. Micro SD-Card reader – You need this to install the operating system on the Micro-SD Card. 



Preparations – One Time Setup

Get the Pi ready

Everything in the Chapter Preparations you only need to do once.

  1. Download the operating System. You get the files here: . The Version is called Raspian Stretch with Desktop as .zip and unzip it after downloading.
  2. In the meantime you download the software Etcher from You need that to get the OS on the SD-Card.
    Etcher User Interface – if you fuck up here you’re not made for this.
  3. After its done, put the Card in the Pi.
  4. Connect the HDMI-cable to a screen and then to the Pi alongside your USB-mouse and USB-keyboard.
  5. Plug-in the power and wait…


Raspberry Pi configuration

Congratz! You got a computer on your hands with the power of a five year old smartphone. Very much enough for this guide tho. The Pi wants to change the default setting at first start – its recommended but not necessary. The default login is username: pi, password: raspberry.This will be important later.

raspberry pi configuration screenshot
Menu of the Raspian OS. Click on the raspberry symbol on the upper left > Preferences > Raspberry Pi Configuration
  1. In the configurations menu (caption of the picture) you can change the login.
  2. We will access the system time to shoot our photos. Make sure to change it to your local timezone: Click on Localisation > Timezone and choose the respective timezone.
  3. In the field Interface you activate the options Camera, SSH und VNC.
  4. Also in interfaces there is the option Keyboard. Set it to your needs! Coding is hard, if you’re using an EU keyboard with US (default) settings.
  5. On the Desktop to the upper right is a symbol to the WLAN connection. Connect it to your local WLAN.

Reboot the Pi to have all settings activated. You’re done configuring this for now. We’re heading to test the camera.



Testing the Camera – Your first picture

Connect the camera to the Pi. Make sure the connection adapter is tight aroung the cable. You can actually pull the sides of the connector out and back in after you set up the cable. Try it!

  1. Start the Pi by plugging in the power plug if not done yet.
  2. Start the Terminal  (tool bar to the upper left) and update/upgrade the OS by typing in a row and confirm with enter:
    sudo apt-get update
    sudo apt-get upgrade
  3. This might take a few moments.
  4. Test the camera by typing in the terminal
    raspistill -v -o test.jpg

    This code will create the file test.jpg and saves it the given place (home/pi). Open the file to check out the picture!

  5. Call your local IP adress via typing
    hostname -l

    in the Terminal and write it down for the moment.

If the camera works, we now need to setup the automation and remote control.



VNC, SSH, FTP – Remote access

Our key target is to have the Pi shoot pictures inside the tent automatically. This is why the next step is to put the pi into the tent. You dont need the periphery keyboard, mouse or monitor anymore. Its your job now to find a nice perspective for the pi. Mine is below my DIY COB Light. Another Pi-Cam got installed on the wall. Mind that a Raspberry Pi can only handle one distinct Pi-Cam, but more than one USB-Webcam.

Remember this might be the final position. Test that, and make sure that it never moves.

picture of led light diy grow light picture of pi cam setup raspberry pi camera

  1. If everything is alright in the room, you can now switch on the Pi by plugging in the power source. There is no need to have a keyboard, mouse or monitor to be attached anymore,
  2. Download VNC-Viewer to your home PC or notebook (not the Pi). Remember to have the Pis IP adress around as well as the password and username for the connection. You can access the IP adress via your router config or by typing hostname -l in the Pis terminal.
  3. If you are connected tryout the code for shooting a picture again and calibrate the camera very carefully. You can turn on the lense to make the picture more sharp.
  4. Test the FTP connection: Download FileZilla or something similar (Filezilla download: Don’t choose the pro version, its not needed.
    1. After you started Filezilla click File > Servermananger to connect.
    2. Protocol: SFTP – SSH File Transfer Protocol
    3. Server <local adress of the Pi>
    4. Connections: (normal: not as safe) but most convenient.

Now you should be connected to the Pi via your PC/notebook. You can now access the filesystem of the Pi via FileZilla and remote control it via VNC.



Creating the scheduler for the pictures

Now we are ready to script our photo scheduler using the software crontab on the Raspberry Pi. This software is able to execute operations at given time intervals. Perfect for timelapses.

Create a folder and change the restriction on it immediatly

We cant always create, read and write folders or files on the Pi, so we need to manipulate the accessability on a given folder first. Via rightclick > properties > permissions you can solve this. In the target folder for the pictures everything should be available for everyone.

Create the file “” for capturing the photos

In the target folder (where you changed the read/write rights): Rightclick > Create New… > Empty File and name it

  1. Open the file in Text Editor and write the
    export LD_LIBRARY_PATH=/usr/lib/
    cd <Path of the folder>
    DATE=$(date +"%Y-%m-%d_%H%M")
    raspistill -n -q 100 -o <Path of the folder>$DATE.jpg
  2. Just exchange
    <Path of the folder> 

    with the path to the place where is. This code creates filenames like: 2018-10-15_2250.jpg and will therefore list the pics chronologically inside the folder.

  3. Test the script: Open up the Terminal. Navigate to the right folder via cd <Path of the folder> and confirm with Enter. After this you type in:
    sudo sh

    into the Terminal. If everything works as intended there should now be a .jpg with a timestamp in the right folder!

Configure crontab to finalize automazation

In order to do this last step of preparation you need to be remote connected to the Pi via VNC. Open up the terminal and write:

sudo crontab -e

If you get asked what editor to choose, take nano. The terminal should change to this:

Linux terminal screenshot
The linux terminal.

Be careful when editing this file! Scroll to the bottom of the file and press Enter to end up with a newline without a “#” symbol upfront.
Disclaimer: Youre probably using other light cycles. And we want the camera only to shoot when its bright for the plants.

*/20 21,22,23,0-8 * * * sh <Path to the folder>/

How does this code work?

  • */20 takes a photo every 20 minutes in a given hour
  • 21,22,23,0-8 says that it only shoots pictures between 21:00h and 08:XXh. Change this, if youre different cycles!
  • * * * takes care of weekdays, months and years. You put in asteriks so that you dont need to bother for this on the course of your run.
  • sh initializes the shellscript of the file
  • <Path to folder>/ tells the cronjob what is to execute. In our case the photographing script.


Weekly tasks

Via the software FileZilla you should backup your files regulary. I do it once a week. If you config crontab my way, you will shoot about 18 pictures a day.

ffmpeg and rename.bat – Creating the timelapse

Turn on your PC/Notebook.
In order to use ffmpeg follow the instructions here. You only need to do it one to make it work:
ffmpeg works the easiest with filenames that are numbered in order. To transform the filenames you need to create a file which you call rename.bat and write in the following code:

@echo off
setlocal EnableDelayedExpansion

set i=0
for %%a in (*.jpg) do (
set /a i+=1
ren "%%" "!i!.new"
ren *.new *.jpg

Now create your first timelapse:

  1. Copy all pictures to the folder with rename.bat in it. Never run rename.bat in your backup folder. It will destroy everything.
  2. start CMD and navigate to the timelapse folder: type in
    cd <Path to the folder containing the renamed pictures>
  3. type in the following to initate the timelapse process:
    ffmpeg -r 60 -i %d.JPG -s 1440x1080 -vcodec libx264 timelapse.mp4

This will create a 60 FPS videofile named “timelapse.mp4” with the resolution 1440×1080 under the x264 codec out of the renamed frames.

Maintenance and cleanup

It happens rarely, but you will find frames which you dont want to use in the timelapse. You need to sort them out before you rename the images and merge them. The ffmpeg code will not work if hes not fed with consecutive numbers.


Grower watering his plants
The grower got caught watering the plants. This will not look good in the final timelapse.
Liked it? Take a second to support me on Patreon!

2 thoughts on “DIY Cannabis Grow Timelapse with a Raspberry Pi”

  1. Nice post. I was checking constantly this blog and I am impressed! Very useful info specifically the last part 🙂 I care for such info a lot. I was looking for this particular info for a long time. Thank you and good luck

  2. Linux is a stable, modular, community built, free OS. The GNU toolchain is the solid base for development. The best thing about linux is the freedom to make it your own. The community allows a direct relationship between end-users and developers. Distros allow efficient sharing of configurations and pre-compiled binaries with package management systems, simplifying system maintenance.

Leave a Reply

Your email address will not be published. Required fields are marked *