Cameras for Raspberry Pi

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

12MP IMX477 Motorized Focus Camera Module

Introduction

This Arducam IMX477 High Quality motorized focus camera module integrates a motor that could be controlled by software for a smarter focus, and you will no longer focus the camera by screwing the lens with your bare hands.
So how has software focus control made it more convenient? Here is an idea: Arducam provides you with an example program to control the focusing motor with keyboard keys, so you can focus the camera remotely with precision in an intuitive way. In another example powered by OpenCV, algorithms are used to control the motor and achieve autofocus.
Other than its motorized focus, it offers the same picture quality and camera controls as the Raspberry Pi High Quality camera.

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

Common Specs

Image sensor

Sensor ModelIMX477
Shutter TypeRolling Shutter
IR SensitivityVisible light
Active Pixels4056×3040
Resolution12 MP
Image Sensor Format1/2.3″
Pixel Size1.55μm×1.55μm
IMX477 camera board
IMX477 mechanical drawing

Lens

F/NO2.0
Focus TypeMotorized Focus
Lens Focal Length3.24mm
Field of View(FoV)87° (H)
Back Focal Length7.53mm
Lens DimentionΦ16×18mm

Connector & Cable

Camera ConnectorMIPI CSI-2 22-pin
Cable Length300mm (22-pin), 300mm(15-22pin)
Pin #NameTypeDescription
1GNDGroundPower Ground
2CAM_D0_NOutputPixel Data Lane0 Negative
3CAM_D0_POutputPixel Data Lane0 Positive
4GNDGroundPower Ground
5CAM_D1_NOutputPixel Data Lane1 Negative
6CAM_D1_POutputPixel Data Lane1Positive
7GNDGroundPower Ground
8CAM_CK_NOutputPixel Clock Output Form Sensor Negaitive
9CAM_CK_POutputPixel Clock Output Form Sensor Positive
10GNDGroundPower Ground
11CAM_D2_NOutputPixel Data Lane2 Negative
12CAM_D2_POutputPixel Data Lane2 Positive
13GNDGroundPower Ground
14CAM_D3_NOutputPixel Data Lane3 Negative
15CAM_D3_POutputPixel Data Lane3 Positive
16GNDGroundPower Ground
17POWER-ENInputPower Enable
18LED-ENI/OLED Enable/XCLK
19GNDGroundPower Ground
20SCLInputSCCB serial interface clock input
21SDAI/OSCCB serial interface data I/O
22VCCPower3.3V Power Supply

Quick Start Guide

Hardware Setup

B0272 04

For Bullseye System

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=imx477
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.

You can use python OpenCV to access the autofocus of the camera, please see the follows:

Demos Function

Arducam has release 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

C demo

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

FAQ/Troubleshooting

The use of the four Raspberry Pi camera applications

FAQ about raspberry pi camera module

Was this article helpful to you? Yes 4 No 5