Introduction: OV7670 Arduino Camera Sensor Module Framecapture Tutorial

Picture of OV7670 Arduino Camera Sensor Module Framecapture Tutorial

Description

The camera module is powered from a single +3.3V power supply. An external oscillator provide the clock source for camera module XCLK pin. With proper configuration to the camera internal registers via I2C bus, then the camera supply pixel clock (PCLK) and camera data back to the host with synchronize signal like HREF and VSYNC. The OV7670 camera module is a low cost 0.3 mega pixel CMOS color camera module, it can output 640x480 VGA resolution image at 30fps. The OV7670 camera module build in onboard LDO regulator only single 3.3V power needed and can be used in Arduino, STM32,Chipkit, ARM, DSP , FPGA and etc.

Specification

  • Optical size 1/6 inch
  • Resolution 640x480 VGA
  • Onboard regulator, only single 3.3V supply needed
  • Mounted with high quality F1.8 / 6mm lens
  • High sensitivity for low-light operation
  • VarioPixel® method for sub-sampling
  • Automatic image control functions including: Automatic
  • Exposure Control (AEC), Automatic Gain Control (AGC), Automatic White Balance (AWB), Automatic
  • Band Filter (ABF), and Automatic Black-Level Calibration (ABLC)
  • Image quality controls including color saturation, hue, gamma, sharpness (edge enhancement), and anti-blooming
  • ISP includes noise reduction and defect correction
  • Supports LED and flash strobe mode
  • Supports scaling
  • Lens shading correction
  • Flicker (50/60 Hz) auto detection
  • Saturation level auto adjust (UV adjust)
  • Edge enhancement level auto adjust
  • De-noise level auto adjust

Step 1: Material Preparation

Picture of Material Preparation

In this tutorial, you will need :

1. Arduino Uno Board and USB
2. OV7670 Arduino Camera Sensor Module STM32
3.10K resistor X 2
4. 4.7K Resistor X2
5. Breadboard

and you will be using Arduino IDE and Java.

Step 2: Pinout Connection

Picture of Pinout Connection

Connect your circuit as illustrated on the picture above.

Step 3: Java

Picture of Java

You have to download this to be able to interface this camera sensor module on your pc.Open the zip file and install to your computer. By default, this will be install to your c drive in your program files folder. As for mine, it is stored in C:\Program Files\Java\jdk1.8.0_74. You can refer picture above.

NOTE : This jdk-8u74-windows-i586.rar file is quite big.

Step 4: Sample Source Code

Picture of Sample Source Code

This sample source code is originally from this link. Download this sample source code, open it on your Arduino IDE, connect your Arduino Uno Board to your computer and upload it. Select the correct board and port before uploading this source code. Refer image above for help.

NOTE : Don't mind that it does not recognize some libraries in the beginning of the file. If it bothers you, comment the whole line out with //

Step 5: Checking Your Port

Picture of Checking Your Port

Find out what USB port your Arduino is connected to, something like COM4 or COM5. You could check it on your Control Panel > Device Manager > Ports (COM & LPT) > right click > Properties > Port Settings > Advanced > COM Port Number > /Select Your Port Number/. You can refer the image above for help. As for mine, it is port COM5.

Step 6: Com_#.rar

Picture of Com_#.rar

Depending on what port number your Arduino is connected to, download the corresponding file. COM1 = com_1.rar , COM2 = com_2.rar and etc. Open your com#.rar on WinRaR, extract/copy the 'code' folder from com_#.rar, go to Local Disk > Program Files > Java > jdk1.8.0_74 > bin and paste it there. you can refer the picture above for a better understanding.

Step 7: C:\out

Picture of C:\out

You have to create a new folder on your c drive / Local Disk (C:). This will be your camera module sensor's taken picture's destination. Name this folder as out (it could be anything though).

Step 8: Extra.rar

Picture of Extra.rar

1. Download and extract the Extra.rar file below and open it. As you could see, there is src folder, lib folder and "win32com.dll". You have to copy and placed "win32com.dll" in the "C:\Program Files\Java\jdk1.8.0_74\jre\bin" directory.

2. Then, open the lib and you could see the "comm.jar" and "javax.comm.properties" in it. Copy and paste the "comm.jar" in "C:\Program Files\Java\jdk1.8.0_74\jre\lib\ext" and "javax.comm.properties" in the "C:\Program Files\Java\jdk1.8.0_74\jre\lib" directory.

NOTE : it may ask for administrator permission, just proceed anyway.

Step 9: CMD

Picture of CMD

Open cmd and open the folder wherein the code folder is by writing its address. mine is "C:\Program Files\Java\jdk1.8.0_74\bin". Click enter and it will give u "C:\Program Files\Java\jdk1.8.0_74\bin>". Now, write "java code.SimpleRead". It supposed to be like this---> C:\Program Files\Java\jdk1.8.0_74\bin>java code. SimpleRead. You can refer image for help.

Step 10: Result

Picture of Result

You can see the picture taken from your OV7670 Camera Module Sensor in your our folder in c drive.

Step 11: Troubleshooting

Picture of Troubleshooting

1. If your cmd cannot find images, try switching the USB of the arduino from a USB2.0 to a USB3.0 (blue socket) or vice versa.

2 If you receive scrambles pictures, you need to edit the sample source code. Edit line: wrReg(0x11, 12); try changing the 12 to 11/10/9/13. Upload it to the arduino and run the cmd code again.

Comments

jimgarbe (author)2017-04-04

OK, I thought a little graphic might help myself.... maybe not?

JesusG54 (author)jimgarbe2017-09-20

Cool image, but you'll find Fritzing to be a very helpful app for this.

Kunal Gehlot (author)2017-09-03

How to use this in Ubuntu?

FelipeF89 (author)2017-07-18

Hi,

I have managed to get both the FIFO and non-FIFO versions of the OV7670.
Do you know if there is a way of connecting these and saving the pictures to an SD card through the arduino?

Thank you in advanced for your help,

Felipe

BillD120 made it! (author)2017-01-27

Great instructable, thnx! The images are BW - any tips on how to get colour?

thnx

billd

rachithaks (author)BillD1202017-02-13

hi BillD120,

did you figure out how to get color images?

thanks

s_mile (author)rachithaks2017-07-10

HI,

Did you get colored images?

If so could you mention the changes.

BillD120 (author)rachithaks2017-02-15

Hi, no. I haven't had any feedback from the original post, have not been experimenting since. Good lukc!

billd

Hi BillD120! did you just follow the step? did you also use arduino uno or mega?

Hey did you sort the issue?..If yes then please share the solution since I am getting the Similar problem..

Hey BillD120, considering that you used ov7670 and Not vc0706 camera, can you help me in improving my image quality. Since my image from OV7670 is not intact

JimranL made it! (author)2017-06-28

how to solve this problem???

Jairo UzielS (author)2017-06-25

how i can use it whit SD?

adiwori made it! (author)2017-06-15

what's the problem , and how to solve it

DarioC47 (author)2017-01-15

can i use it on arduino mega 2560 board? thanks in advance

AntonioA153 (author)DarioC472017-06-12

of course you can use Arduino Mega 2560, charge the code on the board and make the same wiring, import the libraries as usual and that's all...

Prajwith (author)2017-06-05

Hiii. I am doing future expansion of this type of project, so i have to use Arduino MEGA, so can you suggest me what &all are needed to be modified in above steps? Is there any need to change in circuit?

BokC1 (author)2017-06-01

Hi, I'm struggling with receive scrambles pictures. I had tried edit
line: wrReg(0x11, 12), but i still get scrambles pictures. Do you have
any solutions?

Thanks

ajeet434 (author)2017-04-15

I have also this problem.

How can we solve this problem

Thanks

JianweiA (author)2017-03-23

how to solve this problem???

ajeet434 (author)JianweiA2017-04-15

I have also same issue ,

May anybody solve this problem??

ayoube11 (author)2017-04-04

if someone can help me pls, when i upload the code to the arduino mega this error comes out "

test_camera_ov7670:572: error: ‘void captureImg(uint16_t, uint16_t)’ was
declared ‘extern’ and later ‘static’ [-fpermissive] ". Pls help me
solve this problem .

tysheng123456 (author)2017-04-01

How do i use this camera if i am using mega instead of uno

HamxaK3 (author)2017-03-25

cmd does not find img

plz help

MonkhouseTom (author)HamxaK32017-03-31

Did you ever solve this? Mine does exactly same.

jawad durrani (author)2017-03-25

can i get com7.rar

NikhilM67 (author)2017-03-21

can i get COM6.rar?

dhananjaisrmgpc (author)2017-03-16

Hello mybotic, you tutorial seems to work absolutely fine but my image quality is not good, my image is not intact, I have attached it for reference. What should I change (baud rate) in the code or i should attach a FIFO buffer in the code?

dhananjaisrmgpc (author)2017-03-16

I have edited wrReg(0x11, 12); to Edit line: wrReg(0x11, 13); in order to get this image, any other setting gives lines/blurs the image

rennythomas260394 (author)2017-02-19

the image will not be found

searching for image in cmd

Antum (author)rennythomas2603942017-03-03

I have the same problem. When I run it, it stops blinking for a second and then resumes blinking.

darenjoyballesteros (author)2017-02-28

I also have the same problem with rennythomas260394. How will i fix this?
Is this applicable in arduino mega? Thanks.

MandrilloV (author)2017-02-17

Complimenti per la chiarezza del progetto che ho trovato molto interessante e funzionale. Vorrei chiederti la cortesia, se Ti è possibile, di aggiungere al progetto un lettore di sd card al fine di salvare sulle scheda sd le foto scattate.

Grazie

Franco

MandrilloV (author)2017-02-02

Finalmente delle istruzioni dettagliate e funzionanti.

Complimenti.

Grazie.

Franco

Franco

About This Instructable

52,851views

103favorites

License:

More by mybotic:Tutorial of MP3-TF-16PHow to Make Line Follower RobotColor Sensor
Add instructable to: