Skip to content

For 5MP OV5647 Motorized Focus Camera

Product


Product Image SKU Pin/Connect Type Sensor Resolution Features Lens Type Field of View(HxV) Focus Type IR Sensitivity
B0176 15pin/Bottom OV5647 5MP Mini Size Stock Lens 54°(H) × 44°(V) Autofucs 650nm IR-cut filter
B0176R 3D Printer

Hardware


autofocus_hardaware_connection

Software


Enable the Focus Driver


Please run the command 'sudo nano /boot/config.txt' and add the content below under [all] in the config file to configure the camera and motor driver.

sudo nano /boot/config.txt
# add following content under [all]
dtoverlay=ov5647,vcm

Then reboot your Pi to take it effective.

sudo reboot

Install libcamera from Arducam


  • Step 1. Download the bash scripts
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
  • Step 2. Install libcamera
./install_pivariety_pkgs.sh -p libcamera_dev
  • Step 3. Install libcamera-apps
./install_pivariety_pkgs.sh -p libcamera_apps

Focus Control


libcamera-still -t 0 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Continuous Autofocus
libcamera-still -t 0 --autofocus-mode continuous --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Single Autofocus
libcamera-still -t 0 --autofocus-mode auto --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Manual Focus
libcamera-still -t 0 --autofocus-mode manual --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
# Use keyboard to control focus
# "f" trigger one-shot autofocus
# "a" add the lens position, "d" decrease the lens position, the minimum unit of step adjustment is 1
libcamera-still -t 0 --autofocus-mode manual -k --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Adjust Lens Position
libcamera-still -t 0 --autofocus-mode manual --lens-position 5 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Autofocus Before Capture images
libcamera-still -t 0 --autofocus-on-capture --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
  • Set Focus Range
# Normal
libcamera-still -t 0 --autofocus-range normal --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json
# Close Focus
libcamera-still -t 0 --autofocus-range macro --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov5647_af.json