Skip to content

oookosmos/imx519-af-tuning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Arducam IMX519 B0371 Autofocus on Raspberry Pi (Bookworm, kernel ≥ 6.12)

This repo contains a working tuning file for Arducam IMX519 AF (board rev B0371) that enables autofocus on Raspberry Pi OS Bookworm (arm64) with newer kernels (≥ 6.12.x) without downgrading the kernel or installing custom Arducam .deb stacks.

Quick Start

  1. Copy the provided tuning file:
sudo mkdir -p /usr/share/libcamera/ipa/rpi/vc4
sudo cp tuning/imx519.json /usr/share/libcamera/ipa/rpi/vc4/imx519.json
# Optionally for pisp:
sudo mkdir -p /usr/share/libcamera/ipa/rpi/pisp
sudo cp /usr/share/libcamera/ipa/rpi/vc4/imx519.json /usr/share/libcamera/ipa/rpi/pisp/imx519.json
  1. Test autofocus:
rpicam-hello -t 4000   --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json   --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal
  1. Low-latency RTP stream to Mission Planner (UDP 5600):
rpicam-vid -t 0 --width 1280 --height 720 --framerate 30   --codec h264 --inline --intra 15 --nopreview --bitrate 2500000   --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json   --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal   --shutter 33333 --gain 8 --metering centre --ev 1 --denoise auto   -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1   ! rtph264pay pt=96 config-interval=1 mtu=1200   ! udpsink host=10.0.0.3 port=5600 sync=false async=false

Mission Planner → Setup → Optional Hardware → UDP Video → set port 5600.

Optional systemd unit

systemd/wg-video.service:

[Unit]
Description=Low-latency H264 stream with AF
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=pi
Restart=always
RestartSec=2
ExecStart=/bin/bash -lc 'rpicam-vid -t 0 --width 1280 --height 720 --framerate 30   --codec h264 --inline --intra 15 --nopreview --bitrate 2500000   --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json   --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal   --shutter 33333 --gain 8 --metering centre --ev 1 --denoise auto   -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1   ! rtph264pay pt=96 config-interval=1 mtu=1200   ! udpsink host=10.0.0.3 port=5600 sync=false async=false'

[Install]
WantedBy=multi-user.target

Enable:

sudo systemctl daemon-reload
sudo systemctl enable wg-video
sudo systemctl start wg-video

Why this works

The IMX519 sensor and AK7375 lens actuator are detected by the kernel (V4L2 subdevs), but recent libcamera builds might miss an AF-capable tuning file. Using a known-good imx519.json (CDAF/PDAF enabled) restores autofocus without kernel downgrades.

Source JSON from Arducam libcamera branch:
https://github.com/ArduCAM/libcamera/blob/arducam/src/ipa/rpi/vc4/data/imx519.json

Credits

  • Arducam
  • libcamera
  • Raspberry Pi community

About

Автофокус Arducam IMX519 B0371 на Raspberry Pi (Bookworm, ядро ≥ 6.12)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors