Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Motorized Focus Camera

Motorized Focus Camera

To learn more about autofocus with Raspberry Pi camera modules, we recommend you read Raspberry Pi Camera Autofocus: The Complete Guide.

  • The standard pi camera is fixed focus lens, some of them are glued which can not be adjust by users, and some of them are not glued which can be adjust the lens focus manually. But in certian circumstance, you want to programmably control the focus distance remotely where the device can not be reached. The ArduCAM team now designed motorized control focus 5MP and 8MP camera module for Raspberry Pi series boards to address this problem.
  • High-Definition video camera for Raspberry Pi Model A/B/B+ and Raspberry Pi 2 Pi 3B, Pi 3B+ and Pi Zero
  • 5MP OV5647 or 8MP IMX219 sensor with motorized focus lens
    Integral IR filter
  • Angle of View: 54 x 41 degrees
  • Field of View: 2.0 x 1.33 m at 2 m
  • Full-frame SLR lens equivalent: 35 mm
  • Focus distance: 4 cm to infinity
  • Size: 25 x 24 mm
  • 15 cm flat ribbon cable to 15-pin MIPI Camera Serial Interface (CSI) connector

Hardware Setup

Software User Guide

Note

The following demo is adapted to the latest Raspberry Pi OS. Please make sure you are using the latest official Raspberry Pi system.

Preparation

Demos Function

Arducam has released three demos: Motorized_Focus_Camera_Preview.py, Motorized_Focus_Camera_Snapshot.py, and Autofocus.py

  • Before running this demo, you have to install Python Dependency libraries.
sudo apt-get upgrade
sudo apt install -y python3-kms++ python3-libcamera
sudo apt install -y python3-pyqt5 python3-prctl libatlas-base-dev ffmpeg
sudo pip3 install numpy --upgrade
sudo pip3 install picamera2 opencv-python  

Download library

git clone https://github.com/ArduCAM/RaspberryPi.git

Enable i2c

cd /home/pi/RaspberryPi/Motorized_Focus_Camera
sudo chmod +x enable_i2c_vc.sh
./enable_i2c_vc.sh 

Press Y to reboot

Motorized_Focus_Camera_Preview.py

  • This demo supports focusing in preview mode, You can see the focus visually
  • Single focus by keyboard up and down
  • Run this demo is very easy , just input the “python3 Motorized_Focus_Camera_Preview.py” in the terminal.

AutofocusTest.py

  • This demo supports auto focusing in preview mode, You can see the focus visually
  • Run the demo by inputing the “python3 AutofocusTest.py” in the terminal.

Usage

Python demo

cd RaspberryPi/Motorized_Focus_Camera/python/
  • FocuserExample.py Example of manual focus
python FocuserExample.py -i 10

Screenshot:

screenshot.png


  • AutofocusTest.py Example of autofocus
    Click the ‘F’ button to achieve autofocus, click the ‘Q’ button to exit and save the picture
python3 AutofocusTest.py -i 10

C demo

cd RaspberryPi/Motorized_Focus_Camera/C/
make install
make 
./manualFocus

Demo Video

Mechanical Dimension

UC 420B0176
Was this article helpful to you? Yes 6 No 21