Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Native Raspberry Pi Cameras
  5. 8MP IMX219 Motorized Focus Camera Module

8MP IMX219 Motorized Focus Camera Module

Introduction

Arducam 8MP IMX219 Motorized Focus Camera Modules are designed for you to control the focus via software, so you can see closer and see where you want to see.

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

Models in this Series

There are four cameras in this series. The main differences between them are the field of view and IR sensitivity. They are the same in terms of software operation.

B0190
B0182
B0180
B0122
SKUField of ViewIR Sensitivity
B019077.6°D x 65°H x 51°VNoIR
B018277.6°D x 65°H x 51°VVisible Light
B0180175°D x 145°H x 77°VVisible Light
B012254°H x 41°VVisible Light
Too short camera cable?

You may need Arducam 30cm Sensor Extension Cable which extends the small camera module with a much longer distance and fit into the space-constrained environment.

Common Specs

General Specifications

Sensor ModelIMX219
Shutter TypeRolling Shutter
Active Pixels3280 (H) × 2464 (V)
Resolution8MP
Image Sensor FormatType 1/4″
Pixel Size1.12μm×1.12μm
CSI-2 Data Output2-lane mode
Data FormatRaw Bayer 10bit
IMX219 block diagram
IMX219 Block Diagram

IMX219 Full Datasheet

Refer here:

https://www.arducam.com/downloads/modules/RaspberryPi_camera/IMX219DS.PDF

Quick Start Guide

Hardware Setup​​​​​

Ensure your Raspberry Pi is turned off.

video tutorial
1.Locate the camera port (CSI)

For Raspberry Pi Model A & B, it’s between the HDMI and audio port of the Raspberry Pi board.

SPRK default preset name web 1920 – 1
2.Gently pull up on the edges of the connector’s plastic clip and avoid pulling it off
3.Insert the ribbon cable

Make sure the metal contacts are facing the HDMI connectors. Do not bend the flex cable, and make sure it’s firmly inserted.

4.Push the plastic clip down

Do it while holding the flex cable still, until the connector’s clip is back in place.

Software Setup​​

Note:

If you are running the latest version of Raspberry Pi OS. (January 28th,2022 or later releases, Debian version:11(Bullseye)). You need to update the config file and use libcamera apps.

  • For Raspberry Bullseye users running on Pi 4, please do the following:
sudo nano /boot/config.txt 
Find the line: camera_auto_detect=1, update it to:
camera_auto_detect=0
dtoverlay=imx219
Save and reboot.
  • For Bullseye users running on Pi 0 ~ 3, please also: 
Open a terminal 
Run sudo raspi-config
Navigate to Advanced Options 
Enable Glamor graphic acceleration 
Reboot your Pi

If you encounter the display issues, please also execute the following steps:

Open a terminal
Run sudo raspi-config
Navigate to Advanced Options
Navigate to GL Driver
Select GL (Full KMS)
Reboot your Pi
  • For Raspberry Pi Compute Module 3/4

The latest software only supports one camera at this time, CM4 uses CAM1 by default.

For the autofocus of the camera, you can use python OpenCV as follows:

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 auto focus, click the ‘Q’ button to exit and save the picture
python3 AutofocusTest.py -i 10

FAQ/Troubleshooting

The use of the four Raspberry Pi camera applications

FAQ about raspberry pi camera module

Was this article helpful to you? Yes 1 No 1