Have you been told by someone that you an external ram of some sort such as a fifo or spi ram. I admit to thinking that was needed and teliling people they need one or the other (fifo being the better option) but if you just want to send data from the camera to your PC using the arduino you don't need external ram.
Check out this https://github.com/ComputerNerd/ov7670-no-ram-arduino-uno
It requires only the ov7670 without fifo and a way to get 5v to 3.3v no other parts such as spi ram or al422.
Edit: As of 2014-07-05 I have decided to try and improve this initial post. I would like to hear your feedback. I want to try and avoid redundant questions and I think a better writeup in the initial post would be beneficial. Tell me what you think about this post.
When creating this post on the 2013-04-09 I would have never imagined that there would be so much interest in the ov7670.
I am happy that I have enabled so many people to explore the world of image processing introducing people to a valuable and fun concept.What is the ov7670?
Although I think most people who click on this thread know what the ov7670 is, I think it is still good to have an explanation for the people curious about what all the commotion is.
The ov7670 is an image sensor manufactured by Omnivision.
This image sensor is quite old by image sensor standards. According to Omnivision
they started mass production of the sensor in February of 2006.
The image sensor has a resolution of 640x480 and is considered to by Soc meaning it has built in image processing capabilities.Why the ov7670?
I am quite surprised that out of all the sensors available this one has the most success.
I like to play with image sensors of all types not just the ov7670 however the ov7670 seems to spark the most interest in people.
I bought the module because at the time it was (and still is) the lowest cost camera module that you can buy.
The quality you can get from it would be be described as just okay. There are nicer modules you can buy for not much more money if you are looking for quality.What can I do with the ov7670?
The reality is you are limited not only by the sensor but by the processor you are using.
This thread focuses primarily on arduino boards and interfacing the ov7670 to microcontrollers featured on an arduino board. The arduinos that I have used are both based on 8bit AVRs running at 16mhz so that is quite the limitation. I do however welcome discussion of any microcontroller. Do not expect something ridiculous like 30fps 640x480 on the arduino uno.
The original reason that I wanted to use the ov7670 was time lapse purposes.
I could live with the slow speed as all I need was an image every few seconds. However using a faster microcontroller can mean reading pixels faster but remember unoptimized code on a fast microcontroller can be slower than well optimized code on a slower device.
So with all that said: What can I actually do with this sensor? The answer is pretty much anything that does not involve subjecting the sensor to unreasonable conditions or expecting something unreasonable from it like 1000fps full resolution. What attracts me to the idea of a camera module vs just buying a webcam is the fact that I have more control over it. You are able to program it to do various tasks that suite your needs and lots of the automatic stuff on the ov7670 can be overridden if needed.How can I get started?
Read the documentation and check out code that I have written. Also check the code to figure out some aspects of wiring. I have already explained many aspects of wiring. Just read the thread.Where can I get documentation?http://www.electronicaestudio.com/docs/sht001.pdfhttps://github.com/dalmirdasilva/ArduinoCamera/blob/master/CameraAL422B/datasheet/OV7670%20Implementation%20Guide%20%28V1.0%29.pdfhttps://github.com/luckasfb/Development_Documents/blob/master/MTK-Mediatek-Alps-Documents/OV7670%20software%20application%20note.pdf
I however would like to expand this list. If you have ANYTHING from Omnivsion that would help me understand undocumented stuff in regards to the ov7670 I will take it. If you cannot or do not want it to be posted on the internet I will respect that wish fully. I will take anything regarding the ov7670 even a newer version of what I have already. In fact I would take unrelated documentation that comes from Omnivsion. It is nice to have. You never know seemly unrelated documentation might prove to be relevant in non direct ways.Where do you keep up to date code
and here https://github.com/ComputerNerd/arduino-camera-tft
also if you don't have any other parts besides the ov7670 check out https://github.com/ComputerNerd/ov7670-no-ram-arduino-uno
it also contains how to enable pwm to get 8mhz.
I also posted some pastebin links that is old code but it covers some stuff that the code above does notHow I can I help the author?
Responding to you all guys does not happen magically. There are some things you can do to help ensure that I will continue to help you.
1. Give back: Know something that I don't know regarding the ov7670? Post it.
2. Avoid asking repeat questions.
3. Write stuff. Maybe you can explain something better than I can. If that is the case please do such. I am always open to suggestions on how I can improving my writing.
The initial post below the line break is the second revision of my initial post. I had to move the first revision down a post to work around a character limit.
Edit: I now recommend the fifo version over the non-fifo version. However if you have the regular version without the fifo you can still get an image using external spi ram.
If you have the fifo version lots of this is still relevant all except the external ram part and reading pixels.
The reason for using the fifo version is because of faster readout and you can capture a 640x480 images without breaking it up into pieces however to do such you must use raw bayer data.
Also I have since figured out how to generate an 8mhz clock using PWM
Using PWM to generate XCLK has several advantages including:
You don't need a special programmer to set the fuse bits.
You can change the output clock speed the fastest it goes is F_CPU/2 which results in 8mhz in the case of the arduino. However it is best to set it as max speed and use the divider that the ov7670 has.
Also a good way to keep filesize down thus improving transfer speed is to use raw bayer data.
Raw bayer appears to be about the same or better quality as yuv422 but takes half the speed thus doubling transfer speed.
I would recommend you use it instead of yuv422 I have posted new versions that use raw bayer data.
Here is an FAQ of some questions that may come up:
Q: Some arduino outputs a 5v clock but the OV7670 will only accept 3.3v what should I do
A: use a buffer of some sort it just needs to be fast enough to pass the 8mhz signal.
Q: Will the ov7670 accept twi/sccb/i2c (same thing different names) commands without XCLK?
Q: Will I need to buffer any other pins besides the XCLK?
A: No but be sure you have the i2c/twi/sccb lines pulled up to 3.3v instead of 5v or you risk damage to the ov7670
Also don't set any of the pins that go to the ov7670 as output.
Q: where can I get current registers and useful functions for the ov7670?
A: On my github page https://github.com/ComputerNerd/arduino-camera-tft
More specifically here is some stat-up registers here https://github.com/ComputerNerd/arduino-camera-tft/blob/master/ov7670_regs.h
And here are some useful functions here https://github.com/ComputerNerd/arduino-camera-tft/blob/master/twicam.c
also don't forget the header file https://github.com/ComputerNerd/arduino-camera-tft/blob/master/twicam.h
And you will notice that I have vga qvga rgb565 yuv422 defined somewhere else that is here https://github.com/ComputerNerd/arduino-camera-tft/blob/master/config.h
Q: the code you posted runs on the arduino mega but I have an arduino uno what can I do?
A; The functions that setup the camera will also work on the arduino uno and I have posted some code for the arduino uno see the pastebin links below or my github page ov7670-simple (link below)
Q: The code you posted (above) is complex give me something more simple
A: For a while I had this code available I just thought I would make it more obvious that it exists. https://github.com/ComputerNerd/ov7670-simple
Q: The FAQ does not answer my question what should I do
A: try reading through this topic your question might be answered if not post a reply I'd rather that you not send a pm because someone else may have the same question that you do later on.