Assembling the parts


By default, OV7670 module come with pine header at 90 degrees while I need straight ones, so I had to take the original one out and replace with straight ones:

I attached the module to a Lynxmotion bracket using a scrap of thin PCB drilled and a bunch of small screws and spacers and replace the pin header on the OV7670 module:

And this is how they look mounted together:

Advertisements

10 thoughts on “Assembling the parts

  1. hello, i bought 2 cameras but now i realize that i need an additional module to interface to the arduino
    but i see that you wire the camera directly to the arduino
    is this compatible? do you have a schematic/code for this ? or any information that could guide me to achieve this ?
    thx

    • Hi Phillipe, you can connect (almost) anything to Arduino, including this, however, you will need to write your own code to make it work. Please note that using Arduino IDE dedicated functions to handle the IO pins will be very slow. If you do the math: 30 frames per second, each frame in QVGA mode (320 x 240), each pixel use 2 bytes = 30 * 320 * 240 * 2 = 4,608,000 bytes, data you have to read and process, this before even talking about streaming it to a PC.

      Using OV7670 with AL422B module allows you to capture 1 frame up to 640 x 480 (VGA) then you can slowly retrieve the data and stream it to a PC over a serial port. Getting back to your question: yes, can use Arduino, connectivity is pretty simple: SCCB bus can connect to I2C bus and can use I2C/Wire libs in Arduino to control it (see OV7670 datasheet for SCCB signals), then you can connect OE to GND so only RRST (out), RCLK (out), WEN (out) and VSYNC (in) to control AL422B and need to find 8 IO lines for data bus. Using 4 bits instead of 8 will still give you up to 12 bits per pixel or a depth of 4096 colours (is a post on how to achieve this on the blog). There are several posts and lots of comments that covers the code and how AL422B should be controlled, just use search and you may get your answer.

      Unfortunately I do not have an Arduino library for OV7670 and I do not intend to make one due too many limitations, however, I can help with answers if you need. Try to spend some time reading the existing posts and comments, some may already have the answers you are looking for.

      • i actually need one frame at a time and not at 30fps.
        the plan is to send the image to an android phone via usb to use opencv on the image

        but there are stuff that i dont understand, the AL422B runs at 24Mhz, my arduino runs at 16mhz
        do i need to overclock the arduino ? it is an arduino adk board(mega) and the components are smd, i wont be able to change the crystal, i dont even see it on the board

        “The image sensor can be controlled using the Serial Camera Control Bus (SCCB). This is an I2C interface with a maximum clock frequency of 400KHz.’ so it should be working as arduino runs at 16mhz

        i am not shure and i dont see how i could “do the math” since i have no idea, so far, how fast the transfer will go via usb/i2c, nor the time cost of each atmel instruction

        i redefine my own pwm routines via hardware timers but for i2c and serials, i cant change those (maybe specify the speed of usb) but i2c ? i need to check that out

        “see OV7670 datasheet for SCCB signals” well it is also standard built in fo i2c so i’ll use sda and sca, would i have to rewrite arduino functions for i2c to make them faster ?

      • One frame at a time, this is why you need the FIFO chip, this is what i mentioned in my post also (“Using OV7670 with AL422B module allows you to capture 1 frame up to 640 x 480 (VGA) then you can slowly retrieve the data and stream it to a PC over a serial port.”). Your FIFO input is clocked @ 24 Mhz, correct, however, the speed you use to read the data out can be even 1 Hz as long you stop capturing at the end of the frame (WEN) and no WRST is issued (see AL422 data sheet).

        If you read OV7670 data sheet you will see that SCCB/I2C bus is used ONLY to configure the sensor and not for data transfer. The SCCB is actually a 7 bit I2C format and should be able to use I2C library for this I guess, I was using a bitbang code that implements SCCB on 2 standard IO pins as SDA/SCL pins were used to capture the data (PORTA).

        About memory, I thought you already got the hint that is no way to store a frame in Arduino (AT328P, 2 Kbytes RAM) or any other AVR micro controller, you can only read a line or more in a buffer (QVGA line is 240 * 2 = 480 bytes) then stream it over serial line to your application.

        Hope it helps.

  2. besides, where do you put a whole frame in arduino’s memory ?
    it is impossible
    320*240 = 75kbytes and arduino’s memory is not that big
    how do you manage to process frames?

  3. thx mate
    one last question
    the piout of the al422 does not really match the nomenclature of the ov7670
    siod and sioc are the i2c command port
    and pclk xclk are the synchro pins for the ram chip
    right?

    • Not sure what do you mean by that. AL422 is only a FIFO chip, there is no I2C port on it. A 8 bit bus data in, 8 bit bus data out and control for write and read. If you check the schematic of your module (what version you have, v1 or v2?) you will see that all the connections between OV7670 and AL422 are done, you only need to connect the broken out pins to your host system (Arduino in this case). If you do not have a OV7670 module with AL422, then is a complete different story…

      SCCB is only used to control the OV7670 settings through the “registries” as described in the data sheet. Hope this helps

      • Good luck with that one! That is a non-fifo module. Try to look online for AVRcam project, is an extensive document explaining how is working. Basically define 2 external interrupts: one for VSYNC (start frame) and one for HREF (start line) then have to tune your code (use assembler) to match the pixel timing to capture the data, then stream out the data from last pixel per line to first pixel on the next line… Doubt you can manage this using Arduino.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s