Documentation

PiCamera Extension

The PiCamera extension adds support for taking photos and recording video using a Raspberry Pi camera module.

Overview

The picamera extension allows you to take photos of your plants using a Raspberry Pi camera. Connect a camera to your Raspberry Pi and make sure you have enabled camera support through raspi-config.

Note

As of MudPi v0.11.0, this extension uses picamera2 — the Raspberry Pi Foundation's official camera library. The legacy picamera library is no longer maintained. Raspberry Pi OS Bullseye or later is required for picamera2 support.

This extension does not require extension-level configuration and is focused on interfaces.

Camera Interface

Provides a camera to take photos or record videos from a Raspberry Pi.

Option Type Required Description
path String Yes Full path where MudPi should save the images. Ensure proper write permissions are set.
filename String No Name to save files as with a timestamp or counter attached, e.g. filename-00001.jpg
record_video Boolean No Set to true to put the camera in video mode. Default: false (photo mode)
delay Object No Interval between photo captures. Default: 5 seconds
delay.hours Integer No Hours between captures. Default: 0
delay.minutes Integer No Minutes between captures. Default: 0
delay.seconds Integer No Seconds between captures. Default: 0
resolution Object No Photo resolution. Larger resolution means larger file size.
resolution.x Integer No Width in pixels. Default: 1920
resolution.y Integer No Height in pixels. Default: 1080
record_duration Integer No Time in seconds to record video in record mode. Default: 5
framerate Integer No Camera framerate. Default: 15
topic String No Channel for broadcasting image events. Default: camera/{key}
sequential_naming Boolean No Save photos with a counter instead of timestamp. Default: false
count_start Integer No Starting number when using sequential_naming
max_count Integer No Max photos before overwriting when using sequential_naming
mudpi.config.json
{
  "camera": [
    {
      "key": "pi_cam_1",
      "interface": "picamera",
      "path": "/home/pi/images",
      "filename": "pi_cam_capture",
      "topic": "camera/pi_cam_1",
      "delay": {
        "hours": 0,
        "minutes": 10,
        "seconds": 0
      },
      "resolution": {
        "x": 1920,
        "y": 1080
      },
      "sequential_naming": true,
      "count_start": 10,
      "max_count": 100,
      "record_video": false,
      "record_duration": 5
    }
  ]
}

Tip

Combine the PiCamera with triggers to capture photos automatically based on sensor readings, such as snapping a photo when motion is detected.