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


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


Demos Function

Arducam has released three demos:,, and

  • 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

Enable i2c

cd /home/pi/RaspberryPi/Motorized_Focus_Camera
sudo chmod +x

Press Y to reboot

  • 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” in the terminal.

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


Python demo

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



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

C demo

cd RaspberryPi/Motorized_Focus_Camera/C/
make install

Demo Video

Mechanical Dimension

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