In this tutorial, we will interface the Arducam Mega Camera, a 5MP SPI camera, with the Arduino UNO. The OV7670 Camera with an I2C interface is one of the older camera modules still used on Arduino boards. However, the camera has a communication issue that makes it difficult and slow, which significantly slows down image capture and video streaming. Additionally, the majority of camera projects rely on the pricey ESP32 CAM Module.
Arducam recently unveiled a renowned camera solution that makes it easy to link one or more cameras to any microcontroller. It is aimed primarily at embedded machine vision, artificial intelligence, and IoT devices that run on batteries. With a single industry-standard SPI interface, the Arducam Mega Camera can communicate with any microcontroller. For frame buffers or register settings, RAM is not needed. The fact that it works flawlessly with 3.3V and 5V systems is its strongest feature.
As part of this project, we will connect a 5-megapixel Arducam Mega Camera to an Arduino UNO Board and perform a variety of tasks, including as image capture at different pixel resolutions. Additionally, we’ll stream several videos solely using an 8-bit Arduino board. For the Arducam Mega camera, Arducam has published Arducam Mega SDK, which greatly simplifies programming. So let’s take a closer look at this camera and how it works.
Arducam Mega Camera
One or more cameras can be connected to any microcontroller using the renowned Arducam Mega Camera with little to no effort. It primarily targets battery-powered IoT devices, embedded machine vision, and applications utilising artificial intelligence.
Any microcontroller with a single, industry-standard SPI interface can be used with Arducam Mega. VCC and GND are not necessary; only 4 GPIOs are needed. For frame buffers or register settings, RAM is not needed. It works perfectly with 3.3V and 5V systems. With Arduino, STM8/STM32, ESP8266/ESP32, MSP430, Nordic, Renesas, and other MCU systems, the camera can be utilised directly.
The camera was created specifically for energy-saving uses. When your MCU is asleep, you may totally turn off the camera without worrying about loading lengthy register settings because it does this for you fast (in less than 100 ms) and automatically. Arducam Mega cameras come in two variations, one with 3MP (fixed focus) and the other with 5MP (autofocus). You may easily put it wherever you wish because it comes with a default enclosure.
The camera’s ability to use more than 4 camera modules simultaneously for still photos and output in a sequential manner is its strongest feature.
The SDK’s thorough architecture and complete open-source design make it simple to add a new MCU. Through the API functions, you can control the camera as if you were using a DSLR camera by pressing buttons. You can worry-free use our SDK source code into your own code thanks to the MIT licence.
Specifications & Features
|Arducam Mega – 3MP||Arducam Mega – 5MP-AF|
|Interface||SPI (4-wire)||SPI (4-wire)|
|Power Consumption||≤750 mW||≤1W|
|Focal ratio (F-Stop)||F2.8||F2.0|
|View Angle||68.75 Degrees (Diagonal)||68.75 Degrees (Diagonal)|
|Dimensions||33x33x17 mm||33x33x17 mm|
Any Microcontroller with a single standard SPI interface can be used with the Arducam Mega (either native or mimic one).
Only four pins (GPIOs) are required excluding VCC and GND.
Brief of Arducam Mega SDK
For the Arducam Mega camera, Arducam has published Arducam Mega SDK. The Arducam Mega API SDK is a C and C++ package that includes useful classes and functions to aid with the majority of daily operations. Both C++ API and C API are supported. The HAL layer, Arducam Mega Cam protocol layer, and API are all included in the SDK.
To interface with the SPI camera, the Arducam Mega Cam protocol layer is employed. The HAL layer’s functionality is utilised to support a variety of systems. The SDK currently supports the Arduino UNO, Arduino Mega2560, ESP32, ESP8266, STM32, MSP430, PICO, and RPI platforms. A particular hardware platform is communicated with via the Platform specific SPI bus driver. Users should alter both this layer and the HAL layer if they want to customize the SDK for their particular platform.
Interfacing 5MP Arducam Mega Camera with Arduino UNO
Let’s now examine how to connect the Arducam Mega, a 5-megapixel SPI camera, to an Arduino board. As seen in the graphic below, the connection diagram is quite straightforward.
The 5MP Arducam Mega Camera with Arduino UNO Board connection is shown below.
|Camera Pin||Arduino UNO Board|
You can directly connect the Camera with Arduino Board using the jumper wires.
Arducam Mega Library Installation
The library for Arduino Boards and other microcontrollers has been made available by Arducam. The Arduino IDE is used to configure the environment and use it.
Library Link: https://github.com/ArduCAM/Arducam_Mega.git
Downloaded the library file & copy the extracted folder to the Arduino library folder.
You can test the Camera using the sample code from the Arduino library example after adding the library to the Arduino Library folder.
We will test the camera using one of the many examples available for this project named full featured.
Choose the Arduino UNO Board from the Board list after choosing the example, and then click the upload button to upload the code to the board.
Testing the Camera
We need GUI visualization software to test the camera’s functionality. So click on the following link to download the Arducam program.
Install the software on your computer after downloading it.
After installation, choose the Arduino UNO port number and click “open.” The baud rate is 921600.
- The Camera is now connected to the software for visualisation. So that you can view everything on the GUI Screen, you can move the camera in different directions.
- To snap a picture, press the image button. The display window can be closed by clicking the close button. Additionally, you have a resolution and format choice.
- To enable the video button’s default 320×240 resolution video streaming option, click it. In order to turn off video streaming mode, click the close button.
- By default, auto exposure is turned on. Turning off automatic exposure is necessary when utilizing manual exposure.
- By default, the auto gain is turned on. You must disable automatic gain in order to use manual gain.
The program has controls for adjusting the brightness, contrast, EV, saturation, special effects, white balance, and focus.
The 5MP Arducam Mega Camera has an autofocus control. You can choose to use or not use this feature. You can choose to enable or disable the continuous focus feature; by default, it is turned off.
|Open||Enable the focus function|
|SingleTime||Enable single focus|
|Persistent||Enable continuous focus|
|Close||Turn off focus|
I hope all of you have understood the basics of Interfacing 5MP SPI Camera with Arduino UNO. We MATHA ELECTRONICS will be back soon with more informative blogs soon.