Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Synchronized Stereo Camera HAT
  5. Camarray – Arducam 1MP (Monochrome) Quadrascopic Camera Bundle Kit

Camarray – Arducam 1MP (Monochrome) Quadrascopic Camera Bundle Kit

Introduction

This Arducam quadrascopic camera bundle incorporates four 1MP OV9281 global shutter cameras, and the cutting-edge MIPI stereo camera breakthrough from Arducam – The Arducam Camarray HAT. At present, this product supports ISP image processing, and the OBISP driver can be used without an external ISP. As the upgraded version of Arducam Synched Stereo Camera HAT, the Camarray further pushes the multi-camera limits and doubles the interfacing capabilities to allow 4 synchronized MIPI camera modules to be interfaced to a single MIPI CSI-2 slot on prevailing single-board computers like Raspberry Pi, Jetson Nano, and Jetson Xavier NX.

Also, as the Camarray HAT releases, Arducam starts to support a variable baseline for stereo camera applications with some modified Arducam camera modules, such as those OV9281 ones included in this bundle. Since no shared camera board or clock-sharing soldering is required for the image sensors, you can kick off your prototyping for stereo camera applications and then decide the optimal baseline. Arducam also accepts subsequent customizations for your stereo camera applications.

What is Camarray

Camarray is a series of embedded stereo cameras and multiple camera solutions from Arducam. Upgraded from Arducam Sync Stereo Camera HAT, the Camarry can disguise up to 4 synched camera modules as a single camera slot connection to embedded systems like the Raspberry Pi, Jetson nano, and Xavier NX. With Arducam camarray, your camera connectivities are no longer limited to the camera connectors on the motherboard or the carrier board. Along with Arducam-provided camera drivers, more flexibility can be added to your multi-camera applications.

NOTE

1.The Camarray HAT does not support digital pan in half resolution combine and programmable pan speed control.
2.The Camarray HAT is not a crop and a half (halving the horizontal resolution of each camera and halving the field of view) but a compressed half (halving the horizontal resolution of each camera but leaving the field of view unchanged), so it does not need to support scan mode.

Common Specs

Image Sensor

Sensor ModelOV9281
Shutter TypeGlobal Shutter
Active Pixels1280*4×800
Resolution1MP*4
Image Sensor FormatType 1/4″
Pixel Size3μm×3μm
Color Filter ArrayNone(Monochrome)
9281block diagam
OV9281 Block Diagram

Lens Assembly

InterchangeabilityYES
F/NO2.8
Focus TypeManual Focus
Focusing Range30cm to infinity (when focused to infinity)
Effective Focal Length(EFL)2.8 mm
Field of View(FoV)70° Horizontal
Lens MountM12 Lens
IR SensitivityNo IR filter (sensitive to IR light)
2311stero camera lens 3d

Board

HAT Size65×56 mm
Camera Board Size40×40 mm
UC 512.Rev .C DIM 01
HAT Mechanical Drawing
Mechanical Drawing ov9281

OV9281 Camera Board Mechanical Drawing

Pin No.Pin NameTypeDescription
13V3Power3.3V power supply
2FSINInputFrame Sync Input
3STBOutputLED Strobe Output
4GNDGroundGround
53V3Power3.3V power supply
6SDAI/OSCCB serial interface data I/O
7SCLInputSCCB serial interface clock input
8GNDGroundGround

Connector & Cable

Connector InterfaceMIPI CSI-2 15-pin 2-lane
Ribbon Cable Length150mm (22-pin), 300mm(15-22pin), 73mm(15-22pin)
Pin #NameDescription
1GNDGround
2CAM_D0_NMIPI Data Lane 0 Negative
3CAM_D0_PMIPI Data Lane 0 Positive
4GNDGround
5CAM_D1_NMIPI Data Lane 1 Negative
6CAM_D1_PMIPI Data Lane 1 Positive
7GNDGround
8CAM_CK_NMIPI Clock Lane Negative
9CAM_CK_PMIPI Clock Lane Positive
10GNDGround
11CAM_IO0Power Enable
12CAM_IO1LED Indicator
13CAM_SCLI2C SCL
14CAM_SDAI2C SDA
15CAM_3V33.3V Power Input

Driver Performance (With Official V4L2 Driver)

Video FormatGERY(8-bit)/Y10P(10-bit)
Output Interface2-lane MIPI serial output
Output Formats8/10-bit BW RAW
Frame Rates[email protected]*4 × 800(on RPi)
[email protected]*4 × 800(on Jetson)

Quick Start Guide​​

The driver only supports the following kernel version:
  • 4.19.113-v7+
  • 4.19.118
  • 4.19.118-v7+
  • 4.19.118-v7l+
  • 5.4.42-v7+
  • 5.4.51+
  • 5.4.51-v7+
  • 5.4.51-v7l+

Hardware Setup​​​​

B0267 04
B0267

Note:

1. Perform any hardware operations on the HAT only when the power is off.

2. Make sure the camera boards keep away from the GPIO pins of Raspberry Pi / Jetson boards to avoid any short issues.

Driver Installation

1.Driver note

For the new version of the camera, we recommend this driver for Raspberry Pi:

Pivariety V4L2 driver

Raspberry Pi is transitioning from a legacy camera software stack based on proprietary Broadcom GPU code to an open-source stack based on libcamera. Raspberry Pi OS images from Bullseye onwards will contain only the libcamera-based stack. In order to connect the new system and libcamera, we developed the Pivariety V4L2 driver.

Pivariety V4L2 driver supports using libcamera and arducamstill to fetch images. Therefore, for some customers who still want to use the Buster legacy system, we recommend using arducamstill, no need to install OBISP driver.

If you encounter any problem when using the camera, please directly contact [email protected] for help.

Note:

The camera you are using may be the previous version, which looks the same as the new version. If you encounter any problem when you are referring to the following steps, please follow the previous version driver.

2.Install the Driver

Note

The Pivariety V4L2 kernel driver supports the latest version of Raspberry Pi OS. (January 28th,2022 or later releases, Debian version:11(Bullseye)).
Please make sure your Raspberry Pi OS is downloaded from these two official sources:
Raspberry Pi Buster >
Raspberry Pi Bullseye >
If you want to compile the kernel driver by yourself, please follow the chapter on How to build Raspberry Pi Kernel Driver-Pivariety Camera.

2.1. 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 kernel_driver
You can also follow the step to install the driver by yourself
  • Download V4L2 Pivariety driver
wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/Arducam_pivariety_v4l2_v1.0/arducam_pivariety_v4l2.tar.gz
5a5a7620968f410082d21874b64d78583368 1
  • 1.2 Decompress V4L2 Pivariety driver
tar -zxvf arducam_pivariety_v4l2.tar.gz Release/
3d16dd498f56436ebbdb2705d3a6619d3368 2
  • 1.3 Install V4L2 Pivariety driver
cd Release/
./install_driver.sh
948691927c534745b103d84943daba3e3368 1

After pressing y to reboot, driver installation is complete.

Note

Please make sure the camera is connected correctly before rebooting, otherwise, you will not detect the camera.
If you want to upgrade the version of Raspberry Pi(for example you want to upgrade your pi3 or Pi3B+ to pi4 ), please reinstall the driver. Each version of Raspberry Pi when you use needs to be installed V4L2 Pivariety driver once.

2.2. V4L2 Pivariety driver detection

Note

You can not use the official code(vcgencmd get_camera) to detect the camera! Please follow our DOC to detect the camera!

2.2.1 View V4L2 Pivariety driver status

dmesg | grep arducam

The driver is installed successfully if output arducam-pivariety and the camera has been detected if output firmware version.

2 1

Note

[ 31.835619] arducam_vddl: disabling
[ 31.835638] arducam_vdig: disabling
[ 31.835657] arducam_vana: disabling
does not mean your driver installation is failing, please skip it.

By the way, it means that the camera is not detected if the probe failed is displayed, please check the camera connection.
3 1

You can see the following video nodes When everything is normal.

ls /dev/video* -l
4 2

2.2.2 View device node information

v4l2-ctl --list-formats-ext
5 2

2.3. Failed to Install V4L2 Pivariety Driver

3 3

Please check the kernel version, we only provide the driver for the latest official kernel version image when this Pivariety camera is released.

Note

If you want to compile the kernel driver by yourself, please please follow the chapter on How to build Raspberry Pi Kernel Driver-Pivariety Camera.
If you want to switch to the native camera please go here to uninstall the V4L2 Pivariety Driver.

2.4. What is the next?

If you encounter any trouble, please following the DOC to troubleshooting.

3. How to build Raspberry Pi Kernel Driver

We only provide the driver for the latest official kernel version image when the Pivariety camera is released. Please check the kernel version if the driver installation fails. You can choose to compile the kernel yourself if the kernel version used is not provided by us.

There are two compilation methods:

3.1. The first way-Build from the kernel source

Please refer to the official documentation to compile the kernel.

NOTE

The instructions are divided into native builds and cross-compilation.

After obtaining the Linux source code, add the Arducam driver and device tree code through the apply patch.

git clone https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver.git
cd <path>/linux
patch -p1 -i <path>/Arducam-Pivariety-V4L2-Driver/patchs/arducam_driver.patch

At this point, your kernel driver building is complete! You can go to the chapter on the next.

3.2. The second way-Build from the kernel headers

3.2.1 Download the kernel source code

cd ~
sudo apt update && sudo apt install git bc bison flex libssl-dev
sudo wget https://raw.githubusercontent.com/RPi-Distro/rpi-source/master/rpi-source -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-update
mkdir $(uname -r)
rpi-source -d $(uname -r)

3.2.2 Compile the driver and device tree

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

# compile dtbo
patch -p1 -d /lib/modules/$(uname -r)/build -i $(pwd)/../patchs/arducam_device_tree.patch
make -C /lib/modules/$(uname -r)/build  dtbs
sudo cp /lib/modules/$(uname -r)/build/arch/arm/boot/dts/overlays/arducam.dtbo /boot/overlays/arducam.dtbo

# manully add dtoverlay=arducam in /boot/config.txt
# manully add dtparam=i2c_vc=on in /boot/config.txt

# compile arducam.ko
make && sudo make install
sudo depmod
sudo modprobe arducam

At this point, your kernel driver building is complete!

What is the next?

If you encounter any trouble, please follow the DOC to troubleshooting.

How to access the camera by using command line, Python,OpenCV, and GStreamer

1. libcamera-dev and libcamera-apps 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 libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps
You can also be following the step to install the driver by yourself

1.1. Use pre-compiled binaries

Note: If you don’t want to compile, you can choose to use our pre-compiled deb package.

1.1.1 Install libcamera

wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/v0.0.2/libcamera-dev.deb -O libcamera-dev.deb
sudo apt install ./libcamera-dev.deb

1.1.2 Install libcamera-apps

wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/libcamera-apps-v0.0.2/libcamera-apps.deb -O libcamera-apps.deb
sudo apt install ./libcamera-apps.deb

If you use the pre-compiled package please go to the chapter of Select the correct graphics driver.

1.2. Build from the source code

1.2.1 Install dependency

If you need to use the plugin GStreamer, please install the GStreamer dependency before compiling libcamera.

sudo apt update
sudo apt install -y libboost-dev libgnutls28-dev openssl \
	libtiff5-dev qtbase5-dev libqt5core5a libqt5gui5 \
	libqt5widgets5 meson libegl1-mesa-dev cmake \
	libboost-program-options-dev libdrm-dev \
	libexif-dev libegl1-mesa-dev
sudo pip3 install pyyaml ply
sudo pip3 install --upgrade meson

Optional dependencies (for GStreamer plugin).

sudo apt update
sudo apt install -y libgstreamer1.0-dev \
	libgstreamer-plugins-base1.0-dev

1.2.2 Download and compile libcamera

Please note that Pivariety can’t be supported by Raspistill, you need to download libcamera to make it work. You can follow the installation steps listed in the code library.

cd ~
git clone git://linuxtv.org/libcamera.git
cd libcamera
meson build
cd build
meson configure -Dpipelines=raspberrypi -Dtest=false
cd ..
ninja -C build

On some lower memory platforms (e.g. 1GB) there have been cases of ninja exhausting all the system memory and aborting (as it will attempt to use all the CPU cores). If this happens, please try replacing ninja -C build by ninja -C build -j 2 this will restrict Ninja to only 2 cores.

After downloading and compiling libcamera, you need to replace the code ipa_rpi.so with.

cd ~
wget https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/ipa-v0.01/ipa_rpi.tar.xz
tar xvf ipa_rpi.tar.xz
cp ipa_rpi.so libcamera/build/src/ipa/raspberrypi/
cd libcamera && sudo ninja -C build install

1.2.3 Download and compile libepoxy

libcamera-apps requires libepoxy to be installed.

cd
git clone https://github.com/anholt/libepoxy.git
cd libepoxy
mkdir _build
cd _build
meson
ninja
sudo ninja install

1.2.4 Download and compile libcamera-apps

cd
git clone https://github.com/raspberrypi/libcamera-apps.git
cd libcamera-apps
mkdir build
cd build
cmake ..
make -j4
sudo make install

To check everything is working correctly, type ./libcamera-hello – you should see a preview window displayed for about 5 seconds.

Note for Pi 3 devices

As we saw previously, 1GB devices may need make -j2 instead of make -j4.Also, Pi 3s do not by default use the correct GL driver, so please ensure you have dtoverlay=vc4-fkms-v3d in the [all] (not in the [pi4]) section of your /boot/config.txt file.

1.2.5 Select the correct graphics driver

There are 3 different graphics drivers available on the Raspberry Pi: firmware, FKMS, and KMS.

The firmware graphics driver cannot be used with libcamera-apps. The Raspberry Pi 4 and 400 use the newer FKMS graphics driver by default: this is compatible with libcamera-apps. 

For all other models of Raspberry Pi, you must select the FKMS driver by adding the following line to the /boot/config.txt file(Note: Please add it under the [all] tag ).

[all]
dtoverlay=vc4-fkms-v3d

NOTE: If you want to modify the file of /boot/config.txt, you need to reboot your device after modifying.

Tips: How to add the /boot/config.txt under the [all] tag? 

a. open the file
sudo nano /boot/config.txt #Use the mouse to draw to the bottom #Add dtoverlay=vc4-fkms-v3d under the table of [all]
b. Press the ctrl+o after editing, and press enter to save your file
c. Press the Ctrl+x to exit the editor

You can refer to here to learn more.

2. Use libcamera to access the camera

2.1. Use libcamera-app to access the camera

2.1.1 Capture image

For example, preview for 5s and save the image named test.jpg.

libcamera-still -t 5000 -o test.jpg

Parameter explanation
-t 5000 means preview for 5 seconds
-o test.jpg means to take a picture after the preview is over and save it as test.jpg

2.1.2 Record video

For example, record a H.264 10s video with the frame size 1920W × 1080H.

libcamera-vid -t 10000 --width 1920 --height 1080 -o test.h264

Parameter explanation
-t 10000 means recording for 10 seconds.
–width 1920 means to set the width to 1920.
–height 1080 means to set the height to 1080.
-o means to output the encoded data stream to the test.h264 file.

Note: H.264 format only supports 1920×1080 and below resolution.

2.2. Use Picamera2 to access the camera (Access by Python)

2.3 Use GStreamer to access the camera

2.3.1 Plugin GStreamer installation

Install GStreamer
sudo apt update
sudo apt install -y gstreamer1.0-tools
Preview
cd ~/libcamera # Installation using deb does not need to be executed
export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer # Installation using deb does not need to be executed
gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=1920,height=1080' ! videoconvert ! autovideosink

2.3.2 Streaming MJPEG

# server 
libcamera-vid -t 0 --width 1920 --height 1080 --codec mjpeg -n -l -o tcp://0.0.0.0:5001
# client
gst-launch-1.0 -v tcpclientsrc host=xxx.xxx.xxx.xxx port=5001 ! decodebin ! fpsdisplaysink sync=false text-overlay=false

2.3.3 Streaming H.264

# server 
libcamera-vid -t 0 --width 1920 --height 1080 --codec h264 -n -l -o tcp://0.0.0.0:5001
# client
gst-launch-1.0 -v tcpclientsrc host=xxx.xxx.xxx.xxx port=5001 ! decodebin ! fpsdisplaysink sync=false text-overlay=false

Display Images via VLC Media Player

The Raspberry Pi system comes with a VLC madia player.

1.Open VLC media plyer

1 3

2.Select 【Media】→【Open Capture Device…

Select 【Media】→【Open Capture Device…】b0266

3.【Video device name】→ select “/dev/video0“→ click 【Play

3 1
vlc media player b01671 1

It may be stuck due to Raspberry Pi performance and VLC media player.

4.Adjust the exposuregain, and frame rate

【Tool】→【Effects and Filters】

Adjust the exposure gain and frame rate b0264 1

Drag the different slider to adjust the corresponding parameter.

Adjust the exposure gain and frame rate b0264 2

Display Images via Mplayer

1.Install mplayer

sudo apt-get install mplayer
install mplayer b0267

2.Display images

mplayer tv:// -tv driver=v4l2:device=/dev/video0

Do not enter this command remotely, otherwise it will be stuck.

mplayer command b0267
mplayer pic b0267

The image screen may be too large for the display to be complete. You need to drag the title bar to move the window to see the full image. (The image is pretty smooth.)

mplayer pic full b0267

Or enter the following command to zoom the image. The image will appear full, but it will become stuck.

mplayer tv:// -tv driver=v4l2:device=/dev/video0 -zoom -x 1280 -y 200

“-x” “- y” denotes the width and height of the scaled image, and it is recommended to modify them in equal proportion.

mplayer pic zoom b0267

External Trigger Mode

Hardware Setup

The external trigger mode has requirements on the connection method and electrical level of the external trigger signal.

The external trigger signal voltage should be 1.8V, and then send it to four cameras at the same time (It can be achieved through the breadboard ).

NOTE: 3.3V may burn out the device for the DOVDD of the camera is 1.8V.

external trigger mode1 pi

The external trigger signal is connected to the FSIN test hole of the camera board (you may need to solder the row of pins by yourself. Note that GND should also be connected).

external trigger mode2 pi

Software Setup

Method 1: Through terminal

Enter external trigger mode:

v4l2-ctl -c trigger_mode=1

Exit external trigger mode:

v4l2-ctl -c trigger_mode=0
Method 2: Through software interface

If you use VLC player, you can check “trigger_mode” under [v4l2 controls] tab to enter external trigger mode.

external trigger mode3 pi

NOTE

After the external trigger signal is effective, the field signal will be effective after a while, which is mainly for the exposure time. If the external trigger frequency is very fast and the exposure time is long, because the field will not respond to the external trigger signal when it is effective, it will cause the display frame rate is lower than the external trigger frequency, then shorten the exposure time can improve the frame rate (but the image will become dim).

What’s Next

Here are the things you can do after this quick start:

  • Check the Application Note for applications like using Arducam userland MIPI camera drivers.
  • Join the discussion in our forum.

Was this article helpful to you? Yes 3 No 1