Template: AF Camera Quick Start

From Waveshare Wiki
Jump to: navigation, search

Install Driver & Quick Test

Hardware Connection

To test the Camera, you need to connect a HDMI display or a DIS display for previewing.

The connectors of the DSI interface (display) and the CSI interface (camera) look the same, please take care of it when you connect the camera. The CSI interface is placed between the Audio jack and the HDMI port. the CSI connector of Pi zero is beside the Power interface. If you use Compute Module, please check the actual place of the carrier board.

  • Connect ot Pi Zero Series
The metal surface of the flexible cable is downward, then connect to the CSI interface.
RPi Camera Connect Zero01.jpg
  • Other Raspberry Pi boards
The metal surface of the flexible cable is toward the HDMI interface, then connect to the CSI interface.
RPi Camera Connect Pi402.jpg

Driver Description

Please make sure that you have programmed the newest system of the Raspberry Pi before installing the driver. As the driver is based on the libcamera library, it supports all the commands of libcamera library. The driver only supports the Raspberry Pi system and does not support other systems and boards. Currently, the latest version the driver supports is 5.1.32.
We provide the driver file including two categories: opencam_V4L2-Driver focus tool and package driver support package.

Download the Driver

Install the Camera Driver

Open the Raspberry Pi terminal, download the driver and install it.

wget https://www.waveshare.com/w/upload/8/8c/IMX519_Driver.zip
unzip IMX519_Drive.zip
cd IMX519_Drive/package/
sudo chmod +x install_pkgs.sh
./install_pkgs.sh -p libcamera_dev
./install_pkgs.sh -p libcamera_apps
./install_pkgs.sh -p imx519_kernel_drive

After installation, you will be prompted to restart the system, enter y, and press Enter to restart the system.

Install the Focus Tool

Open the Raspberry Pi terminal and install the tool.

cd IMX519_Drive/opencam-V4L2-Driver/focus
sudo python3 FocuserExample.py

Camera Test

If it is connected via SSH, you can input "export DISPLAY=:0" for remote control. Note that the Raspberry Pi needs to be connected to an HDMI screen for previewing.
The following commands are used to preview the camera display and set the autofocus parameter, which will let the camera focus automatically when it is on.

libcamera-still --autofocus

If you need to keep focusing, you need to use the terminal to open the camera preview.

libcamera-vid -t 0

Open another terminal and adjust the focus with the focus tool.

cd IMX519_Drive/opencam-V4L2-Driver/focus
sudo python3 FocuserExample.py -d /dev/v4l-subdev1

The command will open another control window, and you can use the up and down arrow keys on the keyboard to adjust the focus position of the camera.