OV7670 Camera + mbed LPC1768 over Ethernet

Introduction

This project is an upgrade of THIS work and it works by taking a image from the ov7670 camera and send it over an ethernet connection to a pc.
You need a camera OV7670 with FIFO buffer and a ethernet connector (I used a SI-60002-F Jack Connector).

4.2 View the images on PC (Software OV7670 Grabber v2.0)

Info!

Is required Microsoft .NET Framework 4.5 or above.

- First you have to press the button "INIT" and set the IP address and Port in a right property box.
In the end you can press the button "Connect" (if the connection is established with success a green ball appear).

- In the right box you can select the Image format and some properties and then press the button "INIT" for initialize the camera.
Now if you press the button "SNAP" the program acquires a image while if you press "GRAB" the program acquires continuously.

- The grab function is limited for the format 160x120. The maximum frame rate is 10FPS.

- If you press the button "Refresh" you can monitor all registers.

5. Commands for OV7670 Grabber

5.1 INIT

The initialization sets the correct registers of the OV7670 sensor.

INIT CMD: "init " + Image_Format + " " + (width * height);

Image_Format = BAW or RGB or YUV or RAW

If the initialization finished with success the mbed return: "OV Init OK".

5.2 SNAP

The snap button send this string: "snap".

The mbed board respond with a Start Condition string: "sRt" followed by the image data.

6. Some important informations

6.1 Image Format

This camera supports various formats, but I will comment only the three that I used:

YUV 4:2:2

The YUV model defines a color space. The Y component determines the brightness of the color, while the U and V components determine the color itself (the chroma). Y ranges from 0 to 255 in digital formats, while U and V range from -128 to 127.
One neat aspect of YUV is that you can throw out the U and V components and get a grey-scale image.

In the YUV 4:2:2 format the U and V channels are shared between two consecutive pixels. Therefore two pixels are composed from 4 bytes, this means that in average each pixel is stored as 2 bytes.

RGB 565

RGB Colorspace is one of the most common colorspaces used today. It is used for many uncompressed image formats and computer displays. In RGB, there are 3 channels, each one indicating how much of a given color the final color has. These channels indicate Redness (R channel), Blueness (B channel), and Greeness (G Channel). Combining these components allows us to make almost any color humans can see.

The RGB565 color format is composed by 5 bits for the red and blue value and 6 bits for the green value.

RAW Bayer

This type of format doesn't have any image processing.

6.2 Oscilloscope Screens

The camera needs 33ms to acquire a 160x120 image and the double time for read and send the frame from FIFO memory to pc over ethernet (screens below).

13 comments on OV7670 Camera + mbed LPC1768 over Ethernet:

Your project is very impressive especially the grabber utility. I am using a DSP processor to capture the image data from Omnivision sensor, and I am transferring the image data using MAC address, I do not know how to implement TCP or UDP protocol and I believe it might make the code at the processor end a little complicated, so I would like to develop a Camera Image Grabber similar to OV7670 Grabber, which recieves the image data based on MAC address, but I am not well versed in VB, so can you please help me out with the development process? or Can you please provide the VB source code for OV7670 Grabber?

Thank you.

Hello,
Your project is very impressive especially the grabber utility. I am using a DSP processor to capture the image data from Omnivision sensor, and I am transferring the image data using MAC address, I do not know how to implement TCP or UDP protocol and I believe it might make the code at the processor end a little complicated, so I would like to develop a Camera Image Grabber similar to OV7670 Grabber, which recieves the image data based on MAC address, but I am not well versed in VB, so can you please help me out with the development process? or Can you please provide the VB source code for OV7670 Grabber?
Thank you.

I would like to thanks cause your project helped myself a lot to understand how ov7670 and mbed works together.

So I analised your code and i have 2 conclusions. The first lost frame is because of latency between each request over tcp. If you put numbering each on frame or line you can solve it. Second you have a fail in your code. I think you need to include Busy=false and done=true in the camera.Readstop() and put all bytes captured inside the "while" in the main.cpp

congratulation, I will do some tests with 7725 too.
bye

I would like to thanks cause your project helped myself a lot to understand how ov7670 and mbed works together.
So I analised your code and i have 2 conclusions. The first lost frame is because of latency between each request over tcp. If you put numbering each on frame or line you can solve it. Second you have a fail in your code. I think you need to include Busy=false and done=true in the camera.Readstop() and put all bytes captured inside the "while" in the main.cpp
congratulation, I will do some tests with 7725 too.
bye

I would like to thanks cause your project helped myself a lot to understand how ov7670 and mbed works together.

So I analised your code and i have 2 conclusions. The first lost frame is because of latency between each request over tcp. If you put numbering each on frame or line you can solve it. Second you have a fail in your code. I think you need to include Busy=false and done=true in the camera.Readstop() and put all bytes captured inside the "while" in the main.cpp

Thanks. Yes the problem is the latency of the tcp but you intend to activate the 'segment numbering' over tcp?

<<quote ashikonmbed>>
but I am not well versed in VB, so can you please help me out with the development process? or Can you please provide the VB source code for OV7670 Grabber?
<</quote>>
Hi Ashik, sorry for the late reply but I didn't see the mail notification of your comment.
The source code of my programm is not open but you can find a lot of example of Tcp communication writen in vb in google..
For example [[http://www.winsocketdotnetworkprogramming.com/clientserversocketnetworkcommunication8chap.html|here]]
<<quote psyco>>
I would like to thanks cause your project helped myself a lot to understand how ov7670 and mbed works together.
So I analised your code and i have 2 conclusions. The first lost frame is because of latency between each request over tcp. If you put numbering each on frame or line you can solve it. Second you have a fail in your code. I think you need to include Busy=false and done=true in the camera.Readstop() and put all bytes captured inside the "while" in the main.cpp
<</quote>>
Thanks. Yes the problem is the latency of the tcp but you intend to activate the 'segment numbering' over tcp?

Hi Edoardo. I will not activate segment numbering over tcp protocol, just include one first byte as control frame, so you dont need start snapshot over and over.. you will send one comand and in your grabber, with field control number information you can synchronize all frames without latency anymore.

Hi Edoardo. I will not activate segment numbering over tcp protocol, just include one first byte as control frame, so you dont need start snapshot over and over.. you will send one comand and in your grabber, with field control number information you can synchronize all frames without latency anymore.

Hi Edoardo. I will not activate segment numbering over tcp protocol, just include one first byte as control frame, so you dont need start snapshot over and over.. you will send one comand and in your grabber, with field control number information you can synchronize all frames without latency anymore.

Hi Fabio, thanks for the advice.
\\
In the next days I will try to understand if in lwip is possible disable the segment numbering..if you have already disabled it you can post the code.
\\
Best regards
<<quote psyco>>
Hi Edoardo. I will not activate segment numbering over tcp protocol, just include one first byte as control frame, so you dont need start snapshot over and over.. you will send one comand and in your grabber, with field control number information you can synchronize all frames without latency anymore.
<</quote>>

At moment I just have your code translated to OV7725 model, so I still didnt have tested because I m waiting for the shippment arrives at my home. But I can send you if you want. I am not planning to do any changes at transport layer of protocol, because your buffer is only 4096 and you still took one frame perfectly , so i will include numbering together with data video, because you can disable 00 and FF and use these bytes to signaling the starting frame/row, and after them you put sequence frame number.

:)

Dear Edoardo,
At moment I just have your code translated to OV7725 model, so I still didnt have tested because I m waiting for the shippment arrives at my home. But I can send you if you want. I am not planning to do any changes at transport layer of protocol, because your buffer is only 4096 and you still took one frame perfectly , so i will include numbering together with data video, because you can disable 00 and FF and use these bytes to signaling the starting frame/row, and after them you put sequence frame number.
:)

I have a question, AL422 datasheet recommend to have WCLK and RCLK running at least at 1MHz at all times. From camera module WCLK is running from OV7670 PCLK, but RCLK is controlled by mbed and by looking at your code I understand that during the byte reading you switch RCLK, and so is irregular in frequency.

I am wondering if some fault can occur by using this approach, instead of using OE and RE control signals.

Best,

Hello Edoardo,
Amazing project!
I have a question, AL422 datasheet recommend to have WCLK and RCLK running at least at 1MHz at all times. From camera module WCLK is running from OV7670 PCLK, but RCLK is controlled by mbed and by looking at your code I understand that during the byte reading you switch RCLK, and so is irregular in frequency.
I am wondering if some fault can occur by using this approach, instead of using OE and RE control signals.
Best,

How long time? I am here to thanks your post, So now I got 40fps with OV7725 + some tricks . Tell me If you want know. Is free for you that helped me a lot. Thanks
mister_bastos@hotmail.com

Hi Edoardo,
How long time? I am here to thanks your post, So now I got 40fps with OV7725 + some tricks . Tell me If you want know. Is free for you that helped me a lot. Thanks
mister_bastos@hotmail.com

Important Information for this Arm website

This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.