Terrarium Sensors and Time Lapse

Hi there,

We’re brand new to RPi, so any assistance would be greatly appreciated.

We’re looking at creating a time lapse project of a plant growing in a terrarium. The camera will be situated around 40cm away from the plants (looking down onto them). I’m therefore considering something like the Raspberry Pi 4 Model B 2GB with Raspberry Pi High Quality (HQ) Camera and Raspberry Pi 6mm Wide Angle Camera Lens (CS-Mount). Would I be on the right track with all this?

The idea would be to photograph these plants every hour or so. They will generally be under good lighting.

In addition, I’d like to record some sensor information too. I was looking at something like the Soil Moisture & Temperature Sensor (Seeed Studio) and some sort of air sensor that would ideally sense temperature, relative humidity and CO2 if possible.

Given that the whole project may get wet as well as warm / humid, what things should I consider to protect the electronics, but still get the sensor readings and photo images?

Thanks so much.

1 Like

Do you have a solution in mind for the photograph software? May I suggest Motion.

It’s mostly intended for video capture triggered by motion detection, like with security cameras.
But within the config also provides support for time-lapse style snapshots taken at regular intervals, saved as bitmaps. Or as actual time-lapse videos covering defined periods, hours, days, weeks, etc.

Sorry, no comments regarding your other questions.


Thanks so much for the feedback @Chris44916. I guess I ‘assumed’ that part of the camera programming / set-up, I could simply write some code that would automatically do the timelapse for me. I’m guessing that is wrong to think that.

Does Motion also then allow me to automatically upload those images to the internet, or can I simply remote into the RPi and extract the images?

1 Like

I just wouldn’t know where to start with writing code to take photos from scratch.
But I mostly wanted to suggest Motion because I’ve found it very nice to use for my round-the-home security cameras (with its motion activated detection stuff). And I do remember it having specific instructions / support for RasperryPi and its Pi Camera. Plus obviously time-lapse support.

Motion does have web-stream support. Although I wouldn’t recommend opening that up to the Internet. Opening up your Pi to the outside world is not a good idea.

But yes, a better idea would be to periodically upload the image (or video) files to the Internet. Perhaps create a cron job on the Pi to do this automatically for you. Eg: On the hour, rsync the files to your webserver.

Back to your initial questions: If it were me I’d probably opt to have the Pi and Camera on the other side of the glass. The temperature, humidity sensors and etc would probably be fine inside the terrarium tho. 'spose they are built for exactly that job.


Thanks again @Chris44916. I have a team of programmers, so I don’t think the programming side will scare us too much. It’s just not really that sort of project I guess. This was just something to play around with a bit as we’ve never yet used an RPi etc., so this was just going to be our first little test to see what sort of data we could easily gather from our little terrarium.

Thanks for the feedback Chris.


Hi Kirk,

Sounds like an excellent project! Scripts to automatically take the images and convert it to a timelapse shouldn’t be the difficult part programming-wise, there are a few tutorials up for that if you need it. Should be very similar no matter which form of camera you use with your Pi. As Chris said, you could also setup a Cron job to automatically perform actions without user interaction based on time. Otherwise, for the sensors you’d like to use, personally, I’d be using the following (I2C is a preference, you can just as easily use SPI, or another form of communication to your board, note that the boards also include the appropriate jumpers already):

(This applies to both these parts)

You can use the two of these together with separate I2C connections/addresses and you should be able to measure eCO2, Temperature, Humidity and Ambient Pressure all at the same time using very similar programs. If you want to take it even further, you can have it automatically take the readings at the same time as the photos, so that you can either check the data in real-time, or have the ability to graph it out, or check it at each point. If there’s anything else that I can help you with, please let me know!

Core Electronics | Support

1 Like

For a real beginner in the RPi journey, these are some wonderful links. Thanks so much for your time today @Bryce and your help in pointing me in the right direction. Can’t wait to get started.


1 Like

Glad to hear it Kirk,

We’ll need to see a timelapse from the project once it’s done :grin:

Core Electronics | Support