AI & Agents

How to Build a Raspberry Pi Night Vision Camera with OpenClaw AI

The Raspberry Pi Camera Module 3 NoIR captures 12-megapixel images in complete darkness when paired with infrared LEDs, all for under $60 in parts. This guide covers hardware selection, IR LED wiring, camera software configuration, and how to use an OpenClaw AI agent to automate scheduled captures, filter blank frames, and sync footage to cloud storage.

Fast.io Editorial Team 15 min read
AI agent processing and sharing captured data through a cloud workspace

Why the NoIR Module Sees What You Cannot

The trail camera market hit an estimated $906 million in 2025, driven by wildlife monitoring, property security, and agricultural surveillance (360iResearch, 2026). Most of that spending goes to sealed commercial units running $150 to $500 each, with fixed firmware, proprietary cloud subscriptions, and no way to customize capture logic. A Raspberry Pi with a NoIR camera module does the same job for a fraction of the cost, and you control every part of the pipeline.

The "NoIR" in Camera Module 3 NoIR stands for "No Infrared filter." Standard cameras include an IR-cut filter that blocks wavelengths above roughly 700nm, because infrared light distorts color accuracy in daylight photos. The NoIR variant removes that filter entirely, making the Sony IMX708 sensor responsive to near-infrared light between 750nm and 1000nm. Pair it with infrared LEDs emitting at 850nm, and the camera captures clear images in total darkness, invisible to both humans and most animals.

The Camera Module 3 NoIR uses the same Sony IMX708 sensor as the standard version: 12 megapixels, phase-detection autofocus (PDAF), HDR support, and video at 1080p50 or 720p100. At $25, it is the cheapest autofocusing night vision camera sensor you can buy off the shelf. The autofocus alone sets it apart from older Pi camera modules. Fixed-focus lenses produce usable images only at their preset distance. Autofocus keeps subjects sharp whether they are 30cm from the lens or 10 meters away, which matters when you cannot predict where an animal will appear or how far an intruder will be from the camera.

Add an OpenClaw AI agent to the Pi, and the hardware becomes an autonomous monitoring system. Instead of writing cron jobs and bash scripts for every capture scenario, you describe what you want: capture every 5 minutes, skip blank frames, alert on motion, sync to cloud. OpenClaw handles the scheduling, decision-making, and error recovery while the NoIR camera handles the imaging.

The trade-off with NoIR is straightforward. Without an IR-cut filter, daytime images have a pinkish-red color cast because the sensor picks up infrared from sunlight alongside visible light. For a dedicated night vision camera, this is irrelevant. For a camera that needs both day and night accuracy, you can add a mechanical IR-cut filter that swaps in during daylight, or run two cameras and switch between them based on ambient light levels.

Parts List and Cost Breakdown

The full build uses standard Raspberry Pi components. Total cost ranges from $75 to $130 depending on whether you already own a Pi and which IR LED solution you choose.

Required components:

  • Raspberry Pi 5 (8 GB, $80) or Raspberry Pi 4 (4 GB minimum, $55). The Pi 5 is recommended for running OpenClaw comfortably alongside camera software.
  • Raspberry Pi Camera Module 3 NoIR ($25). The 75-degree diagonal field of view covers a doorway, trail, or garden bed. The wide-angle NoIR variant ($35) covers 120 degrees but introduces edge distortion.
  • IR LED board with 850nm LEDs ($8 to $15). Pre-built boards designed for Raspberry Pi cameras mount directly around the lens and draw power from the GPIO pins. The Dorhea 3W dual-board kit is a widely available option.
  • MicroSD card, 32 GB or larger ($10). Use a high-endurance card rated for continuous write cycles if you plan to record video.
  • USB-C power supply, 5V/5A for Pi 5 or 5V/3A for Pi 4 ($12).
  • Camera ribbon cable, 200mm (included with Camera Module 3) or longer if your enclosure requires it.

Optional additions:

  • Weatherproof enclosure ($15 to $30) for outdoor deployments.
  • External USB SSD for longer recording sessions without wearing out the SD card.
  • PIR motion sensor (HC-SR501, $3) if you want hardware-triggered capture instead of software-based scheduling.
  • Solar panel (20W) with USB power bank for off-grid locations.
  • USB-C UPS HAT for clean shutdown during power interruptions.

Why 850nm over 940nm:

IR LEDs come in two common wavelengths. At 850nm, the LEDs produce a faint red glow visible if you look directly at them, but the illumination is much stronger for the camera sensor. At 940nm, the LEDs are completely invisible to humans, but silicon sensors are 30 to 40 percent less sensitive at that wavelength, reducing effective range. For most night vision builds, 850nm is the right choice. The dim red glow is invisible to most animals and nearly impossible to spot from more than a few meters away. Save 940nm for situations where absolute covertness matters more than image quality.

How to Wire IR LEDs and Connect the NoIR Camera

The Camera Module 3 NoIR connects to the Pi via a flat ribbon cable plugged into the CSI (Camera Serial Interface) port. On the Pi 5, both CSI ports work. Lift the connector latch, slide the cable in with the contacts facing the board, and press the latch down. No drivers to install. The camera is ready to use after a reboot.

Pre-built IR LED boards:

The simplest approach is a dual IR LED board that clips around the camera module. These boards draw power from the Pi's GPIO pins (5V and GND) and need no code to operate. Wire VCC to a 5V pin (physical pin 2 or 4), GND to any ground pin (physical pin 6, 9, 14, 20, 25, 30, 34, or 39), and the LEDs turn on when the Pi boots. Some boards include a light-dependent resistor (LDR) that automatically disables the LEDs in daylight.

Discrete IR LEDs:

If you wire individual 850nm LEDs, connect them to the 5V rail through a 220-ohm current-limiting resistor. Never connect IR LEDs directly to GPIO output pins. GPIO pins supply a maximum of 16mA, which is not enough for most IR LEDs and risks damaging the pin. The 5V rail can supply several hundred milliamps, enough for 4 to 6 LEDs wired in parallel with individual resistors.

For GPIO-controlled LEDs (so you can turn them on and off from software), connect the LED circuit through an NPN transistor (2N2222 or similar). The GPIO pin drives the transistor base through a 1K resistor, and the transistor switches the 5V supply to the LEDs. This lets OpenClaw or a Python script control illumination, turning LEDs on only during capture to save power.

Testing the setup:

After connecting the camera and IR LEDs, verify everything works before installing OpenClaw. Run a quick capture from the command line:

rpicam-still -o test.jpg --shutter 100000 --gain 8

The --shutter flag sets exposure time in microseconds (100000 = 100ms). The --gain flag boosts sensor sensitivity. In a dark room with IR LEDs on, you should see a clear grayscale image. If the image is black, check that your LEDs are powered and emitting. Most phone cameras can see 850nm light as a faint purple glow, which is a quick way to verify the LEDs are working.

Effective illumination range depends on LED power. A typical 3W dual-board setup lights objects at 3 to 5 meters and produces usable images out to about 8 meters. For longer range, add more LED boards or use a dedicated IR floodlight rated for 15 to 20 meters.

Hardware components connected to a processing pipeline

How to Configure libcamera for Night Captures

Raspberry Pi OS ships with libcamera, the camera stack that replaced the older raspistill and raspivid tools. The NoIR module works with libcamera out of the box, but night captures benefit from specific settings.

Still image capture:

rpicam-still -o capture.jpg --shutter 200000 --gain 12 --awb auto --denoise cdn_off
  • --shutter 200000: 200ms exposure. Longer exposures collect more IR light but introduce motion blur on moving subjects. For security cameras where subjects walk through the frame, keep exposure under 200ms. For stationary wildlife monitoring, you can push to 500ms or longer.
  • --gain 12: Analog gain. Higher values brighten the image but add noise. Values between 8 and 16 work well for most IR-lit scenes.
  • --awb auto: Auto white balance. With IR light dominating the scene, colors shift heavily, but for night vision the monochrome-like output is expected.
  • --denoise cdn_off: Disables the color denoise algorithm. With IR illumination, the denoiser can smear fine detail. Turning it off preserves edge sharpness at the cost of slightly grainier images.

Video recording:

rpicam-vid -o clip.h264 --shutter 100000 --gain 10 --width 1920 --height 1080 --framerate 30 -t 10000

The -t flag sets recording duration in milliseconds. For continuous recording, omit it and stop with Ctrl+C or a kill signal from your automation.

Autofocus in low IR light:

The Camera Module 3's PDAF system relies on contrast to find focus. In low IR light, contrast drops and autofocus can hunt back and forth. Two options help:

  • Set a fixed focus distance with --lens-position 0 (infinity) for cameras aimed at a fixed area like a trail or doorway. Manual focus eliminates hunting entirely.
  • Use --autofocus-mode continuous with --autofocus-range normal to let the camera adjust on its own. This works well when IR illumination is strong enough to provide contrast, typically within 5 meters of the LEDs.

Scheduled captures without an agent:

For basic timed captures, a cron job works:

*/5 * * * * rpicam-still -o /home/pi/captures/$(date +\%Y\%m\%d_\%H\%M\%S).jpg --shutter 200000 --gain 12

This captures one image every 5 minutes. The limitation is that cron cannot react to events, evaluate image quality, or sync files to remote storage. That is where an AI agent adds real value.

Fastio features

Store and search your night vision captures from anywhere

50 GB free storage with automatic indexing. Upload footage from your Pi, search by content, and share specific captures through branded links. No credit card, no expiration.

Automating Captures with an OpenClaw Agent

OpenClaw turns a Raspberry Pi from a passive capture device into an autonomous monitoring agent. Instead of maintaining a stack of cron jobs and custom scripts, you describe what you want and the agent handles scheduling, decisions, and error recovery.

Installing OpenClaw:

On Raspberry Pi OS 64-bit, update the system and run the installer:

sudo apt update && sudo apt upgrade -y
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon

The installer pulls in Node.js and configures OpenClaw as a systemd service that starts on boot. The onboarding wizard walks through API key setup. OpenClaw requires a cloud LLM provider since the Pi does not have enough compute to run large language models locally. The official docs recommend anthropic/claude-sonnet-4-6 as the primary model, with minimum requirements of 1 GB RAM, 1 core, and 500 MB of free disk on a 64-bit OS.

What the agent automates:

Once OpenClaw is running as a daemon, you can instruct it to handle the entire capture workflow:

  • Run scheduled captures at intervals you specify, adjusting camera parameters based on time of day.
  • Monitor a PIR sensor GPIO pin and trigger captures only on motion.
  • Evaluate captured images and discard blank or overexposed frames before they fill the SD card.
  • Rename and organize files with timestamps and metadata.
  • Send alerts through messaging integrations (Telegram, WhatsApp, or email) when the agent detects something noteworthy.
  • Sync captured images to cloud storage for remote access and review.

Why an agent beats a shell script:

A shell script captures images on a fixed schedule. An agent makes decisions about what to do next. If the SD card fills up, the agent can prune the oldest low-priority images. If the IR LEDs fail and images come back black, the agent flags the issue and sends an alert instead of silently accumulating useless files. If you want to change the capture interval during certain hours or weather conditions, you describe the change to the agent rather than editing crontab.

OpenClaw persists its configuration and state in ~/.openclaw/, which survives reboots. The systemd service includes Restart=always with a 2-second restart delay, so the agent recovers from crashes without intervention. For remote or off-grid deployments where you cannot easily SSH in, this reliability is what separates an experiment from a working monitoring system.

AI agent reviewing and organizing captured data

Syncing Night Vision Footage to Cloud Storage

A night vision camera generates data. Without a plan for that data, you end up with a full SD card and no way to review footage remotely. The last step in the pipeline moves captured images off the Pi and into storage you can access from anywhere.

Local-first options:

  • Network share (NFS or Samba) to another machine on your LAN. No cloud dependency, but only accessible on your local network.
  • rsync to a remote server over SSH. Reliable and scriptable, but you maintain the server.
  • USB SSD as a local buffer. Extends capacity and reduces SD card wear, but footage stays on-site.

Cloud storage for remote access:

For monitoring where you need to check footage from your phone or share clips with others, cloud storage is the practical choice. Google Drive, Dropbox, and S3 all work with command-line upload tools on Pi OS.

Fast.io adds capabilities that matter for agent-driven camera workflows. When OpenClaw syncs images to a Fast.io workspace, those files are automatically indexed by Intelligence Mode. You can search captures by content rather than scrolling through timestamped filenames, ask questions about the archive through AI chat, and share specific captures through branded links without exposing the entire workspace. The free agent plan includes 50 GB of storage, 5,000 AI credits per month, and 5 workspaces, with no credit card required and no expiration.

Fast.io also exposes an MCP server that OpenClaw can connect to for uploading files, creating shares, and querying workspace contents. The agent uses the same tools a human would use through the web interface, so it can upload a batch of night captures, organize them into date-based folders, and generate a shareable link for review.

For the handoff from autonomous monitoring to human review, ownership transfer lets the agent build and organize a workspace, then transfer it to a person. The agent retains admin access for continued uploads while the new owner controls sharing and permissions. This pattern fits security monitoring well: the camera system runs autonomously, but a property manager reviews and distributes incident footage.

The full pipeline from IR sensor to searchable cloud archive runs on a $80 Pi, a $25 camera, and free cloud storage. Commercial systems offering similar functionality start at $300 for the hardware alone, plus monthly subscriptions for cloud features.

Frequently Asked Questions

How do I make a night vision camera with Raspberry Pi?

Connect a Camera Module 3 NoIR to your Pi's CSI port, wire 850nm IR LED boards to the 5V GPIO pins with a 220-ohm resistor, and capture images using rpicam-still with extended shutter times (100 to 200ms) and increased gain (8 to 12). The NoIR module lacks an infrared filter, so it picks up IR light that standard cameras block. The IR LEDs illuminate the scene invisibly, and the camera records what your eyes cannot see.

What is a NoIR camera module?

NoIR stands for "No Infrared filter." Standard Raspberry Pi cameras include a filter that blocks infrared wavelengths to produce accurate visible-light colors. The NoIR variant removes this filter, making the sensor responsive to near-infrared light between 750nm and 1000nm. This sensitivity to IR illumination from LED sources is the basis of night vision. The trade-off is that daytime images have a reddish color cast because the sensor picks up ambient IR from sunlight.

Can Raspberry Pi see in the dark?

Not on its own. The NoIR camera module is sensitive to infrared light, but it still needs a light source to form an image. In complete darkness, you add IR LEDs that emit at 850nm or 940nm. These LEDs are invisible to humans but produce light the NoIR sensor detects . With a 3W IR LED board, the camera captures clear images at 3 to 5 meters and usable outlines out to about 8 meters.

How far can a Raspberry Pi night vision camera see?

Range depends on your IR illumination, not the camera itself. A typical 3W dual-LED board provides clear imaging at 3 to 5 meters and fades to outlines by 8 meters. Adding more LED boards or a commercial IR floodlight extends range to 15 to 20 meters. High-power IR illuminators designed for security cameras can reach 30 to 40 meters, but they draw more power than the Pi's GPIO pins supply and need a separate power source.

Does OpenClaw work with Raspberry Pi cameras?

OpenClaw runs on Raspberry Pi 4 and Pi 5 as a systemd service. It executes system commands including libcamera tools for image capture, so it works alongside any camera that works with rpicam-still or rpicam-vid. The agent can schedule captures, evaluate image quality, filter unwanted frames, and sync files to cloud storage. OpenClaw requires a cloud LLM provider like Anthropic or OpenAI since the Pi lacks the compute for running large models locally.

Should I use 850nm or 940nm IR LEDs?

850nm LEDs are better for most builds. Silicon camera sensors are 30 to 40 percent more sensitive at 850nm than at 940nm, which means brighter images and longer effective range. The only downside is a faint red glow visible if you look directly at the LED at close range. 940nm LEDs are completely invisible but produce dimmer illumination, reducing your usable range. Choose 940nm only when total covertness is more important than image quality.

Related Resources

Fastio features

Store and search your night vision captures from anywhere

50 GB free storage with automatic indexing. Upload footage from your Pi, search by content, and share specific captures through branded links. No credit card, no expiration.