- Microscope Mounted with Camera Module
- Microscope Lens
- Microscope Lens Top View
- Microscope Lens Bottom View
Please download the schematic of ArduCAM Rev.B for connection and pin out.
Please purchase the ArduCAM shield and camera modules from distributor UCTronics.
ArduCAM is Arduino based open source camera platform which is well mated to Arduino boards. It now supports Arduino UNO board and we will add support Mega1280/2560 and new released Leonardo, Maple and Chipkit are also in planning.
Features:
LCD Module
The TFT LCD is 3.2 inch QVGA ( 320×240 ) LCD, it use SSD1289 LCD controller and consists of up to 172,800 bytes (240 x 320 x 18 / 8) Graphic Display Data RAM (GDDRAM). It interfaces to Arduino with 8bit 8080 type bus interface. It is good to know that Henning Karlsen has already develop a open source library named UTFT for Arudino, it also support this LCD controller.
Camera Module
We will add support (already supported sensors are marked in red) to various of camera module which use Omnivision and Aptina CMOS image sensor, something like
MCU Platform
Two libraries are written for ArduCAM shield, one is UTFT library which is used for accessing the LCD screen, the other is ArduCAM library which supports different kind of camera modules registers configuration via I2C and accessing ArduChip internal control registers. ArduCAM library provide simple interface for sensor initialization, triggering a capture and read image data to external SD/TF card.
ArduChip
ArduCAM incorporate with a ArduChip, which used to do the DMA transfer between camera module and LCD internal GDDRAM, control the camera data stream timing and do the GPIO expansion. When start the state machine will enter preview mode, the Chip DMA the camera data to LCD screen directly with frame rate upto 30fps. Once the capture button is pressed, the state machine will freeze the screen and enter capture mode, the MCU will read the image data from LCD’s GDDRAM and save to SD/TF card.
Limitations
We can’t live without the LCD screen because we use the LCD GRAM as a frame buffer. The image resolution is limited by the LCD screen, so it only supports QVGA(320×240) preview resolution or equivalent 150KB size (around SXGA 1280×1024) JPEG image. It is OK for machine vision and small applications.
Due to the speed limitation of AVR series MCU, and all the Read and Write access to LCD GRAM is emulated by IO operation, saving a 320×240 RGB555 BMP into SD/TF card will take up 10 seconds and transmit the image over bluetooth needs 15 seconds. It is OK for the demostration, but I do think it will be resolved when we move to more powerful MCU platform like Maple and Chipkit.
CMOS camera modules are widely used in mobile phones and web cameras, and the price is pretty low when in volume. Therefore it becomes the best choice for embedded applications. However there is barrier in both hardware and software when using camera modules and block the hobbyists off. That why ArduCAM is born. ArduCAM is an open source project for CMOS camera modules, which hide the complexity of capturing high speed high resolution image data stream and provide the source code configuration for camera modules. User can freely control the ArduCAM shield to accomplish their different tasks. The first release of ArduCAM shield target for Arduino and its compatible platforms like Maple, Chipkit. And we plan to move to more powerful platform like Raspberry PI, Beagle board or Pandaboard.
Take BMP or JPEG image and save to SD/TF memory card
Mounting with proper lenses, can be used as microscope or astronomical telescope
Connected to extra Bluetooth or WiFi module, achieve wireless image transmission
With proper image processing algorithm, simple image procesing algorithm can be achieved
Arduino like platforms are too slow to catch up the 30fps video stream
Arduino like platforms are too slow and has insufficient memory to do the video processing
The ArduCAM shield has 6 general purpose IOs which can be set as input or output and greatly extend the power for the Arduino board which has limited IO resources. The structure of the IOs in the ArduCAM shield is the same as the one in the AVR chip, it has a direction register(DDR), a input register(PIN) and output register(PORT). In this demonstration, we will illustrate how to set the GPIOs in the ArduCAM shield as an input and use a PIR sensor triggering the shield to start a capture.
PIR(Pyroelectric InfraRed sensors ) is a motion sensor for use in alarm burglar systems, visitor presence monitoring, light switches and robots. PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don’t wear out. For that reason they are commonly found in appliances and gadgets used in homes or businesses. They are often referred to as PIR, “Passive Infrared”, “Pyroelectric”, or “IR motion” sensors.Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the ‘alarm’ pin will go high. We can use the PIR sensor to trigger the ArduCAM shield to take a photo for the scene.
Pin connection diagram between ArduCAM and PIR.In this demo we will use the IO0 connected to the PIR module.
Firmware guide:
In setup() routine we have to set the GPIOs to input like this
void setup()
{
myCAM.write_reg( ARDUCHIP_DDR, 0x00);
}
In the loop() routine we have to polling the status of the GPIOs and start to take a photo when the PIR triggered.
void loop()
{
...
while(1)
{
gpio_trig = myCAM.read_reg(ARDUCHIP_PIN); //Read external trigger from GPIO0~5
if (gpio_trig & 0x01) //if GPIO0 is high
{
k = k + 1;
itoa(k, str, 10);
strcat(str,".bmp"); //Generate file name
GrabImage(str);
}
}
...
}
Full Arduino code can be downloaded from here.
End.
This tutorial will demonstrate how to use the ArduCAM shield on Arduino UNO board, aim the point and press a snapshot button you will get a BMP picture saved on the SD/TF card.
When you get the package you will have the following items:
*1x ArduCAM shield
*1x Arduino UNO compatible board
*1x Supported camera module
You will still need a Micro SD / TF card to complete this tutorial.
First plug the camera module to the ArduCAM shield, please note that the camera module may have more pins than the socket. So please align the pins on the left and leave the right pins left open like the way on the picture.
Next step we have to insert the Micro SD/TF card into the card socket. And make sure the 2 way DIP switch on the ArduCAM shield is on the ON position.
Download the latest ArduCAM firmware library from http://www.arducam.com/download section. Then unzip the library to the Arduino/libraries directory like this way. There are two libraries needed for ArduCAM shield, one is ArduCAM library and the other named UTFT4ArduCAM library which is derived from the UTFT library for the proper operation for the 3.2″ LCD.
Open the example folder unziped from the zip file, you will see several demos for different camera module. Then open the demo according to the camera module you have. Hera use MT9D111 for example. Select the correct COM port for your Arduino UNO board and upload the firmware.
After successfully downloading the firmware, wait for the board to restart. You will see the preview video on the LCD screen, aim the point you want to take a picture and press buttom the LCD screen will freeze and wait for 10 seconds, a 320×240 RGB565 BMP file will be saved.
Key specifications
This image is captured at night in the room light with the full resolution (2592×1944).
This image is captured in the room light with the 1080P video output (1920×1080).

Pin definition:
| Signals | Description | Signals | Description |
| +3.3V | +3.3V from shield | +5V | +5V from Arduino |
| D1 | 3.3V logic version of D1 | D0 | 3.3V logic version of D0 |
| D3 | 3.3V logic version of D3 | D2 | 3.3V logic version of D2 |
| D5 | 3.3V logic version of D5 | D4 | 3.3V logic version of D4 |
| D7 | 3.3V logic version of D7 | D6 | 3.3V logic version of D6 |
| D9 | 3.3V logic version of D9 | D8 | 3.3V logic version of D8 |
| +3.3V | +3.3V from shield | GND | Ground |
| IO1 | Expansion GPIO1 | IO0 | Expansion GPIO0 |
| D11 | 3.3V logic version of D11 | D13 | 3.3V logic version of D13 |
| IO2 | Expansion GPIO2 | D12 | 3.3V logic version of D12 |
| IO3 | Expansion GPIO3 | D10 | 3.3V logic version of D10 |
| IO5 | Expansion GPIO5 | IO4 | Expansion GPIO4 |
| A0 | 3.3V logic version of A0 | A1 | 3.3V logic version of A1 |
| A2 | 3.3V logic version of A2 | A3 | 3.3V logic version of A3 |
| A4 | 3.3V logic version of A4 | A5 | 3.3V logic version of A5 |
| GND | Ground | GND | Ground |
Arduino board use IOs to emulate parallel bus to access ArduChip internal registers and external LCD registers. User should instantiate the ArduCAM and UTFT class which use parallel bus before the setup routine. The function of each signal list as follows:
| Signals | Functions |
| D[7:0] | Parallel bus data[7:0] |
| A0 | Parallel bus RD, active low |
| A1 | Parallel bus WR, active low |
| A2 | Parallel bus RS |
| A3 | Parallel bus CS, active low |
| A4 | I2CSDA for Camera Module |
| A5 | I2CSCL for Camera Module |
| D10 | LCD chipselect, active low |
| D9 | SD/TF chipselect, active low |
| D11 | SPI MOSI |
| D12 | SPI MISO |
| D13 | SPI SCLK |
The following is a piece of the code for demonstration of the instantiate the ArduCAM and UTFT class.
#define SD_CS 9
//UTFT(byte model, int RS, int WR, int RD, int CS)
UTFT myGLCD(ITDB32S,A2,A1,A0,10);
//ArduCAM(byte model,int RS, int WR, int RD, int CS)
ArduCAM myCAM(OV7670,A2,A1,A0,A3);
void setup()
{
// Setup I2C port
Wire.begin();
if (!SD.begin(SD_CS))
{
while (1);
}
// Setup ArduChip
myCAM.InitCAM();
// Setup the LCD
myGLCD.InitLCD();
ShowStart();
delay(2000);
}
ArduChip is the core of the ArduCAM, which incoperates a Altera MAXII CPLD EPM240 as main processor. The main task of the ArduChip is do the real time DMA transfer between Camera module and the 3.2″ LCD and act as Arduino, Camera and LCD bus multiplexer. It also provides AVR like GPIO expansion, it can be set as input or output and resolve the problem of limited IO resources in Arduino board. The GPIOs can be used as event trigger in and trigger out.
| Address | Name | Mode | Description |
| 0×00 | DDR | R/W | Data Direction RegisterBit[7:6]: ReservedBit[5]: IO5 input/output selectionBit[4]: IO4 input/output selectionBit[3]: IO3 input/output selectionBit[2]: IO2 input/output selectionBit[1]: IO1 input/output selectionBit[0]: IO0 input/output selection1 = output, 0 = input |
| 0×01 | PORT | R/W | OutputPortRegisterThe value will reflect on the Pin IO0~IO6 correspondinglyBit[7:6]: ReservedBit[5]: IO5 output valueBit[4]: IO4 output valueBit[3]: IO3 output valueBit[2]: IO2 output valueBit[1]: IO1 output valueBit[0]: IO0 output value1 = High, 0 = Low |
| 0×03 | MODE | R/W | Bus ModeDetermine who is owner of the data bus, only one owner is allowed.Bit[7:3]: ReservedBit[2]: MCU read LCD busBit[1]: Camera write LCD busBit[0]: MCU write LCD bus |
| 0×80 | PIN | RO | Input Pin RegisterThe value will reflect the IO0~IO6 Pin status correspondinglyBit[7:6]: ReservedBit[5]: IO5 input valueBit[4]: IO4 input valueBit[3]: IO3 input valueBit[2]: IO2 input valueBit[1]: IO1 input valueBit[0]: IO0 input value1 = High, 0 = Low |
| 0×81 | Trigger | RO | Trigger input RegisterBit[7:2]: ReservedBit[1]: Capture button status, 0 = pressed, 1 = releasedBit[0]: Frame start signal, equal to VSYNC |
| 0×82 | Revision ID | RO | Bit[7:6]: Revision integer partBit[5:0]: Revision decimal partFirst revision released ID is 0×40, means V1.00 |
Examples:
ArduCAM GPIO Write demo
// ArduCAM GPIO Write demo (C)2012 Lee
// web: http://www.ArduCAM.com
// This program is a demo of how to use GPIOs in ArduCAM to turn on/off
// LEDs or trigger any ohter devices.
//
// This program requires the ArduCAM library.
//
#include <Wire.h>
#include <ArduCAM.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>
#define ARDUCHIP_DDR 0x00 //GPIO direction register
#define ARDUCHIP_PORT 0x01 //GPIO output register
#define ARDUCHIP_PIN 0x80 //GPIO input register
//ArduCAM(byte model,int RS, int WR, int RD, int CS)
ArduCAM myCAM(OV7670,A2,A1,A0,A3);
//Uncomment if use software serial
SoftwareSerial mySerial(8, 9); // RX, TX
void setup()
{
mySerial.begin(9600);
mySerial.println("hello");
myCAM.write_reg( ARDUCHIP_DDR, 0xff); //Set GPIO as output
}
void loop()
{
uint8_t val = 0xff;
uint8_t read_val;
while(1)
{
delay(1000);
myCAM.write_reg( ARDUCHIP_PORT, val); //Output Register
val = val ^ 0xff; //toggle output value
read_val = myCAM.read_reg(ARDUCHIP_PORT); //Read it back
mySerial.write(read_val);
}
return;
}
ArduCAM GPIO Read demo
// ArduCAM GPIO Read demo (C)2012 Lee
// web: http://www.ArduCAM.com
// This program is a demo of how to use GPIOs in ArduCAM to read
// trigger signals from any ohter devices.
//
// This program requires the ArduCAM library.
//
#include <Wire.h>
#include <ArduCAM.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>
#define ARDUCHIP_DDR 0x00 //GPIO direction register
#define ARDUCHIP_PORT 0x01 //GPIO output register
#define ARDUCHIP_PIN 0x80 //GPIO input register
//ArduCAM(byte model,int RS, int WR, int RD, int CS)
ArduCAM myCAM(OV7670,A2,A1,A0,A3);
//Uncomment if use software serial
SoftwareSerial mySerial(8, 9); // RX, TX
void setup()
{
mySerial.begin(9600);
mySerial.println("hello");
myCAM.write_reg( ARDUCHIP_DDR, 0x00); //Set GPIO as input
}
void loop()
{
uint8_t temp;
while(1)
{
temp = myCAM.read_reg(ARDUCHIP_PIN); //Read from GPIO
mySerial.write(temp); //Send value read from GPIO
delay(1000);
}
return;
}