Introduction: Connect Camera to Zedboard
The Zedboard is a powerful hobbyist system on chip with a ARM Coretx-A9 processor and a Xilinx FPGA built in. A great addon for the Zedboard is the OV7670 camera for image and video processing. The OV7670 can output 12 bit RGB in 640x480 resolution at 30 fps and can purchased for less than $20. The OV7670 camera used for this tutorial can be found here.
This tutorial will show you how to connect the OV7670 camera to the Zedboard and stream the camera through the VGA port on the board. The VHDL modules allow for easy interface to the frame information for further image processing.
A datasheet for the OV7670 is attached.
Attachments
Step 1: Import VHDL Code
The first step is to install Vivado 2015 on your computer and create an RTL project using the ZedBoard Zynq Evaluation and Development Kit. Next thing to do is to download all of the VHDL files attached to this step then add them to the project by clicking Add Sources under Project Management. If everything has been added correctly you should see the ov7670_top file under Design Sources and then all of the over various VHDL sources underneath it.
Step 2: Add Block Memory
The frame of the image is stored in a piece of block ram. To add the block ram to the project, click on the IP catalog under Project Manager and search for Block Memory Generator. The settings of the block ram can be seen in the images attached.
Step 3: Add Constraints File
To connect the FPGA to the camera a constraints file defining the inputs and outputs has to be declared. To add the constraints file, click on Add Sources then Add Constraints then import the XCF file connected. After the XCF file is imported the camera has to be connected. The XCF file lists all of the net names of the FPGA pins and the connections to the camera. You must connect the camera pins to the FPGA pins by using the PMOD/Pin table and the PMOD pinout.
Attachments
Step 4: Generate Bitstream
Now the final step is to generate the bit stream by clicking Program and Debug then Generate Bitstream and connect the Zedboard to a monitor through the VGA port. After the bitstream has been generated and uploaded to the FPGA you should see the camera streaming on the monitor. Make sure to take the lens off the camera and to focus the camera!
The implementation guide attached describes the register settings in the camera to change various settings. To change the camera settings the ov7670_registers.vhd file must be edited. To decrease resource utilization, the camera can be changed to output only YUV and record the Y component which would store a greyscale version of the image which would reduce the memory block width from 14 bits to 8 bits.
14 Comments
6 years ago
Hi I was interested in trying this project. When I attempt to synthesize the project I receive an error. Any ideas on how to get around this?
Reply 7 weeks ago
Read the message. You have a port called Addra in the entity and it’s obviously described as (18 downto 0) somewhere, and 17 downto 0 somewhere else… that will either be in the architecture or jus5 possibly the constraints
4 years ago
How to connect power and GND pins? I think there is 1 mistake, JA3 should be connected to Y10. Please confirm.
Reply 7 weeks ago
The PMOD connector has power. Just check the spec for the port - it’s here for the basys3 board https://digilent.com/reference/basys3/refmanual whilst your board might be different, the PMOD pin out is standard.
Question 9 months ago on Step 4
can u please tell how to connect ov7670 camera with zedboard
Answer 7 weeks ago
Look at the code for the top level. The ports in the entity will show you which pin from the camera belongs to what. Cross reference this with the .ucf file or your constraints editor to map the ports to physical pins. (In ISE the constraints use a file ending in .ucf, in Vivado they use the newer .xdc format, but it’s more or less the same thing, although the syntax is different.) Either way, that shows ports to pins. You will need to read the docs for your board to see which Fpga pin is used for which PMOD pin.
3 years ago on Introduction
I don't know how to connect camera OV7670 to the Zedboard? can anyone help me please
4 years ago
Hello!
I am trying to implement the above code on my Zedboard, the camera output is displayed on the board but it isn't very clear! Could anyone please help me with some modified Register settings for the same camera OV7670.
Thank you in advance!
Reply 3 years ago
hello!!!! just adjust the lens of your camera
rotate the lens in anti clock wise till the streaming looks better.
enjoy!!!!!!!!!
Reply 3 years ago
i too implemented the project. but the output is not clear like your output. i've made some changes to the ov7670 register settings..but it is useless... if u find anything useful kindly let me know that modification u made...... thank you.
Question 4 years ago
hi there!!! can anybody share the step by step process for this project...???
thanks in advance
5 years ago
I want use my pc camera for image processing. Please tell me steps to do that.
6 years ago
Can't read the Memory block settings. Pressing Download requires going Premium...
7 years ago
Lots of great info, thanks!