OV7670_with_AL422B_test

OV7670_with_AL422B_QQVGA_test

Code - http://mbed.org/users/mio/programs/OV7670_with_AL422B_QQVGA_test/

Shop Page : http://www.csun.co.jp/SHOP/2011102801.html (Japanese)

Schematic : http://www.dragonwake.com/download/camera/ov7670_fifo/V2/OV7670_FIFO_SCH_V2.pdf

This camera was introduced with the Japanese hobby magazine "Transistor GIJYUTSU" (2012/3 edition). Two cameras were described by this edition, "Camera TYPE A(No FIFO)" and "Camera TYPE B(with FIFO)".

My program is for "TYPE B" (with FIFO).

--

Memo.

  • SCL line has not PULL UP and series resistor 1K (External pull-up needed)
  • SDA line has internal PULL UP 20K and series resistor 1K


41 comments on OV7670_with_AL422B_test:

17 Feb 2012

SPI TFT LCD Connect test program available

/media/uploads/mio/camtolcd.jpg

Code : http://mbed.org/users/mio/programs/OV7670_with_AL422B_QVGA_LCD_test/

  • Change (from first code)
    • BusIn ==> PortIn
    • QVGA565 and QQVGA565 mode initialization add.
    • vflip,hflip on initialization support.
  • Speed:
    • QVGA Size:
      • Capture 51(ms) [async, wait next frame]
      • FIFO Read & Lcd Out 444(ms)
    • QQVGA Size:
      • Capture 55(ms) [async, wait next frame]
      • FIFO Read & Lcd Out 108(ms)
  • TFT LCD Connection - see note http://mbed.org/users/mio/notebook/spilcd_qvgasample/
    • p40(VOUT) - 3V3
    • p40(VOUT) - TP_CS (for touch panel ctlr /CS KILL)
    • p1(GND) - GND
    • p5(MOSI) - SDI
    • p6(MISO) - SDO (for READ LCD ID ONLY)
    • p7(SCK) - SCK
    • p29 - /CS (* change)
    • p30 - /RESET (* change)
  • Camera Connection
    • p28 - SDA
    • p27 - SCL (pull up to 3V3)
    • p21 - VSYNC
    • p22 - HREF
    • p20 - WEN(FIFO)
    • PortIn(p18,p17,p16,p15,p11,p12,p14,p13) is D7-D0 [Port0,mask = 0x07878000]
    • RRST - p23
    • p24 - OE
    • p25 - RCLK
03 Mar 2013

What will be the camera supply voltage 3.3V or 3V?

03 Mar 2013

Razu Ahmmed wrote:

What will be the camera supply voltage 3.3V or 3V?

Hi, The PCB has LDO from 3.3V , I remember. So the bare OV7670 requires 3.0V.

05 Mar 2013

That is i have to supply 3.3V in the camera module (camera+AL422B) Vin pin(1 no pin)?

05 Mar 2013

Razu Ahmmed wrote:

That is i have to supply 3.3V in the camera module (camera+AL422B) Vin pin(1 no pin)?

Yes. This board requires 3.3V power supply.

04 Apr 2013

Hi,

Is there any way to make this work with a similar camera but without FIFO (AL422B)? If exists some example like that, it would be great.

Thanks

05 Apr 2013

Alekssander Santiago wrote:

Hi,

Is there any way to make this work with a similar camera but without FIFO (AL422B)? If exists some example like that, it would be great.

Thanks

Even if there is no FIFO, I think that it can take in, but I do not have the program.

28 Sep 2013

Can anybody tell whether input of XCLK in ov7670 is square or sinusoidal wave in nature???

Waiting for your answers eagerly !!!!!!!!!!!!

28 Sep 2013

shubham garg wrote:

Can anybody tell whether input of XCLK in ov7670 is square or sinusoidal wave in nature

I think that as long as the XCLK frequency is in tolerance level and at duty 50%, XCLK accept both rectangular wave and sine wave.

24 Dec 2013

Hi! I'm new member, so any boby can tell me what is kit(MCU) this code for? Thanks you!

24 Dec 2013

Le Hieu wrote:

Hi! I'm new member, so any boby can tell me what is kit(MCU) this code for? Thanks you!

 Hi, This code is for LPC1768.

19 Jan 2014

Leonhart231 wrote:

Hi! There are many different versions of this camera. Does yours have an RE pin or an XCK pin? And what did you connect that pin to? Thank you!

Hi, my version's schematic is below.

http://www.dragonwake.com/download/camera/ov7670_fifo/V2/OV7670_FIFO_SCH_V2.pdf

These signals are not used to my understanding.

  • RE controls FIFO's output, but my OV7670 board doesn't use this pin (RE tied low and using OE instead).
  • XCK is probably 24MHz clock *External* input of OV module,but my OV7670 board has internal OSC , so left unconnected.
27 Jan 2014

Hi, I have been struggling with the OV7670 sensor for 2 weeks now! Can you help me get it up and running. I have mixed results, either coming too close to a good picture, or a total distorted picture.

My setup is an Arduino Uno running @ 3.3v 8Mhz. OV Camera module that has FIFO, but the VSYNC is not connected to the WRST pin. I have successfully communicated, read and written to the Camera registers. Reading back from the FIFO is OK, but seems the data is not right and I think mostly due to Register Configuration.

My Camera module has an onboard crystal that shows 12.0000 on the crystal top. so i am guessing it is a 12Mhz.

Thanks for your feedback.

27 Jan 2014

Fadi K wrote:

I have mixed results, either coming too close to a good picture, or a total distorted picture.

Hi,Can you upload "total distorted picture" to somewhere? Although I don't know the cause, the picture may give a hint from someone :-)

27 Jan 2014

here is a picture that I posted on the arduino forums: http://forum.arduino.cc/index.php?topic=159557.msg1559973#msg1559973

above it is the code used to obtain it if it helps shed some light on things.

Thanks

fuyuno sakura wrote:

Hi,Can you upload "total distorted picture" to somewhere? Although I don't know the cause, the picture may give a hint from someone :-)

27 Jan 2014

Hi, Where do you set clock related registers (related "CLKRC" keyword)?

28 Jan 2014

I don't ! In my trials, i found so many different configurations. I was trying them, making changes, trying to understand the datasheet and the actual user experiences...etc.

The CLKRC register (and related regs) didn't make too much sense, and I am running 8Mhz not 16Mhz arduino to add to the complexity! What do you suggest? at this point I am willing to try anything, because I have tried my best to make it work through utilizing the datasheet and understanding previous user's register configurations, all fails!

fuyuno sakura wrote:

Hi, Where do you set clock related registers (related "CLKRC" keyword)?

28 Jan 2014

Fadi K wrote:

at this point I am willing to try anything

How about raising a dividing ratio, supposing it has not tried yet? Set CLKRC to 0x84 0x81 (div by 2) or more..

28 Jan 2014

Will give it a try and report back. Thanks P.S, I think in one of my tries I did set it to 0x80 based on what i was reading online, but it didn't work. will try 0x81/0x84

28 Jan 2014

Thank You!! I have set it to 0x81 and it did work. Camera Lens covered, Color Bar came out correct, i removed the cover and started noticing some issues.

Not sure if it is because i changed the code so many times something is wrong or if it needs more tweaking but at least you got me a good color bar image, that is a step in the right direct.

Thank you again for your time and help, I will comment here if I still have issues, your help is greatly appreciated.

fuyuno sakura wrote:

How about raising a dividing ratio, supposing it has not tried yet? Set CLKRC to 0x84 0x81 (div by 2) or more..

28 Jan 2014

Hi, Fadi K

Congratulations :-)

17 Mar 2014

Hi

When i have test with ov7670 camera without AL422 FIFO, The output is something wrong . The strange is what i have color bar register set to ov7670 camera then the camera's output image is corrupt. The output image is seem like that test pattern color bar mixed with current view in camera. When i have moving camera viewpoint, the ov7670 camera test pattern color bar output image is activated on outside. like this /media/uploads/b49651/afa.jpg

By the way, when i have stuff up ov7670's camera lens, then the ov7670 camera test pattern color bar output image is good. like this /media/uploads/b49651/afa2.jpg

I don't understand why this happen ?

here's register setting..(also this is from yours)

write_i2c(0x12,0x80) ; RESET CAMERA Sleep(200);

write_i2c(REG_CLKRC,0x80); write_i2c(REG_COM11,0x0A) ; write_i2c(REG_TSLB,0x04); write_i2c(REG_COM7,(0x04| 0x02) ) ; write_i2c(REG_RGB444, 0x02); write_i2c(REG_COM15, 0xd0); write_i2c(REG_HSTART,0x16) ; write_i2c(REG_HSTOP,0x04) ; write_i2c(REG_HREF,0x24) ; write_i2c(REG_VSTART,0x02) ; write_i2c(REG_VSTOP,0x7a) ; write_i2c(REG_VREF,0x0a) ; write_i2c(REG_COM10,0x02) ; write_i2c(REG_COM10,0x00) ; write_i2c(REG_COM3, 0x04); write_i2c(REG_COM14, 0x1a); write_i2c(0x72, 0x22); write_i2c(0x73, 0xf2);

COLOR SETTING write_i2c(0x4f,0x80); write_i2c(0x50,0x80); write_i2c(0x51,0x00); write_i2c(0x52,0x22); write_i2c(0x53,0x5e); write_i2c(0x54,0x80); write_i2c(0x56,0x40); write_i2c(0x58,0x9e); write_i2c(0x59,0x88); write_i2c(0x5a,0x88); write_i2c(0x5b,0x44); write_i2c(0x5c,0x67); write_i2c(0x5d,0x49); write_i2c(0x5e,0x0e); write_i2c(0x69,0x00); write_i2c(0x6a,0x40); write_i2c(0x6b,0x0a); write_i2c(0x6c,0x0a); write_i2c(0x6d,0x55); write_i2c(0x6e,0x11); write_i2c(0x6f,0x9f);

write_i2c(0xb0,0x84);

17 Mar 2014

Hi,

Lee Carter wrote:

The strange is what i have color bar register set to ov7670 camera then the camera's output image is corrupt.

Hmm, Fadi, K reported the similar (probably same) issue reported above..

Fadi K wrote:

Camera Lens covered, Color Bar came out correct, i removed the cover and started noticing some issues.

but, I do not have knowledge about Color Bar's strange behaviour, too.

Does someone know about this problem?

18 Mar 2014

Hi Fadi K

i have same problem, did you have solve?

18 Mar 2014

Hi fuyuno sakura.

if you can, could you please check my register setting code by your device?

I just want to know whether device problem or register setting problem.

Could you please let me know please?

18 Mar 2014

Andrew Pavlík wrote:

if you can, could you please check my register setting code by your device?

I decomposed the terminal area with a camera. Since I cannot do a test immediately.

But I search with keyword "OV7670" and "ColorBar", the same problem found - Unless it closes a lens, the color-bar does not come out correctly.

e.g.

http://translate.google.co.jp/translate?hl=ja&sl=auto&tl=en&u=http%3A%2F%2Fhomepage2.nifty.com%2Fyasaka123%2Fother01j.html

When you address the 0x06 0x12, the camera will output a color bar as shown on the screen below.
However, if you do not pitch-dark in the cover to the lens of the camera, it does not come out this way.

(Original In Japanese - http://homepage2.nifty.com/yasaka123/other01j.html)

Spartan-6 and OV7670 (The output image is seem like that test pattern color bar mixed with current view in camera.) http://www.youtube.com/watch?v=4kJ5HZRlZm4

19 Mar 2014

Thank you fuyuno sakura,

Color bar issue is not seem as problem as your post. But my big issue is corrupted part. You can see that above first output image. that is, probably ov7670's hsync length has change depend on outside. so this issue i don't understand. why change? And how am i do for solve this issue.

Thanks

19 Mar 2014

Andrew Pavlík wrote:

probably ov7670's hsync length has change depend on outside

In other words, the hsync length of the chart "VGA timing" go wrong by the light to image sensor?

"VGA timing" chart sample is below:

http://embeddedprogrammer.blogspot.jp/2012/07/hacking-ov7670-camera-module-sccb-cheat.html

This image-corrupt problem occur,even If your camera is not in Color-Bar mode? Did you actually observe hsync singal?

19 Mar 2014

Andrew Pavlík wrote:

In other words, the hsync length of the chart "VGA timing" go wrong by the light to image sensor?

"VGA timing" chart sample is below:

http://embeddedprogrammer.blogspot.jp/2012/07/hacking-ov7670-camera-module-sccb-cheat.html

Actually i don't know what whether this just register setting problem or originally ov7670's vga timing is depend on light.

i will let you know about second question as soon as possible.

20 Mar 2014

Hi I have find new thing in data sheet. In data sheet ov7670, i found HREF and Hsync. As i know still, HREF = Hsync. But probably these are something different.

Also as i know, my ov7670 module has HREF instead Hsync. I don't understand what different between HREF and Hsync.

does anyone knows this?

22 Mar 2014

Hi.

when i have covered ov7670 lenz, Hsync have transitioned.

you can see that.(Sorry mov is xy flipped)

that is above problem is from ov7670.

Also you can find the output image is moving to right from the following captured image..

/media/uploads/b49651/q4.jpg

Does it make sense?

23 Mar 2014

HI I'm using like the following fuyuno sakura code.

void InitQQVGA() { QQVGA RGB444 WriteReg(REG_CLKRC,0x80); WriteReg(REG_COM11,0x0A) ; WriteReg(REG_TSLB,0x04); WriteReg(REG_COM7,0x04) ; WriteReg(REG_RGB444, 0x02); WriteReg(REG_COM15, 0xd0); WriteReg(REG_HSTART,0x16) ; WriteReg(REG_HSTOP,0x04) ; WriteReg(REG_HREF,0x24) ; WriteReg(REG_VSTART,0x02) ; WriteReg(REG_VSTOP,0x7a) ; WriteReg(REG_VREF,0x0a) ; WriteReg(REG_COM10,0x02) ; WriteReg(REG_COM3, 0x04); WriteReg(REG_COM14, 0x1a); WriteReg(0x72, 0x22); WriteReg(0x73, 0xf2);

COLOR SETTING WriteReg(0x4f,0x80); WriteReg(0x50,0x80); WriteReg(0x51,0x00); WriteReg(0x52,0x22); WriteReg(0x53,0x5e); WriteReg(0x54,0x80); WriteReg(0x56,0x40); WriteReg(0x58,0x9e); WriteReg(0x59,0x88); WriteReg(0x5a,0x88); WriteReg(0x5b,0x44); WriteReg(0x5c,0x67); WriteReg(0x5d,0x49); WriteReg(0x5e,0x0e); WriteReg(0x69,0x00); WriteReg(0x6a,0x40); WriteReg(0x6b,0x0a); WriteReg(0x6c,0x0a); WriteReg(0x6d,0x55); WriteReg(0x6e,0x11); WriteReg(0x6f,0x9f);

WriteReg(0xb0,0x84); }

And Here's Result image /media/uploads/b49651/q5.jpg

I dont understand what exactly wrong? Does anyone know how to tuning this issue?

Left image is real image and right image is color pattern.

Also Here's Output image's binary files.

/media/uploads/b49651/1image.dat

/media/uploads/b49651/2image.dat

14 May 2014

Hey everyone!

I am working with ov7670 as well. I got everything done besides registers. I can understand some but many of them don’t make sense as I don’t have knowledge in image processing. I am going to post my results and the only thing I ask is if someone can tell me witch register I should look at or change to get better image =). Thank you in advanced and in case of mistakes sorry for my English. My current settings are: /media/uploads/Leonid/reg_settings.txt

/media/uploads/Leonid/8100.jpg /media/uploads/Leonid/9150.jpg /media/uploads/Leonid/33236.jpg

03 Dec 2014

please tell about capturing frequency of camera ov7670

08 Apr 2016

hi, my ov7670 fifo has 22 pin, and dont have "wen", only have "wr", and "wrst". how to interface to mbed lpc1768, please help!

/media/uploads/lssyczy/qq--20160408132021.png

06 Apr 2017

hello what effect does it have if the SCl pin is not pull up ? (I am using a Nucleo and apparently the camera is getting data but strange data)

10 Apr 2017

Hello How can you set I2c to 50000 (is this possible for LPC1768?) when the standard is 100000?

11 Apr 2017

I am having a similar problem Did you solve it?

Leonid Hamuev wrote:

Hey everyone!

I am working with ov7670 as well. I got everything done besides registers. I can understand some but many of them don’t make sense as I don’t have knowledge in image processing. I am going to post my results and the only thing I ask is if someone can tell me witch register I should look at or change to get better image =). Thank you in advanced and in case of mistakes sorry for my English. My current settings are: /media/uploads/Leonid/reg_settings.txt

/media/uploads/Leonid/8100.jpg /media/uploads/Leonid/9150.jpg /media/uploads/Leonid/33236.jpg

07 Jul 2017

Chen Zhengyang wrote:

hi, my ov7670 fifo has 22 pin, and dont have "wen", only have "wr", and "wrst". how to interface to mbed lpc1768, please help!

/media/uploads/lssyczy/qq--20160408132021.png

Hi,

I have a same camera module as you (22-pin OV7670 with AL422B FIFO), do you know how to interface it with LPC1768 now? Please help me if you know it now. Thank you very much!

25 Jun 2018

XIAOYU WANG wrote:

Chen Zhengyang wrote:

hi, my ov7670 fifo has 22 pin, and dont have "wen", only have "wr", and "wrst". how to interface to mbed lpc1768, please help!

/media/uploads/lssyczy/qq--20160408132021.png

Hi,

I have a same camera module as you (22-pin OV7670 with AL422B FIFO), do you know how to interface it with LPC1768 now? Please help me if you know it now. Thank you very much!

Hi, did you find any solution for the 22-pin version? Thanks!

04 Sep 2018

Mike Spadaru wrote:

XIAOYU WANG wrote:

Chen Zhengyang wrote:

hi, my ov7670 fifo has 22 pin, and dont have "wen", only have "wr", and "wrst". how to interface to mbed lpc1768, please help!

/media/uploads/lssyczy/qq--20160408132021.png

Hi,

I have a same camera module as you (22-pin OV7670 with AL422B FIFO), do you know how to interface it with LPC1768 now? Please help me if you know it now. Thank you very much!

Hi, did you find any solution for the 22-pin version? Thanks!

You can try the schematic available from this site (scroll down after all the detailed images of the module): https://www.hotmcu.com/ov7670-camera-module-with-the-al433-fifo-p-304.html?cPath=7_19

Please log in to post comments.