ArduCAM Mini Released

ArduCAM Mini is optimized version of ArduCAM shield Rev.C, and is a high definition SPI camera, which reduce the complexity of the camera control interface. It integrates 2MP or 5MP CMOS image sensor OV2640/OV5642, and provides miniature size, as well as the easy to use hardware interface and open source code library. The ArduCAM mini can be used in any platforms like Arduino, Raspberry Pi, Maple, Chipkit, Beaglebone black, as long as they have SPI and I2C interface and can be well mated with standard Arduino boards. ArduCAM mini not only offers the capability to add a camera interface which doesn’t have in some low cost microcontrollers, but also provides the capability to add multiple cameras to a single microcontroller.

Continue reading “ArduCAM Mini Released” »

RGB565 Format and Issues

The image sensors supports kinds of output formats like Raw RGB Bayer, YUV, JPEG, RGB565, RGB555, RGB444 and etc. In preview mode RGB output is preferred and it can be changed to other format when capture mode. In ArduCAM shield the LCD screen only support RGB565 data format, so when we do preview on the screen, we have to configure the sensors to RGB565 output format. Then the ArduCAM shield will display the image directly from the sensor to LCD screen without intervention of the Arduino board.

In this case the pixel data from the image sensors is ordered as RGB565 format, which means one pixel is composed by two consecutive bytes, the first byte is R[4:0]G[5:3] and the second byte is G[2:0]B[4:0]. The following picture show the RGB565 output timing and data ordering.


If the two bytes are disordered when saving to file, the color will be wrong. The same shoot but with different byte order the saved image will be different.















Sometimes we don’t know the order of the consecutive bytes at the beginning of the horizon signal HREF(Line_valid). To work around this issue ArduCAM example sketches try to read the first dummy byte from the FIFO to adjust the byte order before saving to a file.

  //Write the BMP header
  for( i = 0; i < BMPIMAGEOFFSET; i++)
    char ch = pgm_read_byte(&bmp_header[i]);
    buf[k++] = ch;
  //Read first dummy byte

  k = 0;
  //Read 320x240x2 byte from FIFO
  //Save as RGB565 bmp format
  for(i = 0; i < 240; i++)
    for(j = 0; j < 320; j++)
      VH = myCAM.read_fifo();
      VL = myCAM.read_fifo();
      buf[k++] = VL;
      buf[k++] = VH;
      //Write image data to bufer if not full
      if(k >= 256)
        //Write 256 bytes image data to file from buffer
        k = 0;


How to use ArduCAM with Arduino DUE board

User frequently reported that the ArduCAM shield doesn’t work with DUE board, and it is now a known issue.

We figured out that in the Due board the default SD library speed is much faster than ArduCAM shield. The current ArduCAM shield SPI timing only supports less than 10Mbps.  So if you want to work ArduCAM and DUE board together, the SPI should be configured with the lower speed.

To work around this issue, you have to modify the SD library below.
1. Please add the last line to \libraries\SD\utility\Sd2Card.h like follows.
/** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */
uint8_t const SPI_FULL_SPEED = 0;
/** Set SCK rate to F_CPU/4. See Sd2Card::setSckRate(). */
uint8_t const SPI_HALF_SPEED = 1;
/** Set SCK rate to F_CPU/8. Sd2Card::setSckRate(). */
uint8_t const SPI_QUARTER_SPEED = 2;
uint8_t const SPI_ARDUCAM_SPEED = 3;


2. Please change the SDClass::begin() function in the \libraries\SD\SD.cpp file like follows:
boolean SDClass::begin(uint8_t csPin) {
Performs the initialisation required by the sdfatlib library.
Return true if initialization succeeds, false otherwise.
//return card.init( SPI_FULL_SPEED, csPin) &&
//return card.init(SPI_HALF_SPEED, csPin) &&
//return card.init(SPI_QUARTER_SPEED, csPin) &&
return card.init(SPI_ARDUCAM_SPEED, csPin) &&
volume.init(card) &&



Where to find the source code

ArduCAM shield latest library and examples can be downloaded from download section. Please download the correct library for the the different shield version. For the Rev.B please use the V2.x.x or below, for the Rev.C please use the V3.0.0 or above.

What are the libraries

The library package contains two independent libraries: ArduCAM library and UTFT4ArduCAM_SPI. The ArduCAM library includes all the functionality to access the camera and the shield. The UTFT4ArduCAM_SPI is derived from the UTFT library from Henningkarlsen , we ported the library with SPI interface and remove the code which is not used in ArduCAM shield for the memory saving.

How to install the libraries

Use Arduino 1.5.2 IDE for example, unzip the downloaded library package to the folder X:\arduino-1.5.2\libraries, X is the disk driver that your Arduino IDE resides. When the libraries are correctly installed, open the menu File->Examples->ArduCAM you can see a lot of examples like the Figure1 shown.



What can the examples do

All the examples can be run in the ArduCAM-LF or ArduCAM-F boards, no matter the LCD exist. But we highly recommend to disable or remove the LCD functions for memory saving.


This example does the bus testing by write the test register and read it back to check it out if the SPI bus communication has errors. If you face problems with ArduCAM shield, you have to upload this example to check out if hardware has any problems.

  •  UTFT_Demo_320x240

This example does the demonstration of graphic functions from UTFT library. User can upload this example to check out if the LCD has any problems and how to use graphic functions to draw lines, circles and text.

  • ArduCAM_xxxx_LCD_CAM_SD_BMP

This example demonstrates how to use most functions from the ArduCAM library. It configures the camera module to output RGB565 QVGA format. Then display the image on the LCD screen in realtime. If user press the snapshot button, ArduCAM saves the image into SD/TF card with a 320×240 RGB565 bmp file.

  •  ArduCAM_xxxx_FIFO_SD_JPEG

This example demonstrates how to capture high resolution JPEG image from the camera module which support JPEG output. The demo configures the camera module to output JPEG format. In JPEG mode LCD doesn’t support realtime playback. And after user trigger the snapshot button, ArduCAM saves the image into SD/TF card with jpg file.

  •  ArduCAM_SPI_xxxx_FIFO_UART

This example demonstrates how to transfer the image back to host computer via Arduino board USB port or serial port. It is useful when user wants to transfer the image wirelessly by bluetooth, Zigbee, Xbee or GPRS/3G.

  • ArduCAM_xxxx_FIFO_SD_JPEG_LP

This example demonstrate how to use low power mode in the ArduCAM shield. When shield in idle mode, it shut down the LCD backlight and disable FIFO circuit. And running in full power after the snapshot button is triggered then getting back to low power mode after image captured.


This section describe the ArduCAM shield Rev.C hardware feature and user guide. For information about Rev.B, please refer here.


ArduCAM shield hardware integrates all the necessary components to interface with camera modules. User only need a extra support camera modules and a TF/SD card to start image capture.

The shield provide the following features:

  • Dedicate DigtalVideoPort Camera Module Interface
  • Standard SPI slave bus interface
  • 3.2” TFT Color LCD Screen(a)
  • Build-in 3Mbit FIFO Memory
  • TF/SD Card Reader with LED indicator
  • Use Arduino SPI / I2C dedicate pin out
  • Well mated with UNO/MEGA2560/DUE/Leonardo boards

Note: (a) Model ArduCAM-F doesn’t not include a 3.2” LCD screen

ArduCAM Shield Pin Out

ArduCAM shield includes to sets of pin out see Figure 1,  they are identical in function. One is Arduino standard, it can be well mate with standard Arduino boards like UNO, MEGA2560, Leonardo and DUE etc. The other one is alternative port which can be connect to any platform like Raspberry Pi. The detail pin out for each see Table 1 and Table 2.

Figure 1 ArduCAM pin out


Continue reading “Hardware” »