1. Home
  2. Docs
  3. STM32/SPI Camera
  4. How to use Arducam Mini 2MP & 5MP SPI Camera with STM32

How to use Arducam Mini 2MP & 5MP SPI Camera with STM32

Why SPI Camera?

STM32 is a family of 32-bit microcontroller integrated circuits by STMicroelectronics. The STM32 chips are grouped into related series that are based around the same 32-bit ARM processor core, such as the Cortex-M33F, Cortex-M7F, Cortex-M4F, Cortex-M3, Cortex-M0+, or Cortex-M0. Learn more.

Some STM32 series like STM32F4 and later versions of MCUs have a DCMI peripheral that can be used to interface the STM32 chip directly to camera sensors. The DCMI is flexible enough to support a variety of sensors that output data using a parallel data interface (RGB). However, some STM32 like Previous versions of STM32F4 do not have DCMI, Arducam SPI Camera can be used on any platform as long as they have SPI and I2C interfaces(such as STM32F1, STM32L1). Most importantly, Arducam mini SPI Camera also provides the function of adding multiple cameras to a single microcontroller (even those STM32 series with camera interface).

We show two Arducam mini SPI Cameras, 2MP-OV2640 and 5MP-OV5642. They not only small in size but also have high definition, reduce the complexity of the camera control interface, easy to use hardware interface, and open-source code.

By the way, you maybe have interest in Arduino Camera: SPI Camera Module from Arducam.

This document demonstrates how to use the SPI camera on the STM32 platform.


1 1
STM32f103 platform
2 1
STM32L152 platform

Camera connect STM32f103 platform


Camera connect STM32L152 platform


Serial port module connection

Serial port moduleGNDTXDRXD


2.1 Download the firmware source code package

The Download link:


2.2 Upzip the firmware source code package

image 37

2.3 Enter the folder and Compile program


Please enter the corresponding folder with your STM32 chip model. If you use STM32L152, please use Keil to open the SpiCamer.uvprojx file as the following demo. If you use STM32F103, please use Keil to open the Project.uvprojx file. You can refer to the demo for the next steps.

2.4 Capture

Open host_app\ArduCAM_Host_V2.0_Windows\ArduCAM_Host_V2.exe, then follow the next steps.

  • View your device manager and configure the corresponding port number.
  • Set the baud rate to 921600.
  • If your camera is 2MP OV2640, select 2640; if your camera is 5MP OV5642, select 5642.
  • Set the resolution you want to render.
  • Set the single or continue mode to capture.

You can see from the demo, the single-mode can get a single shoot, the continue mode can make video streaming.

Was this article helpful to you? Yes 4 No