Skip to main content
Version: BSP 7.x.y

First Steps with Arducam CSI Camera Module 5MP OV5640

Arducam CSI Camera Module

(Double-Click to Zoom)

Introduction​

This article provides information on how to start working with the CSI Camera Module based on the OV5640 image sensor from Arducam.

The following topics will be covered:

Features​

The OV5640 is a high-performance CMOS image sensor designed for a wide range of imaging applications. It offers a combination of high resolution,advanced imaging features, and versatility, making it a popular choice for mobile and embedded camera systems.

Arducam has designed the OV5640 camera module and integrated it into the Toradex carrier boards via the MIPI protocol. The camera circuit board, after being improved by the Arducam technical team, has reached a mini size of 24x25mm, which makes it easier for visual projects to be applied in narrow spaces with limited size.

Sensor Features:

  • Image Sensor: OV5640 from OmniVision
  • Still Resolution: 5Megapixels
  • Interface: MIPI CSI-2
  • Output Format: 8-/10-bit RGB RAW, RGB, YUV, JPEG
  • Max Pixel Array: 2592 x 1944 pixels
  • Sensor image area: 6.287mm x 4.712 mm (7.9mm diagonal)
  • Pixel Size 1.4Ξm x 1.4Ξm
  • Optical Size: 1/4"

Lens Features:

  • IR Sensitivity: Integral IR-cut Filter, visible light only
  • Focal length: 4.22mm
  • Aperture: F2.0 +-5%
  • Field of View (FOV): 84.2°(D)×71.7°(H)×57°(V)
  • Lens Mount: Stock Lens

Datasheets​

Arducam CSI Camera Module OV5640 Datasheet

Hardware Setup​

What I need to order​

You can have the Arducam OV5640 CSI Camera Module working with specific Toradex computers on modules and carrier boards. See the compatible products.

Arducam OV5640 CSI Camera Module, cable, and carrier board

Besides the Module and the Carrier Board, you will need to order:

  • The Arducam OV5640 Camera Module;
  • The flat cable for connecting the Camera Module to the Carrier Board.

Where do I order​

You can order the Toradex computer on Modules and the carrier boards online in the Toradex Webshop.

You can order the Arducam Camera Module and the needed accessories on the Arducam Shop.

Please refer to the instructions below for connecting the camera module to your specific carrier board.

Cable Connection​

Connect the flat cable to the camera module as shown in the following pictures:

Flat Cable Connection Detail (Front)

Flat Cable Connection Detail (Back)

(Double-Click to Zoom)
danger

Please disconnect any power and USB cables from the board before connecting the flat cable to the MIPI-CSI bus to avoid any damage to the camera!

Connection to Dahlia Carrier Board​

Connect the camera to the Dahlia Carrier Board, assuring that the flat cable contacts are on the correct side, as indicated in the figures below.

Dahlia Carrier Board Connected to the Camera Module

Dahlia Carrier Board Connected to the Camera Module (other angle)

(Double-Click to Zoom)

Connection to Mallow Carrier Board​

Connect the camera to the Mallow Carrier Board, assuring that the flat cable contacts are on the correct side, as indicated in the figures below.

Mallow Carrier Board Connected to the Camera Module

Flat Cable Connected to the Carrier Board (Detail)

(Double-Click to Zoom)

Connection to Ixora Carrier Board​

Connect the camera to the Ixora Carrier Board, assuring that the flat cable contacts are on the correct side, as indicated in the figures below.

The MIPI-CSI interface is underneath the SoM

Board Connected to the Camera Module

(Double-Click to Zoom)

Connection to Verdin Development Board​

Connect the camera to the Verdin Development Board, assuring that the flat cable contacts are on the correct side, as indicated in the figures below:

Verdin Development Board Connected to the Camera Module on Native CSI

Verdin Development Board Connected to the Camera Module on Native CSI - Close-up

Flat Cable Connected to the Development Board (Detail)

(Double-Click to Zoom)

Connection with the Mezzanine

The Verdin iMX8M Plus Mezzanine can be installed on the Verdin Development Board to provide an additional MIPI-CSI connector. Connect the camera to the mezzanine as indicated in the figures below.

Verdin Development Board Connected to the Camera Module on Mezzanine CSI

Camera Module Connected to Mezzanine CSI

(Double-Click to Zoom)
  • The mezzanine MIPI-CSI Camera interface is on connector X5.

Mezzanine Jumper Configuration

The mezzanine includes jumpers on the MIPI-CSI interface that must be configured according to the intended use:

  • Default: use this position when operating the mezzanine camera port alone.
  • Alternate: use this position when using the mezzanine together with the native carrier board port simultaneously.
Jumper in Default position

Jumper in Alternate position

(Double-Click to Zoom)

Dual Camera Setup

To use both cameras simultaneously, connect one camera to the native CSI connector (X47) and the other to the mezzanine connector (X5), and make sure the mezzanine jumper is set to the Alternate position.

Verdin Development Board with Two OV5640 Cameras Connected

(Double-Click to Zoom)
info

The flat cable (used to connect the carrier board and the camera adaptor) is fragile. If your camera does not work, make sure to test the cable connections on the flat cable.

Compatible Products​

Hardware​

The Arducam CSI Camera Module 5MP OV5640 is sold together with a connector cable.

The following Toradex carrier boards that support the MIPI CSI-2 interface connect to the camera kits out-of-the-box, hardware-wise:

This camera module is supported for the following SoMs:

Software​

Software support for this camera is fully integrated from BSP version 7.

To integrate the camera on the software side, you need to apply an device tree overlay to the image, as shown in the next sections.

Camera Usage​

This article covers three possible configurations for using the camera:

  • Native port only: connect the camera directly to the native MIPI-CSI port on the carrier board.
  • Mezzanine only: connect the camera to the mezzanine port, with the jumper in either Default or Alternate position.
  • Native + Mezzanine: For dual camera support using both ports simultaneously, with the mezzanine jumper set to Alternate.
info

For hardware setup and jumper configuration of the mezzanine, see the Connection to Verdin Development Board section.

We recommend using a display to be able to visualize the captured image during camera testing.

Connect to the SoM​

After completing the hardware setup for your intended configuration, connect to the device via SSH or a serial terminal.

Select and Apply the Device Tree Overlays​

The overlays required depend on which port, or ports, you intend to use. Once you know your setup, check which overlays are currently applied:

# cat /boot/overlays.txt

The output shows the contents of the fdt_overlays variable, for example:

# fdt_overlays=verdin-imx8mp_hdmi_overlay.dtbo verdin-imx8mp_dsi-to-hdmi_overlay.dtbo

Select the tab that matches your intended configuration and append the indicated overlays to the fdt_overlays variable in /boot/overlays.txt:

Append the native overlay for your SoM:

  • Verdin Family SoMs: verdin-[SoM name]_ov5640-27mhz_overlay.dtbo
  • Apalis iMX8: apalis-imx8_ov5640-27mhz_overlay.dtb

Example for Verdin iMX8MP:

# fdt_overlays=verdin-imx8mp_hdmi_overlay.dtbo verdin-imx8mp_dsi-to-hdmi_overlay.dtbo verdin-imx8mp_ov5640-27mhz_overlay.dtbo

After editing the file, reboot the board to apply the overlay:

# reboot

At the beginning of the boot process, you can confirm that the overlays were applied successfully in the boot messages:

Found U-Boot script /boot.scr
5974 bytes read in 1 ms (5.7 MiB/s)
## Executing script at 50280000
Loading DeviceTree: imx8mp-verdin-wifi-dev.dtb
87774 bytes read in 2 ms (41.9 MiB/s)
152 bytes read in 1 ms (148.4 KiB/s)
Working FDT set to 50200000
Applying Overlay: verdin-imx8mp_hdmi_overlay.dtbo
2219 bytes read in 2 ms (1.1 MiB/s)
Applying Overlay: verdin-imx8mp_dsi-to-hdmi_overlay.dtbo
4099 bytes read in 1 ms (3.9 MiB/s)
Applying Overlay: verdin-imx8mp_spidev_overlay.dtbo
561 bytes read in 1 ms (547.9 KiB/s)
Applying Overlay: verdin-imx8mp_ov5640-27mhz_overlay.dtbo
3217 bytes read in 1 ms (3.1 MiB/s)
8106902 bytes read in 33 ms (234.3 MiB/s)

Find the Device​

To check which /dev/video* is a capture device, use the Video4Linux Control (v4l2-ctl) application from the v4l2-utils package.

List the video devices:

# ls /dev/video*
/dev/video0 /dev/video1 /dev/video2 /dev/video3

Show information about a specific device, for example /dev/video3:

# v4l2-ctl -d3 -D
Driver Info:
Driver name : mxc-isi-cap_v1
Card type : mxc-isi-cap_v1
Bus info : platform:32e00000.isi:cap_devic
Driver version : 6.6.23
Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
info

The video device can appear on any of the listed /dev/video* nodes. Check all of them to identify the correct one before running the pipeline.

When using both MIPI-CSI ports simultaneously, two capture devices will be available, one for each camera.

View the Video Output​

To view the video output, run the command according to your SoM:

For a single camera:

# gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-raw ! videoconvert ! waylandsink

For the dual camera setup, the following pipeline displays both cameras side by side in a single output window:

# gst-launch-1.0 compositor name=mix \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=640 sink_0::height=480 \
sink_1::xpos=640 sink_1::ypos=0 sink_1::width=640 sink_1::height=480 ! \
videoconvert ! waylandsink \
v4l2src device=/dev/video3 ! video/x-raw,width=640,height=480 ! videoconvert ! mix.sink_0 \
v4l2src device=/dev/video4 ! video/x-raw,width=640,height=480 ! videoconvert ! mix.sink_1
info

Remember to replace the /dev/video* node in the commands above with the one corresponding to your camera, as identified in the Find the Device step.

Click here to see a sample of the Gstreamer command output. This may vary depending on the used SoM.
# gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-raw ! videoconvert ! waylandsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
/GstPipeline:pipeline0/GstWaylandSink:waylandsink0.GstPad:sink: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1
Redistribute latency...
0:00:12.3 / 99:99:99.

How to Use Video Streams on Linux - Video4Linux & GStreamer​

For more details about using Video4Linux and GStreamer tools to interact with cameras and collect video frames, see Cameras on Toradex System on Modules.

Having Trouble?​

Please contact our technical support. Various options are listed in the article below.

Send Feedback!