Here we introduced one VGA camera module, including the communication of camera module and Arduino UNO, the using ways to take photo via camera module, and so on. This is an Arduino camera module, adopted the Surveillance cameras digital image processing, specially designed for image acquisition and processing application, based on TTL communication interface, very convenient to connect with Arduino controller, able to read image and data via UART serial port, and then perform some image processing.
Part 1 General description
This camera module can perform image processing such as AWB (auto white balance), AE (automatic exposure) and AGC (automatic gain control), for the video signal coming from CMOS sensor. What’s more, in fusion of other advanced technology such as image enhancement processing under low illumination, and image noise intelligent forecast and suppress, this module would output high quality digital video signals by standard CCIR656 interface. VC0706 built-in JPEG decoder supported real time encoding for collected image, and external controller can easily read the M – JPEG video streams, achieving the camera design of double stream. VC0706 supported motion detection and OSD display function of screen characters and pattern overlay, capable of self-defining detection area and sensitivity.
Part 2 Test VC0706 camera module
· Step 1 Needed tool for testing
- Hardware:
- SD Module
- Digital key module
- Arduino UNO
- Jumper wire
- USB cable
- VGA camera module
· Step 2 Hardware connection
1. connect the hardware as below:
2. below is the physical diagram:
Step 3 Software use and code programming
- Firstly download the two files of Camera_VC0706_lib and Camera_VC0706_TEST from the Camera Module Code written by ElecFreaks and then unzip it. you also can fine the code at the end of this experiment.
- Put the unzipped file of Camera_VC0706_lib into the Arduino IDE folder of Libraries.
- Open unzipped file of Camera_VC0706_TEST, and the program the code into UNO. The detailed steps are demonstrated as below.
4. click Tools, and then choose the board Arduino UNO.
5. Click Tools / Serial Port. and then choose the corresponding COM number.
6. And then click the button of Programming like Below in red rectangles, program the code into the UNO board until done uploading appears.
7. Finally, open the monitoring serial port as below in red rectangle.
8. When Serial port display the data like demonstrated below, you can press the digital keys to take photo.
9. If photo was taken correctly, the serial port would be displayed as below.
Arduino Code
#include <camera_VC0706.h>
#include <SD.h>
#include <SoftwareSerial.h>
#define chipSelect 10
#if ARDUINO >= 100
SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
#else
NewSoftSerial cameraconnection = NewSoftSerial(2, 3);
#endif
camera_VC0706 cam = camera_VC0706(&cameraconnection);
void setup() {
#if !defined(SOFTWARE_SPI)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if(chipSelect != 53) pinMode(53, OUTPUT); // SS on Mega
#else
if(chipSelect != 10) pinMode(10, OUTPUT); // SS on Uno, etc.
#endif
#endif
pinMode(7,INPUT_PULLUP);
Serial.begin(9600);
Serial.println(“VC0706 Camera test”);
if (!SD.begin(chipSelect)) {
Serial.println(“Card failed, or not present”);
return;
}
if (cam.begin()) {
Serial.println(“Camera Found:”);
} else {
Serial.println(“No camera found?”);
return;
}
char *reply = cam.getVersion();
if (reply == 0) {
Serial.print(“Failed to get version”);
} else {
Serial.println(“—————–“);
Serial.print(reply);
Serial.println(“—————–“);
}
cam.setImageSize(VC0706_640x480);
//cam.setImageSize(VC0706_320x240);
//cam.setImageSize(VC0706_160x120);
uint8_t imgsize = cam.getImageSize();
Serial.print(“Image size: “);
if (imgsize == VC0706_640x480) Serial.println(“640×480”);
if (imgsize == VC0706_320x240) Serial.println(“320×240”);
if (imgsize == VC0706_160x120) Serial.println(“160×120”);
Serial.println(“Get ready !”);
}
void loop() {
if(digitalRead(7)== 0) {
delay(10);
if(digitalRead(7)== 0) {
if (! cam.takePicture())
Serial.println(“Failed to snap!”);
else
Serial.println(“Picture taken!”);
char filename[13];
strcpy(filename, “IMAGE00.JPG”);
for (int i = 0; i < 100; i++) {
filename[5] = ‘0’ + i/10;
filename[6] = ‘0’ + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(filename)) {
break;
}
}
File imgFile = SD.open(filename, FILE_WRITE);
uint16_t jpglen = cam.frameLength();
Serial.print(jpglen, DEC);
Serial.println(” byte image”);
Serial.print(“Writing image to “);
Serial.print(filename);
while (jpglen > 0) {
uint8_t *buffer;
uint8_t bytesToRead = min(32, jpglen);
buffer = cam.readPicture(bytesToRead);
imgFile.write(buffer, bytesToRead);
jpglen -= bytesToRead;
}
imgFile.close();
Serial.println(“…Done!”);
cam.resumeVideo();
}
}
}
The items used in this experiment
المواد المستخدمة في التجربة يمكنكم اضافتها الى سلة مشترياتكم مباشرة من هنا
-
Cameras & Video, Drones & Quadcopters, Input Peripherals, PIC Microchip, Raspberry Pi, Robotic Cars
VGA Camera Module OV7670
Cameras & Video, Drones & Quadcopters, Input Peripherals, PIC Microchip, Raspberry Pi, Robotic CarsVGA Camera Module OV7670
كامرة VGA يمكن استخدامها مع كافة المتحكمات وفي كافة التطبيقات بحجم صوره قدرها 640×480 ودقة 0.3 ميغا بكسل. تعمل بطاقة منخفضة جدا مناسبة لتطبيقات التقاط الصور فقط وتحليلها. تعمل على فولتية تصل لغاية 3 فولت ويمكن برمجتها بشكل مباشر عبر بروتوكول الـ I2C بكل سهولة.SKU: 736