Using the Camera Module

The Zero W has a CSI camera connector, which opens the door to photo and video projects - but there's a hardware gotcha specific to the Zero family that trips up a lot of beginners, covered first below.

The Cable Gotcha

The Zero W's CSI camera connector is the smaller/mini-size connector used across the whole Zero family - it is physically different from the standard-size connector on full-size Raspberry Pi boards. A standard Raspberry Pi camera ribbon cable will not fit it. You need the specific "Raspberry Pi Zero camera cable" adapter, sold separately, to connect a standard camera module to a Zero W.

Connecting the Camera

With the correct Zero camera cable in hand, connecting it is a matter of careful, gentle handling:

  1. Power off the Zero W before connecting or disconnecting the camera cable.
  2. Gently lift the plastic clip on the camera connector on the board - it flips up, it doesn't need to be forced or pried off.
  3. Insert the ribbon cable with the contacts facing the correct way, matching the orientation shown on the board's silkscreen markings next to the connector.
  4. Push the plastic clip back down to lock the ribbon cable firmly in place.
  5. Double check the cable is seated evenly on both sides before powering back on - a cable that's in at an angle or only partially seated is a very common cause of "camera not detected" errors.

On current versions of Raspberry Pi OS, the camera is generally auto-detected without needing any extra configuration. If your particular OS version or setup requires enabling the camera interface explicitly, that option lives in the Raspberry Pi OS configuration tool - check there if the camera isn't being detected after connecting it correctly.

This page's code and terminal commands are a preview, not something you can run right on this website - this server runs PHP, not the Zero W's own operating system.

Taking a Photo and Recording Video

On current Raspberry Pi OS (Bookworm and later), the correct, actively-maintained commands are rpicam-still for photos and rpicam-vid for video. Take a test photo with:

rpicam-still -o test.jpg

And record a 10-second test video with:

rpicam-vid -o test.h264 -t 10000

(the -t value is in milliseconds, so 10000 means 10 seconds). Both commands save their output to the current directory by default - change the filename after -o to control where the file goes.

The older command names libcamera-still and libcamera-vid still work as symbolic-link aliases for backward compatibility, but rpicam-* is the name to actually use going forward. The original raspistill / raspivid commands, from the old MMAL-based camera stack, are deprecated and have been removed on current Raspberry Pi OS (Bookworm) - don't rely on them in new projects.
Next steps: See real project ideas that put the camera, GPIO, and Wi-Fi together in Common Projects & Use Cases.