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
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.
- Release the latch on the board's camera connector.
- Connect the FPC to the appropriate connector, as shown in the image.
- Keep the ribbon straight and fully seated, then close the latch evenly.
- Connect the other end to the camera module in the same way.
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.