How to use arducam_64mp & arducam_64mp FAQ

This post describes how to use arducam_64mp on raspberrypi.
This post is a technical finishing post, if you have any questions, please open a new topic :exclamation:

If you have a problem according to this post, please attach the information of the command below and photo of hardware connection (This is important.).

cat /proc/cpuinfo
cat /proc/meminfo
cat /etc/os-release
ls /dev/video*
dpkg -l | grep libcamera
cat /boot/config.txt
libcamera-still -t 1000 -n
dmesg

Install dependencies

Install the Driver

# Agree to restart after installation
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 64mp_pi_hawk_eye_kernel_driver

libcamera-dev and libcamera-apps Installation

./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps

Configuration

if you are under pi4:

Open /boot/config.txt, under [pi4], add the following line:
dtoverlay=vc4-kms-v3d,cma-512
Example:

[pi4]
arm_boost=1
dtoverlay=vc4-kms-v3d,cma-512

if you are under pi0-3 and other pi models:

Open /boot/config.txt, under [all], add the following line:
dtoverlay=vc4-kms-v3d,cma-512
Example:

[all]
arm_boost=1
dtoverlay=vc4-kms-v3d,cma-512

under pi0-3,you also need to open some configuration:

  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

Test

Check video device:


Run the libcamera example to see if the image can be capture normally.

Pi4:
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o 64mp.jpg
Other Pi models:

If you are using 64MP camera with older Pi models, pls set the resolution to 16MP (superpixel mode):
–width 4624 --height 3472

libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 --width 4624--height 3472 -o 64mp.jpg

AutoFocus

Pi 4:
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o pi_hawk_eye.jpg --autofocus
Other Pi models:

If you are using 64MP camera with older Pi models, pls set the resolution to 16MP (superpixel mode):
–width 4624 --height 3472

libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 --width 4624--height 3472 -o 64mp.jpg --autofocus

Manual focus

Download the source code

git clone https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver.git

Focus Control/Adjustment

# Press the Up/Down Arrow for focus adjustment, press “ctrl + c” to save, or “r” to reset
cd Arducam-Pivariety-V4L2-Driver/focus
python3 FocuserExample.py -d /dev/v4l-subdev1

Step Adjustments

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

Question 1 Can 64MP QuadCamera save 256MP pictures?

No, you can only save a 64MP image composed of 4 cameras.

The first reason is that due to the limitation of platform interface reception, it cannot support super-high-resolution images. If the image is 256MP, the width and height of the image will be very large. Although the platform cannot accept such a large resolution, we processed the image and scaled the image to 64mp without compromising the 256MP viewing angle.

The other reason is that, It is also to improve driver compatibility, so that the same set of drivers can be used regardless of whether a single camera or multiple cameras.

Question 2 How to switch cameras with a 64MP QuadCamera?

aa82b8ce15d49117b3d46d0b3c8a57cfa047d8de_2_690x380
Example:

# Set to single channel 0
i2cset -y 10 0x24 0x24 0x02
# Set to single channel 1
i2cset -y 10 0x24 0x24 0x12
# Set to single channel 2
i2cset -y 10 0x24 0x24 0x22
# Set to single channel 3
i2cset -y 10 0x24 0x24 0x32
# Set to double channel (single channel 0 and single channel 1)
i2cset -y 10 0x24 0x24 0x01
# Set to double channel (single channel 2 and single channel 3)
i2cset -y 10 0x24 0x24 0x11
# Set to four in one mode (Default)
i2cset -y 10 0x24 0x24 0x00

Question 3 How to check camera supported resolutions?

First method

libcamera-still --list-camera

Second method

Modify the config.txt file

sudo vi /boot/config.txt

Add ,media-controller=0 at the end as shown
1655257007463
After restarting, use the following command to view the resolution

v4l2-ctl --list-formats-ext

1655257114497

Question 4 64mp camera on octoprint?

We provide image files

Question 5 Can the buster use a 64MP camera?

We have no plans to support 64MP cameras on buster for now.

### Question 6 How to implement autofocus with libcamera_python on 64MP?(already fixed)
Ourl ibcamera_python library is not yet compatible with libcamera_dev 0.0.7,we will expedite the process of compatibility,you can try to install an stablize version of libcamera_dev.

bulleye-armhf:

cd ~
wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/libcamera-v0.0.5/libcamera-dev-0.0.6-bullseye-armhf.deb
sudo apt install -y ./libcamera-dev-0.0.6-bullseye-armhf.deb

bulleye-arm64:

cd ~
wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/libcamera-v0.0.5/libcamera-apps-0.0.6-bullseye-arm64.deb
sudo apt install -y ./libcamera-apps-0.0.6-bullseye-arm64.deb

To use libcamera_python in detail, you should follow the link below:
How to use code to access libcamera(C++/Python)

Question 7 How to troubleshoot if the camera preview is completely black?

Follow my steps below to troubleshoot. If it’s not resolved, you can open a topic and ask me.

  1. Check your frame rate, if it is 0
  2. Is the green light always on when you run the camera?
  3. Change the cable from the raspberry pi interface to the mipi tx.

If the preview is still pure black after the replacement, please tell me the results of the above 3 steps.

Question 8 Why can’t the pi4 still save the maximum resolution after allocating 512 memory?

one of the possibilities:

If you have other cases of the same problem and solved it, please open a topic and tell me your experience.

Question 9 Can we extend the ribbon cable for the 64mp arducam 64mp or is there a limit?

Since the signal transmission speed is very fast, the signal will be attenuated during the transmission process. If the cable is too long, the final effect will be bad.

We recommend using cables within 15 cm.

Question 10 Pics speed?

The four camera clocks are fully synchronized.

Question11 Failed to allocate buffers on PiZero?

Question 12 64MP with RPI 4b, Rev 1.4, failed to allocate capture buffers

For 64MP cameras, there may be memory issues with the maximum resolution. We can’t reproduce it for now, but there are still some suggestions to help you with a simple troubleshooting:

  1. cat /proc/meminfo CmaTotal should be around 500000kB
  2. Try the command several times, because sometimes it doesn’t work well
  3. Reduce the resolution to ensure that the camera is OK

If you still have problems, send me the following information

cat /proc/cpuinfo
cat /etc/os-release
cat /boot/config.txt
dmesg

There are also pictures of the commands you executed and the hardware connections, so that we can better help you.
If you ever had a similar problem and found a solution, please also @me share it, it will help more people.

Some solutions, hope to help you: