Adding a Camera to RaspberryPi for Use in TerrariumPI

Stuart Brown
3 min readJan 26, 2019

--

This isn’t going to be a long post because I’m not really implementing a solution that I would want to use in a real setup. Rather I’m using a USB camera that I had lying to around to get an idea of how static images (and ultimately a streaming web cam) might be available via TerrariumPI.

In my case I had an old PS3 USB camera in a drawer somewhere; you may well have a similar old piece of hardware available and hopefully this post gives you a way to quickly use that within the TerrariumPI before you decide on whether or not to by a proper camera for RaspberryPi.

The first step is to ssh into your RPi and run sudo raspi-config. This should bring you to a screen that looks like the below:

From this menu you want to select item 5 — Interfacing options (you navigate this menu via the arrow keys on your keyboard and hit enter to select).

On the subsequent menu you want to select P1 Camera which brings you to this prompt

hit the left key to highlight <yes> and press enter, select OK on the next screen and you should be taken back to the first menu you encountered. Here press the right arrow key to drop down through the menu items until you get to Finish and then hit enter. Then choose to reboot your RPi. From now on all the config you need to do will be done from within theTerrariumPI interface.

Adding a Webcam to TerrariumPI

Navigate to the TerrariumPI UI at <LANIP>:8090 (e.g.192.168.1.2 :8090), navigate to the Webcam menu item on the left and choose the Settings sub -menu item. The page you reach should have a blue + button top right; click it and you should see the form below (you can see the details I have added).

I’m pretty sure that you can use the /dev/Video0 location and things should work for you, but if you need to check the location of your camera you can run ls -ltrh /dev/video* which should confirm the location.

Going through these steps should setup a static camera for you. It is possible to set up a streaming camera which uses HLS. In order to do this you go through exactly the same process as above but in the location field you need to use rpicam_live rather than /dev/Video0 in the location field. I’m definitely going to set this up but at the moment I’m (impatiently) waiting for a couple of cameras (Camera Module Board 5MP 160° Wide Angle Fish Eye Lenses For Raspberry Pi & Camera Module Board 5MP Webcam Video 1080p 720p for Raspberry Pi 3) to arrive from China. To be clear you can currently only use one webcam at a time on the RPi, but I wanted to try out both of these cameras. I’ll post more when they arrive!

--

--