OV7670 with both arduino uno and now mega

I have it working on the MiniPro,

  • but have not finished constructing the Mega Brd model yet.

Hello
How to make ov7670 w/o fifo faster to capture an image? Small resolution is no problem. To learning this device I must learn two programs arduino and pc grabber.
Are everyone try it?

Hi, I'm new to programming and would like a little help.
Can you explain these definitions to me and if these numbers 0, 1 and 2 can be changed? There is some priority for the image type. For example: does VGA have priority over qqvga because it is 0?

#define vga 0
#define qvga 1
#define qqvga 2

I'm using this code: https://gist.github.com/SirTroll/ca6f5e40f06e5b5db9c4257999d36e46

Can someone help me to change the type of image of my programe?
Or something that I'm doing wrong ?

Thank you very much, guys!!

Hi Mr_Arduino

I am trying to connect the IV7670 FIFO version to an arduino and save the taken images to an SD card.
Do you happen to have any infrmation about this? If so, would you mind sharing it with me or the community? felipefernandez96@hotmail.com

Hi,

I could get the B&W images out of OV7670 but not the colored image.
I am using Arduino UNO and a sample code which I got from the following websitehttps://www.instructables.com/id/OV7670-Without-FIFO-Very-Simple-Framecapture-With-/.
Can anyone help me get a colored image.

First post

Mr_arduino:
I also made a data convert that allows you to convert raw data from the camera into a PNG file
GitHub - ComputerNerd/RawCamera-data-converter: This program was made to convert raw data from the ov7670 to a png file. It may also work with other cameras.
For windows users who don't want to bother setting up MinGW here is a windows binary.
RawCamera-data-converter/convert.exe.7z at master · ComputerNerd/RawCamera-data-converter · GitHub

Hi. I've got a OV7670 working with a Arduino Zero with some SPI Ram to act as a frame buffer. I have two issues I can't resolve and wondered if anyone else had hit these.

  1. Colors are super saturated
  2. The image buffer starts ouroffset. I'm waiting for VSYNC and then HREF to drop but I'm always getting the same offset in the data.

ta

Rob

Kind all day. At a forum the question of connection to arduino of the ov7670 FIFO camera (22 pin) was several times brought up. Maybe someone has connected her to arduino. I have ov7670 FIFO + arduino (Uno, Mega) + SD card. I want to connect them (ov7670 and SD) to Arduino. In difference from ov7670 18 and 20 pin ov7670 22pin have conclusions of FIFO_WR, FIFO_WRST, FIFO_RCK, FIFO_OE, FIFO_RRST which I don't know to connect to what pin Arduino. Maybe someone has a scheme of connection ov7670 FIFO+Arduino (Uno, Mega) +SD, also *.ino for work. I apologize for my English. I will be grateful for any information on my question

Pocketmoon / Rob,

pocketmoon:
Hi. I've got a OV7670 working with a Arduino Zero with some SPI Ram to act as a frame buffer. I have two issues I can't resolve and wondered if anyone else had hit these.

  1. Colors are super saturated
  2. The image buffer starts ouroffset. I'm waiting for VSYNC and then HREF to drop but I'm always getting the same offset in the data.

Rob

note: It could be delayed reading of the ov7670 image data - and so over exposure.

  • This could be caused by the additional Spi-Ram code interfering/delaying the Readings.

Do you have a ZIP of the CODE for us to look at ?

Then we can analyze and test it.
I would be glad to try it on my ArduinoZERO.

-> What Mods did you make to the Code ?

hello
my nane is mustafa
I want to ask you a question
I own Arduino Uno
I want to take pictures with the ov7670 camera
then I want to send it via email with ethernet card
Could you help with Cod

please

Well, I turned around and mounted the Ov7670 Camera onto the Arduino DUE Board.

I was having a hard time with the YUV Colors yesterday, only Green and Purple images.
I tried shifting over 1 byte or more, reversing sequence, etc - no luck.

So, I tried GRB422 and converted it into RGB in the Arduino Program , while outputng it onto the UART.
The problem now is : all I see is Black and White.

For example (GRB422 to RGB-Bmp24) :

  • The image below actually includes: Red and Yellow and Green Games on the shelf,
    besides the Yellow Hardwood Floors.

171201-1830_yuv_p0_19_rot90L_b.png

171202_0940_ov7670_p0_2.png

I used the standard Register Settings, both YUV422 and GRB422 modes.

Anybody have any ideas ?

171201-1830_yuv_p0_19_rot90L_b.png

171202_0940_ov7670_p0_2.png

171201-1830_yuv_p0_19_rot90L_b.png

I used these Examples :

http://www.commenthow.com/article/display/13456/0/How+to+connect+OV7670+to+Arduino+Due

http://privateblog.info/arduino-due-i-kamera-ov7670-primer-ispolzovaniya/

I used the following Schematic for wiring :

I would judge, comparing the Code from these to the Uno Example in this Forum,

  • that the Registers are Wrong.

I modified the code, to tell ov7670 to output as RGB565,
and send the data back as a BMP image.
Just save as a BMP when capturing the Serial data.

But, still only Black & White.

Any suggestions ?

ov7670_Bgr565_Cvt_Bmp_Hdr_DueSam_ino.txt (29.6 KB)

The image should be a RAW image not a color image, you have to translate in colour format. There is a bayer filter.
From the first post

Mr_arduino:
I also made a data convert that allows you to convert raw data from the camera into a PNG file
GitHub - ComputerNerd/RawCamera-data-converter: This program was made to convert raw data from the ov7670 to a png file. It may also work with other cameras.

Thanks for the reference !

Actually though, I put a Converter in the Arduino Code.
So, this should work directly from the Serial out to BMP file.

But I only get Black & White Images.

Latest using the RGB565 format :

171210-1850_ov7670_R565_06_rot90L.jpg

171210-2030_ov7670_c1_01_rot90L.jpg

It looks better.
The Red Stick is Red.
But the Green Stick shows as Yellow ... (Red and Green pixels) ?
And the Blue the Stick shows as Green ... (Green pixels) ?
Notice the marble effect on the Fingers.
And, the Blue and Purple (besides Black) background.

Below is a Snapshot of a box of Pastels:

171210-2030_ov7670_c1_03b_rot90L.jpg

171210-2030_ov7670_c1_03c_rot90L.jpg

Pastels don't look too bad.
Left is Browns Column.
Central is Purple, Blue, Greens Column.
Right is Yellow, Orange, Pink, Reds Column.
But the box is Black , why the mixed marble colors again (Blue and Yellow) (- is it reflection) ?

(Code is linked below.)

171210-1850_ov7670_R565_06_rot90L.jpg

Ov7670_Rgb565_Cvt565_Bmp24_Hdr_DueSam_ino.txt (32.8 KB)

171210-2030_ov7670_c1_01_rot90L.jpg

171210-2030_ov7670_c1_03b_rot90L.jpg

171210-2030_ov7670_c1_03c_rot90L.jpg

I tried using the Bayer(888) ,
but I only get back the Black & White again.

I have problem with my camera.
I dont use Arduino. I use Nucleo stm32f446re + DCMI+DMA.
I use XCLK from uC, 16MHz. Frame rate are not important to me
in this level of my work.

I send my framebuffer from uC to PC by UART, previously adding to this header of bitmap.
It is interesting that when I set the QCIF format I get 172x144 format (not 176x144).

// send header of file
 usart2_send('B'); // BM send
 usart2_send('M');

 uint32_t size_of_file=54+bitmap_size; // size of file - 4 bytes

 usart2_send((file_size)&0xFF);
 usart2_send((file_size>>8)&0xFF);
 usart2_send((file_size>>16)&0xFF);
 usart2_send((file_size>>24)&0xFF);

 usart2_send(0); // bfReserved1 bfReserved2 - 4 bytes
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(54); // bfOffBits - 4 bytes
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 // BITMAPINFOHEADER ----------------------------------------------------------------

 usart2_send(40); // biSize (from this to end of header) - 4 bytes
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(width & 0xFF); // biWidth - 4 bytes
 usart2_send((width>>8)& 0xFF);
 usart2_send(0);
 usart2_send(0);

 usart2_send(height & 0xFF); // biHeight - 4 bytes
 usart2_send((height>>8)& 0xFF);
 usart2_send(0);
 usart2_send(0);

 usart2_send(1); // biPlanes - count of color layers - 2 bytes
 usart2_send(0);

 usart2_send(24); // biBitCount - bits/pixel - 2 bytes
 usart2_send(0);
// ------------------------------------------ No important but must by - 24 bytes
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

 usart2_send(0);
 usart2_send(0);
 usart2_send(0);
 usart2_send(0);

Nex I convert my data from RGB565 to RGB888

for (word=0; word<words; word++) // word select
 {
 uint16_t pixel = obraz[word] & 0xFFFF;

 uint8_t red5=((pixel >> 11) & 0x1F);
 uint8_t green5 = ((pixel >> 5) & 0x3F);
 uint8_t blue5=(pixel & 0x1F);

 uint8_t red8 =(red5 << 3) | (red5 >> 2);
 uint8_t green8 =  (green5 << 2) | (green5 >> 4);
 uint8_t blue8 = (blue5 << 3) | (blue5 >> 2);

 usart2_send(blue8);
 usart2_send(green8);
 usart2_send(red8);

 pixel = (obraz[word] & 0xFFFF0000)>>16;

 red5=((pixel >> 11) & 0x1F);
 green5 = ((pixel >> 5) & 0x3F);
 blue5=(pixel & 0x1F);

 red8 =(red5 << 3) | (red5 >> 2);
 green8 =  (green5 << 2) | (green5 >> 4);
 blue8 = (blue5 << 3) | (blue5 >> 2);

 usart2_send(blue8);
 usart2_send(green8);
 usart2_send(red8);
 }

I configure My camera by seting register like this:

cam_send(0x12, 0x80); // reset all CAM


 cam_send(0x0C, 0x08); // enable scaling
 cam_send(0x12, tmp|(1<<3)|(1<<1)|(1<<2)); // GRB,  QCIF, color bar
// cam_send(0x12, tmp|(1<<3)|(1<<2)); // GRB,  QCIF, WITOUT color bar
 cam_send(0x40, 0xD0); //RGB565
// cam_send(0x70,0x3a);
// cam_send(0x71,0xB5);
 cam_send(0xB0, 0x84); // must be to propertly color display
// cam_send(0xB0, 0x8c); // must be to propertly color display
// cam_send(0x42, (1<<3)); //DSP color bar
 cam_send(0x10, (1<<5)); // PCLK does not toggle during horizontal blank

When I enable DSP color bar COM17[3] then I get image:

For my, this lock good, but I'm not sure that colors can overlap. (?)

When disable DSP color bar and enable color bar in register COM7[1]
then I get this:

In this case, I see, that from right bars begins from narrow black bar. But in
my opinion this bar will be wide. All colors are shifted right and rounded.

This makes, that my pictures do not look good. Colors are mishmash.

Where is problem?

I have spent 2 days reading the entire 59 page thread... But I have not seen a clear way to use the internal registers to resize the readout frame.

I have successfully gotten the OV7670 (w/o FIFO) to interface with the UNO, and can receive the data on a PC using the 'instructables' instructions:

I modified my circuit to use the bi-directional level shifters that I found on ebay. (I can't imagine that connecting 5V and 3.3V electronics is a good idea without buffering.) This method works, at least at low pixel rates.

I am even able to rewrite some registers and change the frame size, and intensity.

My goal is create a very low cost camera system. I figure that for the cost of the UNO, the OV7670 (no FIFO), and the level shifters, the price cannot be beat. Also, the UNO board provides regulated 3.3V required for the camera. If someone has other suggestions for cheaper hardware, please comment back.

Now, I would like to readout the frame as 40x30 pixels so that I can actually process a frame of pixels (8-bit intensity, and probably not color) on the UNO. I have seen only 1 reference as to someone getting the 80x60 pixel frame to work (I have not tried it yet).

I realize that I could read in the larger frame, and then aggregate pixels myself, but if the camera can do it natively, why bother.

So if someone has gotten the 40x30 pixel readout to work, please post your register settings.

If you want a smaller resolution size, you might try looking into the Gameboy Cameras.
The GB Cam has aresolution og 100x100 in B&W.
They are easier to use, and can still be found on ebay.