Skip to main content

OV5647

This guide explains how to safely connect a camera, configure it for use, verify that it is detected, and preview or capture images.

Connect the Camera

danger

Make sure to follow these rules:

  • Power off the board and disconnect its power supply before connecting or removing a camera.
  • Connect the camera as shown in the images below.

Otherwise, you may damage either the board or the camera.

  1. Release the latch on the board's camera connector.
  2. Connect the FPC to the appropriate connector, as shown in the image.
  3. Keep the ribbon straight and fully seated, then close the latch evenly.
  4. Connect the other end to the camera module in the same way.
Camera connected to the board FPC connected to the appropriate board connector Ribbon cable connected to the camera module

Detect the Camera

On the host, enter the target shell:

adb shell

In the target shell, discover the camera device nodes:

PREVIEW_DEV=$(
for node in /sys/class/video4linux/video*; do
[ "$(cat "$node/name")" = "vvcam-video.0.0" ] &&
echo "/dev/${node##*/}" &&
break
done)

Keep this target shell open for the examples below so that the discovered variables remain available.

Use the Camera

The following examples run on the target unless a step is explicitly marked as a host command.

Live Preview

With an external display connected, run the following command in the target shell:

WAYLAND_SOCKET=$(find /run/user -mindepth 2 -maxdepth 2 -type s -name 'wayland-*' -print -quit)

export XDG_RUNTIME_DIR="${WAYLAND_SOCKET%/*}"
export WAYLAND_DISPLAY="${WAYLAND_SOCKET##*/}"

gst-launch-1.0 -v v4l2src device="$PREVIEW_DEV" \
! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 \
! videoconvert \
! waylandsink

Press Ctrl+C in the shell to stop the preview.

Capture an Image without a Display

In the target shell, capture one JPEG:

gst-launch-1.0 -e v4l2src device="$PREVIEW_DEV" num-buffers=31 \
! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 \
! videoconvert \
! jpegenc \
! multifilesink location=/tmp/capture.jpg

Exit the target shell:

exit

In the host terminal, enter the directory where you want to save the image and download it:

adb pull /tmp/capture.jpg ./capture.jpg

Open capture.jpg on the host to view the captured image.