Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. 16MP IMX519 Camera Modules
  5. How To Use Arducam 16MP Camera On Rapberry Pi

How To Use Arducam 16MP Camera On Rapberry Pi

Software operation

preparation

Note

Please make sure your Raspberry Pi OS is downloaded from official sources:
– Raspberry Pi Bullseye >

How to install the driver

You can use our auto-install script to install the driver for arducam 64MP camera:

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
./install_pivariety_pkgs.sh -p imx519_kernel_driver

After installing the driver, you will see a message telling you the driver has been installed correctly.

  • Detect the driver
dmesg | grep imx519

If you can see the arducam 64mp has been found, then the driver installed successfully.

  • Detect the camera
ls /dev/video0

If you can see the /dev/video0, then the camera has been detected.

Configure the buffer

For Pi 4:

sudo nano /boot/config.txt
#find the line [pi4]
#manually add dtoverlay=vc4-kms-v3d,cma-256 under it, like this:
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
dtoverlay=vc4-kms-v3d,cma-256

For other Pi:

sudo nano /boot/config.txt
#find the line [all]
#manually add dtoverlay=vc4-kms-v3d,cma-256 under it, like this:
[all]
# Run as fast as firmware / board allows
arm_boost=1
dtoverlay=vc4-kms-v3d,cma-256

Reboot your Pi

For Raspbian Bullseye users running on Pi Zero ~ Pi 3, please execute the follows:

1. Open a terminal
2. Run sudo raspi-config
3. Navigate to Advanced Options
4. Enable Glamor graphic acceleration
5. Go back to Advanced Options
6. Navigate to GL Driver
7. Select GL (Full KMS)
8. Reboot your Pi

For more details, please refer to the official forum guide on how to configure the camera module >>

For Raspberry Pi Compute Module 3/4

You need to install the latest Raspberry Pi system (after 2022/01/28), and do not execute rpi-update
After installing the system and drivers (follow the above instructions), add the following information to /boot/config.txt:
[cm4]
dtoverlay=imx519
dtoverlay=imx519,cam0

Then reboot.

How to install libcamera

You need to install our libcamera dev to use some additional functions such as autofocus, continue autofocus, and so on.

wget -O  https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps

Access the camera with libcamera

Preview:

libcamera-still -t 0

List all cameras:

libcamera-still --list-cameras

Save a jpg file after 5s preview:

libcamera-still -t 5000 -o 16mp.jpg

Autofocus(example as 2328*1748 resolution):

libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --autofocus

Continue autofocus(example as  2328*1748  resolution):

libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --continue-autofocus

Manual focus adjustment:

You need to open the camera with the command using the preview above, and then use this command.

Press the Up/Down Arrow for focus adjustment, press “ctrl + c” to save, or “r” to reset.

git clone https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver.git
cd Arducam-Pivariety-V4L2-Driver/focus
python3 FocuserExample.py -d /dev/v4l-subdev1

While you are trying manual focus control, you can use –focus-step [number] to configure
how many steps the motor in the lens should move when the Up/Down key is pressed.
By default, it’s set to 50, and you can change it to any value between 1 ~ 1023.

python3 FocuserExample.py -d /dev/v4l-subdev1 --focus-step 10

For more options of using libcamera, please refer to:

libcamera User Guide

How to use Gstreamer, OpenCV to access the camera

You can refer to the following link for more options:

How to access and program the pivariety camera using command line python-opencv and gstreamer

Troubleshooting

Please refer to https://www.arducam.com/docs/cameras-for-raspberry-pi/raspberry-pi-libcamera-guide/16mp-autofocus-camera-common-issues-fixes/

Note

If you encounter any problems, please contact [email protected] for more help.

Was this article helpful to you? Yes No 1