Skip to main content

Overview

Capture still images from a Raspberry Pi Camera Module through natural language commands. Take photos on-demand, schedule periodic snapshots, or trigger captures from webhooks. What it does:
  • Capture photos via chat commands
  • Save images with timestamps
  • Schedule periodic snapshots
  • Webhook-triggered captures (motion detection, etc.)
Hardware: Raspberry Pi 4/5, Camera Module 3/HQ (CSI connection) APIs used: Custom Edge API using rpicam-still

Architecture


Complete Implementation

Edge API on Raspberry Pi

Setup (one-time)

Camera on Bookworm: The modern rpicam-still command is included by default. Old libcamera-still is now a symlink to rpicam-still.

Edge API Code

Update edge_api.py (or add to existing):

Run Edge API

Test Edge API


Lua Agent Implementation

src/tools/TakePhotoTool.ts

src/index.ts

Uses LuaAgent with scheduled jobs for daily snapshots and webhooks for motion-triggered captures.

Environment Setup


Camera Setup

Physical Connection

Connect Camera Module 3 or HQ to the CSI port on Raspberry Pi. Ensure ribbon cable is firmly seated.

Verify Camera

Troubleshooting: If camera is not detected, check ribbon cable connection and run vcgencmd get_camera to verify detection.

Testing


Key Features

On-Demand Capture

Take photos via natural language commands

Scheduled Snapshots

Daily photos at specified times

Motion-Triggered

Webhook integration for motion sensors

Photo History

Track all captures in Lua Data

Advanced: Motion Detection Integration

If you add a PIR motion sensor, you can trigger the webhook:
Your Lua webhook will receive the event and capture a photo automatically.

Next Steps

View All IoT Demos

See all 3 Raspberry Pi examples