Manual Exposure for OV2640


ArduCAM all given examples are using auto exposure for easy use of the camera. But somethings user want to control the exposure more precisely. This article will cover how to do manually exposure for OV2640 camera.

How does Rolling Shutter Sensor Exposure

All rolling shutter image sensors including OV2640 are doing exposure by line basis. They do exposure line by line, so all pixels in a line are exposed at the same time, but different pixels from different line are exposed at different time.

In this case, the minimum exposure time is 1 Line Time, and the maximum exposure time is one Frame time. Basically it equals to total vertical resolution times 1 Line Time, but sometimes there are one or more dummy lines added to the frame.

The OV2640 Timing

The following figure is the OV2640 UXGA (1600 x 1200) resolution timing diagram.

1 Line is composed by 1600 pixels and 322 clock horizontal blanking, Tline = 1922 pclk in total.

1 Frame is composed by 1248 lines including the active 1200 lines and 4 lines + 44 lines of vertical blanking.

Given the pixel clock is 36MHz by default, the 1 Line time is 53.39us. The calculated frame time is 66.63ms. So the minimum exposure time is 53.39us and maximum exposure time is 66.63ms if no additional dummy pixels and dummy lines added.

How to Set Manual Exposure with OV2640

In order to enable OV2640 manual exposure, we have to disable the AEC bit from register 0x13 in the register Bank 1. Don’t forget to switch to the register Bank 1 by writing 0x01 to 0xFF register.

The exposure register is spreaded in 3 registers 0x45, 0x10, 0x04 in the register Bank 1. Write correct value in line basis to these register will change the exposure of the target images.

More Control Over the Exposure

The maximum exposure time is limited by the Frame time. If we want to over exposure of a image when at night, we have three other ways to do it.

  • Change the Pixel Clock

Write 0x11 register in the register Bank 1 will adjust the pixel clock speed, and in turn change the Line time accordingly.

  • Add dummy pixels to a line

Write 0x2A and 0x2B register in the register Bank 1 will add dummy pixels to a Line, and in turn change the Line time accordingly.

  • Add dummy lines to a frame

Write 0x2D and 0x2E register in the register Bank 1 will add dummy Lines, and in turn change the Frame time accordingly.

Testing Result

Here we set different exposure value to AEC register at the same light enviroment. The exposure values are 200, 400, 800, 1024 which is in lines basis, and corresponding  to 10.7ms, 21.4ms, 42.7ms and 54.7ms.


ArduCAM USB Camera Shield Released



The ArduCAM USB camera shield is a universal camera control board designed for both PCs and embedded systems like the Raspberry Pi, TI Beaglebone, and similar products. It supports most parallel interface image sensors ranging from 0.3MP to 14MP, including both global and rolling shutter sensors. The camera is packaged with the software you need to put it to work on Windows and Linux systems and  a comprehensive SDK library is provided to support this.  This SDK is fully integrated with Python, which allows for direct integration of our cameras with your OpenCV based applications.

The plug and play USB control interface simplifies integrating the camera with a wide range of computer hardware. The ready to use SDK library and demo source code makes the software integration process straightforward and efficient. Users can make it work in minutes without writing a line of code. The broad range of modules ArduCAM supports, combined with support for formats like RAW, RGB, YUV, JPEG assures our users a successful outcome.

The ArduCAM USB camera shield joins our product line of shields that offer SPI/IC2 interfaces. The USB camera shield offers significant speed gains over the SPI camera shield, running at as high a frame rate as the USB2.0 480Mbps bandwidth allows which can deliver  640_480(VGA at 60 FPS, through  4384_3228(14MP) at 2 FPS. By using a global shutter camera headboard such as the MT9V034/AR0134 together with USB camera shield, the user can achieve industrial level machine vision with our camera on a Raspberry pi without effort.

The ArduCAM is straightforward enough that it can be easily used with PCs and single board computers such as the Raspberry Pi and the Beaglebone. In short, the ArduCAM brings a plug and play solution to digital cameras at the hardware level.

Please visit our github to find more information and examples.

Table 1 Supported Camera Modules

Resolution Sensor Vendor Camera Module Manufacture
0.3MP Omnivision OV7660 / OV7670 / OV7675 / OV7725 ArduCAM
0.3MP Aptina MT9V111/MT9V034 ArduCAM
1.3MP Aptina MT9M112 / MT9M001/AR0134 ArduCAM
2MP Omnivision OV2640 ArduCAM
2MP Aptina MT9D111 / MT9D112 ArduCAM
3MP Omnivision OV3640 ArduCAM
3MP Aptina MT9T112 ArduCAM
5MP Omnivision OV5640 / OV5642 ArduCAM
10MP Aptina MT9J001 ArduCAM
14MP Aptina MT9F002 ArduCAM

Quick Demonstration

Using 10MP MT9J001 Monochrome Sensor headboard (original RAW data)

Using 14MP MT9F002 Color Sensor headboard (original RAW data)

The GotchaCAM Portable DIY Wifi Camera Based Travel and Home Security and Surveillance System



The GotchaCAM Portable Travel and Home Security and Surveillance System consists of the ArduCAM CC3200 Uno and the software from the book “Home Security System DIY PRO using Android and TI CC3200 SimpleLink” by Robert Chin. Both are available
for purchase on major sites like Amazon in US.

The recommended way to purchase the hardware for this system is by buying the “ArduCAM CC3200 UNO DIY Wifi Portable Security Spy Ghost Hunter Camera Starter Kit” that is available on Amazon. This provides you with all the hardware you will need.

This system is designed for

  •  Makers
  •  TI CC3200 Simplelink enthusiasts
  •  DIY (Do it Yourself) home security enthusiasts
  •  Frequent flyers that stay in hotels or motels.
  •  Landlords that are renting out homes or apartments.

Key Features

  •  Full source code and binaries are available for download and its installation, use, and design is fully explained in the book “Home Security System DIY PRO using Android and TI CC3200 SimpleLink”
  •  Portable design only requires an ArduCAM CC3200 Uno, a MT9D111 digital camera, and an Android cell phone in order to send emergency text alerts and cell phone calls.
  •  No external Wifi network is required to send text messages and emergency calls so this would be great solution for business travelers using hotels or for homes or apartments that are rentals.
  •  Provides portable self-monitored on demand security and surveillance without the contracts or hassle of installing a traditional security system.

Video Demonstration

Second Generation ArduCAM Shields and Modules


ArduCAM series camera shield is a universal camera control board for Arduino. It hides the complex nature of the camera and provides the plug and play camera control interface as well as the ready to use software source code library and demo code. User can make it works in minutes without writing a line of code. The ArduCAM supports variety camera modules from 0.3MP to 5MP with different format like RAW, RGB, YUV, JPEG and can be well mated with standard Arduino boards.
ArduCAM Shield V2 and ArduCAM-Mini-5MP-Plus are the second generation of ArduCAM products, they offers the improved performance and enhanced functions than the previous revisions. They not only can capture decent 5MP JPEG images, but also can do 5MP full resolution RAW image capture, which makes it to be the ideal solution for IoT and scientific image processing applications. Even more they can record short movie clips as well.
The ArduCAM is straightforward enough that it can be easily used with an Arduino, however this simple interface means that the ArduCAM is equally easily integrated with other single board computers such as the Raspberry Pi and the Beaglebone black. It isn’t just a camera for the Arduino, it’s a camera that because it can be easily interfaced to an Arduino, can be easily interfaced to any single board computer, either directly, or through an Arduino if needed for a larger system without exposed SPI/I2C busses. In short, the ArduCAM brings a plug and play solution to digital cameras at the hardware level.


  • IoT cameras
  • Robot cameras
  • Wildlife cameras
  • Scientific cameras
  • Machine vision
  • Other battery-powered products
  • Can be used with any MCU, ESP8266, Raspberry Pi, ARM, DSP, FPGA platforms


  • Support 0.3MP~5MP camera modules, see Table 1
  • 3.2 inch TFT LCD with touch screen (Only available on Shield V2)
  • Build in SD/TF card socket (Only available on Shield V2)
  • Support JPEG compression mode, single and multiple shoot mode, one time capture multiple read operation, burst read operation, low power mode and etc.
  • Support almost any microcontroller platform, see Table 2
  • Provide open source code library, please visit arducam github
  • All ArduCAM’s IO ports are 5V/3.3V tolerant
  • Well mated with standard Arduino boards

Table 1 ArduCAM Shield V2 Supported Camera Modules

Resolution Sensor Vendor Camera Module Manufacture
0.3MP Omnivision OV7660 / OV7670 / OV7675 / OV7725 ArduCAM
0.3MP Aptina MT9V111 ArduCAM
1.3MP Aptina MT9M112 / MT9M001 ArduCAM
2MP Omnivision OV2640 ArduCAM
2MP Aptina MT9D111 / MT9D112 ArduCAM
3MP Omnivision OV3640 ArduCAM
3MP Aptina MT9T112 ArduCAM
5MP Omnivision OV5640 / OV5642 ArduCAM

Table 2 Supported Hardware Platforms

Platform Type Manufacture
8bit MCU Arduino UNO / MEGA Arduino
Cotex-M3 Arduino DUE Arduino
Cotex-M3 STM32 Develop Board ArduCAM
ARM Raspberry Pi B+ / Pi 2 / Pi 3 Raspberry Pi
ARM BeagleBone Black BeagleBone
MIPS ArduCAM Nano ESP8266 ArduCAM

Key Specifications

Table 3 Specification

Spec ArduCAM Shield V2 ArduCAM-5MP-Plus
Resolution 0.3MP ~ 5MP 5MP
3.2″ TFT LCD Support NA
TF/SD card Support NA
Frame Buffer 8MByte 8MByte
SPI Speed 8MHz 8MHz
Power 50mA@5V
without camera module
Size 99x59mm 34x24mm

ArduCAM Shield V2 Datasheet
ArduCAM Mini 5MP Plus OV5642 Datasheet
ArduCAM Shield V2 Hardware Application Note
ArduCAM Mini 5MP Plus Hardware Application Note
ArduCAM Software Application Note

New Book for ArduCAM CC3200 Uno DIY Wifi Security Spy Ghost Hunter Camera Starter Kit


The author Robert Chin wrote a book for Home Security System DIY PRO using Android and TI CC3200 SimpleLink using ArduCAM CC3200 UNO DIY WIFI Start Kit. If you want to build home security system by yourself, it is right for you to read about it. And now it is available on Amazon.


This book shows you how to build and modify your own wifi camera based commercial quality portable wireless security, surveillance, and spy system appropriate for use at home, or during travel. This system uses only an Android cell phone or tablet(operating system 2.2 and above), a TI CC3200 Launchpad or ArduCAM CC3200 UNO, and a TI Camera Booster Pack with MT9D111 digital camera or just an ArduCAM MT9D111 digital camera if you are using an ArduCAM CC3200 Uno which has a built in camera interface. This book shows you how to build and modify your own alarm system that detects the motion of an intruder, calls out to an emergency phone number and sends emergency text messages using an Android cell phone or just alerts you to the intruder using an Android tablet. This alarm system is compact enough to also provide portable security for travelers using hotels and motels or you can use this as a hidden spy camera system. You can also use the security system for high quality continuous real time surveillance of your property. The live video feed is shown on the Android device. The camera can be set to only record pictures where there is movement so you can easily view any saved images to determine what kind of intruder was detected. The image data is stored locally on the Android device and does NOT require payment of storage fees as with some home security company plans. This book will also go into the technical details of the hardware set up as well as the author created Android and TI CC3200 SimpleLink software. With these technical details you will be able to customize and expand these systems to suit your specific needs for your own personal use. This book also serves as a quick start guide for people interested in learning how to program wifi communication between an Android and a TI CC3200 Simplelink device.

Who is this book for?

This book for people that:

* Want a quick start guide to wifi communication between an Android device and a TI CC3200 Simplelink device using a camera.

* Travel often and need a low cost, no contract, portable security solution when living in motels and hotels.

* Want to secretly monitor a wife, husband, girlfriend, boyfriend, employee, co-worker and/or other people or even animals without their knowledge and have real time notifications sent to your cell phone.

Key Feature Summary:

* Shows you how to build and modify your own portable wifi camera based commercial quality wireless home or portable security, surveillance, and spy system with real time emergency notification phone call out and text message notifications to your main cell phone.

* The home security system presented in this book is easy to assemble and does not require the use of breadboards or soldering.

* Follow the detailed “Hands on Example” and install the pre-made software created by the author on your Android and TI CC3200 SimpleLink devices and get a working commercial quality video surveillance system, or an intruder alarm system up and running quickly

* This book explains the author created source code for the Android and TI CC3200 SimpleLink devices so you can customize the home security system yourself for your own specific needs for personal use.

Table of Contents:

Chapter 1: Introducing the ArduCAM CC3200 UNO

Chapter 2: TI CC3200 SimpleLink Programming Language Basics

Chapter 3: The Android Controller and Wifi Communication

Chapter 4: The CC3200 and Wifi Communication

Chapter 5: Motion Detection Using a Camera

Chapter 6: The Android Wireless Security System Design

Chapter 7: The CC3200 Simplelink Wireless Security System Design

Chapter 8: Hands on Example: Building an Android and ArduCAM CC3200 UNO Security System

Chapter 9: Deploying your GotchaCAM Wireless Intruder Alarm and Surveillance System

World Smallest ESP8266 WIFI Camera


ArduCAM now released a world smallest low cost ESP8266 WIFI IoT camera kit based on ArduCAM-Mini-2MP-V2 and ArduCAM-ESP8266-Nano module. User can implement a 2MP WIFI camera using HTTP or Websocket protocol on ESP8266, and the camera can be acted as an AP and mobile phone/PC can connect to the camera directly or acted as a Station which connected to the home router. The kit can capture 2MP full resolution JPEG still image, even stream low resolution at fairly frame rate video over network or directly save to local SD/TF card. The kit is suitable for portable application, it can be powered from micro-USB or using battery and has build in lithium battery charging circuits. The kit can also be used separately, it is almost identical to standard alone ArduCAM-Mini-2MP camera and ESP8266-12F module.


  • 2MP image sensor OV2640, support JPEG
  • Standard FOV 60°stock lens
  • I2C interface for the sensor configuration
  • SPI interface for camera commands and data stream
  • Onboard ES8266-12F module
  • Build in Lithium battery recharging 3.7V/500mA max
  • Build in SD/TF card socket
  • Build in micro USB-Serial convertor
  • Compatible with Arduino IDE
  • Small form of factor


  • Maximum resolution: 2MP
  • Field of view: 60°
  • Compression: JPEG/MJPEG
  • Interface: SPI and I2C
  • WIFI mode: 802.11 b/g/n software AP or Station mode
  • Power consumption: 180mA @ 3.7V full running
  • Mechanical size: 34mm(L) x 24mm(W) x 23(D)

Software and Document

The evaluation kit user guide can be download from here. The ESP8266 library and example sketches can be found from github. Host PC streaming application can be downloaded from here for Windows, and here for Linux.

24 x 24mm Coin Size Raspberry Pi Compatible Board


ArduCAM team now is developing a coin size Raspberry Pi compatible compute module. The total size of the SOM is 24mm x 24mm, compared to the offical Raspberry Pi compute module and new Pi ZERO, it will be the smallest Raspberry Pi compatible module in the world. The coin size pi compute module is fully customizable and can offer the extra features that wasn’t provided by the standard Raspberry Pi boards. User can run the system on a small 36mm x 36mm adapter mother board with camera support. It is ideal for battery powered portable device lilke smart watch, action camera etc. The highlight feature of this coin size pi module, it supports dual camera interface and stereo vision which can be used in robots for machine vision applications or high definition drone camera. Contact us for more information about customization. Note it is not a replacement for Raspberry Pi boards, just a supplement for Raspberry Pi ecosystem and Raspberry Pi is a trademark of the Raspberry Pi Foundation. (This post made Raspberry Pi engineer and forum moderator very upset and they said that it will would breach the bootloader license. But thanks to Kristina Brooks work on an open source bootloader for Raspberry Pi, released under BSD and GPLv2+, and not including any “Raspberry Pi only” conditions, although it is a “poor” alternate at the time being, and a lot of fans build bare metal firmware.  said it could also end up being killed and will never see the light of day, just as what happened to ODROID-W board, but they can’t kill the spirit of hacking just for funs and keep us away from building something new. Once again I have to emphasize that it is not a replacement of Raspberry Pi boards, please order pi boards from Pi foundation. Our SOM maybe double or even triple price than standard pi boards, so this SOM is only available for someone who really need it and NDA required.)


  • BroadCOM BCM2835 SoC Processor
  • 256MB/512MB LPDDR2 Memory
  • Camera CSI Interface x2, Supports both 5MP and 8MP Pi Camera
  • USB x1
  • AV output
  • SPI x 2
  • UART x 1
  • I2C x 2
  • GPIOs x25 including peripherals
  • Size: 24mm x 24mm
  • Weight: 2g

ArduCAM has also designed two small adapter board “UC-343 and UC-366” for the module with the following specifications:

  • SoC – Broadcom BCM2835 ARM11 Processor @ 700 MHz with Videocore IV GPU
  • System Memory – 256MB/512MB LPDDR2
  • Storage – micro SD card slot
  • USB – 2x micro USB ports including one for power only
  • Camera – 2 x MIPI CSI connector supporting 5MP or 8MP Pi cameras (dual camera support) on UC-366, only one MIPI CSI on UC-343
  • Expansion –
    • AV output header
    • UC-343 has 16-pin and 8-pin headers (unpopulated) with GPIOs, 1x I2C, UART, 2x SPI
    • UC-366 has 24-pin header (unpopulated) with GPIOs, UART, 2x SPI
  • Misc – Power LED
  • Power – 5V via micro USB port, or battery header
  • Dimensions – 36x36mm (Module only: 24mm x 24mm)
  • Weight – 10 grams


8MP Sony IMX219 Camera for Raspberry Pi



ArduCAM team just released a 8MP Raspberry Pi compatible camera based on the same Sony IMX219 image sensor. It’s capable of 3280 x 2464 pixel static images, and also supports 1080p30, 720p60 and 640x480p90 video. It attaches to Pi by the dedicated standard CSi interface.

It is the supplementary for Raspberry Pi offical camera in order to fulfill the demands for different lens mount, field of view (FOV) and depth of the field (DOF) as well as the motorized IR cut filter for both daylight and night vision. Contact us for further customization.


  • Sensor type: Sony IMX219 Color CMOS 8-megapixel
  • Sensor size: 3.674 x 2.760 mm (1/4″ format)
  • Pixel Count: 3280 x 2464 (active pixels) 3296 x 2512 (total pixels)
  • Pixel Size: 1.12 x 1.12 um
  • Lens: M12/CS mount customizable, telephoto to fisheye
  • Angle of View: customizable
  • Video: 1280×720 binned and cropped up to 60fps
  • 1080P cropped up to 30fps
  • 1640×1232 full FOV binned mode, up to 30fps
  • 3280×2464 full FOV, allegedly 0.1fps to 15fps
  • Board size: 36 x 36 mm
  • IR Sensitive: Optional motorized IR cut filter

ArduCAM porting for Raspberry Pi


As ArduCAM is general purpose camera, it can be used on any micro controller platform not limited to Arduino, and now ArduCAM team port the code library to Raspberry Pi family.

Thanks to the uniform 40 pin GPIO header design makes it possible to adopt ArduCAM and its mutli camera adapter board for Pi B+, Pi 2, Pi 3 and even Pi ZERO. Due to the benefit of onboard frame buffer and DMA transfer directly from sensor to frame buffer, make the ArduCAM outstanding of taking photos simultaneously.

With ArduCAM porting for Raspberry pi, you can use more cameras on Raspberry Pi together with native Raspberry Pi camera.


ArduCAM ESP8266 UNO board for Arduino Camera



ArduCAM now released a ESP8266 based Arduino board for ArduCAM mini camera modules while keeping the same form of factors and pinout as the standard Arduino UNO R3 board. The high light this ESP8266 board is that it well mates with ArduCAM mini 2MP and 5MP camera modules, supports Lithium battery power supply and recharging and with build in SD card slot. It can be an ideal solution for home security and IoT camera applications.


  • Build in ESP8266-12E Module
  • 11 digital input/output pins, IO ports are 3.3V tolerant
  • 1 analog input(3.2V max input)
  • ArduCAM Mini 2MP/5MP camera interface
  • Lithium battery recharging 3.7V/500mA max
  • Build in SD/TF card socket
  • 7-12V power jack input
  • Build in micro USB-Serial interface
  • Compatible with Arduino IDE

Pin Definition

Note that the SD/TF card CS pin is shared with UART TX signal, so the UART and the SD/TF can’t be used at the same time.

Getting Started ESP8266 with Arduino IDE

ArduCAM released a add-on package which allows installation of third-party platform packages using Boards Manager. Add the following URL to the Arduino IDE Preferences window. Then Open Boards Manager from Tools -> Board menu and install ArduCAM_ESP8266_UNO add-on package.

There are 3 examples for both 2MP and 5MP ArduCAM mini camera modules.

  • ArduCAM_Mini_OV2640_Capture (or ArduCAM_Mini_OV5642_Capture)

This example uses HTTP protocol to capture still or video over home wifi network from ArduCAM mini 2MP/5MP and display on the web browser.

  • ArduCAM_Mini_OV2640_Capture2SD (or ArduCAM_Mini_ OV5642_Capture2SD)

This example takes time elapse still photos using ArduCAM mini 2MP/5MP and then stored on the TF/SD card. The LED indicates when the TF/SD card is writing.

  • ArduCAM_Mini_OV2640_Video2SD (or ArduCAM_Mini_OV5642_Video2SD)

This example takes motion JPEG video clips using ArduCAM mini 2MP/5MP and then stored on the TF/SD card as AVI format.

For more information, please read the user guide here.