user8218: I want to capture images from my OV7670 (w/o FIFO) and send it to my PC via Wi-Fi (ESP8266) (which I know how to use) using an Arduino Uno. I have read so many blogs and threads on the internet but couldn't find a simple and exact solution for the problem. I am a newbie in this and all I want is the simple wiring schema, code that can be used with Arduino IDE and the direction on how to proceed.
I found this random code. Please see if I can use it.
    #include <Wire.h>
    #include <Ethernet.h>
    #include <SPI.h>
    uint8_t sensor_addr = 0x42;

    //************ REGISTRADORES **********************//

    #define REG_COM1    0x04    /* Control 1 */

    #define REG_COM7    0x12    /* Control 7 */

    #define   COM7_RESET      0x80    /* Register reset */

    #define   COM7_FMT_MASK   0x38

    #define   COM7_FMT_VGA    0x00

    #define   COM7_FMT_CIF    0x20    /* CIF format */

    #define   COM7_FMT_QVGA   0x10    /* QVGA format */

    #define   COM7_FMT_QCIF   0x08    /* QCIF format */

    #define   COM7_RGB    0x04    /* bits 0 and 2 - RGB format */

    #define   COM7_YUV    0x00    /* YUV */

    #define   COM7_BAYER      0x01    /* Bayer format */

    #define   COM7_PBAYER     0x05    /* "Processed bayer" */

    #define REG_RGB444  0x8c    /* RGB 444 control */

    #define   R444_ENABLE     0x02    /* Turn on RGB444, overrides 5x5 */

    #define   R444_RGBX   0x01    /* Empty nibble at end */

    #define REG_COM9    0x14    /* Control 9  - gain ceiling */

    #define REG_COM10   0x15    /* Control 10 */

    #define REG_COM13   0x3d    /* Control 13 */

    #define   COM13_GAMMA     0x80    /* Gamma enable */

    #define   COM13_UVSAT     0x40    /* UV saturation auto adjustment */

    #define   COM13_UVSWAP    0x01    /* V before U - w/TSLB */

    #define REG_COM15   0x40    /* Control 15 */

    #define   COM15_R10F0     0x00    /* Data range 10 to F0 */

    #define   COM15_R01FE     0x80    /*            01 to FE */

    #define   COM15_R00FF     0xc0    /*            00 to FF */

    #define   COM15_RGB565    0x10    /* RGB565 output */

    #define   COM15_RGB555    0x30    /* RGB555 output */

    #define REG_COM11   0x3b    /* Control 11 */

    #define   COM11_NIGHT     0x80    /* NIght mode enable */

    #define   COM11_NMFR      0x60    /* Two bit NM frame rate */

    #define   COM11_HZAUTO    0x10    /* Auto detect 50/60 Hz */

    #define   COM11_50HZ      0x08    /* Manual 50Hz select */

    #define   COM11_EXP   0x02

    #define REG_COM16   0x41    /* Control 16 */

    #define   COM16_AWBGAIN   0x08    /* AWB gain enable */

    #define REG_COM17       0x42    /* Control 17 */

    #define COM17_AECWIN    0xc0    /* AEC window - must match COM4 */

    #define COM17_CBAR      0x08    /* DSP Color bar */

    #define REG_TSLB    0x3a    /* lots of stuff */

    #define   TSLB_YLAST      0x04    /* UYVY or VYUY - see com13 */

    #define MTX1            0x4f    /* Matrix Coefficient 1 */

    #define MTX2            0x50    /* Matrix Coefficient 2 */

    #define MTX3            0x51    /* Matrix Coefficient 3 */

    #define MTX4            0x52    /* Matrix Coefficient 4 */

    #define MTX5            0x53    /* Matrix Coefficient 5 */

    #define MTX6            0x54    /* Matrix Coefficient 6 */

    #define REG_CONTRAS     0x56    /* Contrast control */

    #define MTXS            0x58    /* Matrix Coefficient Sign */

    #define AWBC7           0x59    /* AWB Control 7 */

    #define AWBC8           0x5a    /* AWB Control 8 */

    #define AWBC9           0x5b    /* AWB Control 9 */

    #define AWBC10          0x5c    /* AWB Control 10 */

    #define AWBC11          0x5d    /* AWB Control 11 */

    #define AWBC12          0x5e    /* AWB Control 12 */

    #define REG_GFIX        0x69    /* Fix gain control */

    #define GGAIN           0x6a    /* G Channel AWB Gain */

    #define DBLV            0x6b    

    #define AWBCTR3         0x6c    /* AWB (Automatic White Balance) Control 3 */

    #define AWBCTR2         0x6d    /* AWB Control 2 */

    #define AWBCTR1         0x6e    /* AWB Control 1 */

    #define AWBCTR0         0x6f    /* AWB Control 0 */

    #define REG_COM8    0x13    /* Control 8 */

    #define   COM8_FASTAEC    0x80    /* Enable fast AGC/AEC (Automatic Gain Control - Automatic Exposure Control)*/

    #define   COM8_AECSTEP    0x40    /* Unlimited AEC step size */

    #define   COM8_BFILT      0x20    /* Band filter enable */

    #define   COM8_AGC    0x04    /* Auto gain enable */

    #define   COM8_AWB    0x02    /* White balance enable */

    #define   COM8_AEC    0x01    /* Auto exposure enable */

    #define REG_COM3        0x0c    /* Control 3 */

    #define COM3_SWAP       0x40    /* Byte swap */

    #define COM3_SCALEEN    0x08    /* Enable scaling */

    #define COM3_DCWEN      0x04    /* Enable downsamp/crop/window */

    #define REG_BRIGHT      0x55    /* Brightness */

    #define REG_COM14      0x3E    

    //*************************************************************************//

    byte mac[] = {
      0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC do arduino
    IPAddress ip(192,168,0,120); // IP do arduino
    byte server[] = {
      192,168,0,105}; //Endereço do servidor



    void setup (){

      DDRC&=~15;//low d0-d3 camera  PORTC (pino A0 ao pino A5) (11110000) A0 a A3 como entrada e A4 (SDA) e A5 (SCL) como saídas - essa linha tem a mesma função de pinMode que declara quem 
      //é pino de saída e de entrada. Se for 0 é entrada e se for 1 é saída. O valor é não 15 (acima).                 
      DDRD&=~255;//d7-d4 and interupt pins PORTD (pino 0 ao pino 7) (0000 d7 ao d4           0=d3=vsync 0=d2=pclock               0=d1=href   1=d0=button)

      DDRB&=~1;

      Serial.begin(57600);
      Wire.begin();

      UCSR0B = (1<<RXEN0)|(1<<TXEN0);//Enable receiver and transmitter (habilita bit 4 e bit 3)

      UCSR0C=6;// B (00000110) async (b7 e b6 = 00); (b3 = 0) 1 stop bit; (b2 e b1 = 1)  8bit char; no parity bits (b5 e b4 = 00); (b0 = 0)clock polaridade

      //set up twi for 100khz
      TWSR&=~3;//disable prescaler for TWI
      TWBR=72;//set to 100khz

      //SET UP CAMERA
      wrReg(0x15,32);//pclk does not toggle on HBLANK COM10 vsync falling
      //wrReg(0x15,0);//pclk does not toggle on HBLANK COM10 vsync falling
      wrReg(REG_RGB444, 0x00);             // Disable RGB444
      wrReg(REG_COM11,226);//enable nigh mode 1/8 frame rate COM11*/
      wrReg(REG_TSLB,0x04);                // 0D = UYVY  04 = YUYV     
      wrReg(REG_COM13,0x88);               // connect to REG_TSLB
      //definição para o RGB 565
      wrReg(REG_COM7, 0x04);           // RGB + color bar disable 
      wrReg(REG_COM15, 0xD0);          // Set rgb565 with Full range    0xD0

        wrReg(REG_COM3,0);    // REG_COM3

      wrReg(0x32,0xb6);        // HREF   
      wrReg(0x17,0x13);        // HSTART
      wrReg(0x18,0x01);        // HSTOP
      wrReg(0x19,0x02);        // VSTART
      wrReg(0x1a,0x7a);        // VSTOP
      wrReg(0x03,0x0a);        // VREF

      wrReg(REG_COM1, 0x00);



      //COLOR SETTING
      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size
      wrReg(0xAA,0x14);            // Average-based AEC algorithm
      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)
      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)
      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration
      wrReg(0xB1,4);//really enable auto black level calibration
      wrReg(MTX1,0x80);        
      wrReg(MTX2,0x80);      
      wrReg(MTX3,0x00);        
      wrReg(MTX4,0x22);        
      wrReg(MTX5,0x5e);        
      wrReg(MTX6,0x80);        
      wrReg(MTXS,0x9e);        
      wrReg(AWBC7,0x88);
      wrReg(AWBC8,0x88);
      wrReg(AWBC9,0x44);
      wrReg(AWBC10,0x67);
      wrReg(AWBC11,0x49);
      wrReg(AWBC12,0x0e);
      wrReg(REG_GFIX,0x00);
      //wrReg(GGAIN,0x40);
      wrReg(AWBCTR3,0x0a);
      wrReg(AWBCTR2,0x55);
      wrReg(AWBCTR1,0x11);
      wrReg(AWBCTR0,0x9f);

      wrReg(0xb0,0x84);//not sure what this does
      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment
      //wrReg(REG_COM16,0);
      wrReg(0x4C,0);//disable denoise
      wrReg(0x76,0);//disable denoise
      wrReg(0x77,0);//disable denoise
      wrReg(0x7B,4);//brighten up shadows a bit end point 4
      wrReg(0x7C,8);//brighten up shadows a bit end point 8
      //wrReg(0x88,238);//darken highligts end point 176
      //wrReg(0x89,211);//try to get more highlight detail
      //wrReg(0x7A,60);//slope
      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC
      //hueSatMatrix(0,100);
      //ov7670_store_cmatrix();
      //wrReg(0x20,12);//set ADC range to 1.5x
      wrReg(REG_COM9,0x6A);//max gain to 128x
      wrReg(0x11,9);//using scaler for divider
      delay(100);//i2c uses interupts to write data wait for all bytes to be written



      //            #ifdef qqvga || ifdef qvga

      wrReg(REG_COM3,4);    // REG_COM3 

      //    #ifdef qqvga

      wrReg(REG_COM14, 0x1a);          // divide by 4

      wrReg(0x72, 0x22);               // downsample by 4

      wrReg(0x73, 0xf2);               // divide by 4

      wrReg(0x17,0x16);

      wrReg(0x1A,0x04);

      wrReg(0x32,0xa4);           

      wrReg(0x19,0x02);

      wrReg(0x18,0x7a);

      wrReg(0x03,0x0a);




      wrReg(REG_COM1, 0x00);

      // COLOR SETTING



      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size

      wrReg(0xAA,0x14);            // Average-based AEC algorithm

      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)

      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)

      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration

      wrReg(0xB1,4);//really enable auto black level calibration

      wrReg(MTX1,0x80);        

      wrReg(MTX2,0x80);      

      wrReg(MTX3,0x00);        

      wrReg(MTX4,0x22);        

      wrReg(MTX5,0x5e);        

      wrReg(MTX6,0x80);        

      wrReg(MTXS,0x9e);        

      wrReg(AWBC7,0x88);

      wrReg(AWBC8,0x88);

      wrReg(AWBC9,0x44);

      wrReg(AWBC10,0x67);

      wrReg(AWBC11,0x49);

      wrReg(AWBC12,0x0e);

      wrReg(REG_GFIX,0x00);

      //wrReg(GGAIN,0x40);

      wrReg(AWBCTR3,0x0a);

      wrReg(AWBCTR2,0x55);

      wrReg(AWBCTR1,0x11);

      wrReg(AWBCTR0,0x9f);



      wrReg(0xb0,0x84);//not sure what this does

      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment

      //wrReg(REG_COM16,0);

      wrReg(0x4C,0);//disable denoise

      wrReg(0x76,0);//disable denoise

      wrReg(0x77,0);//disable denoise

      wrReg(0x7B,4);//brighten up shadows a bit end point 4

        wrReg(0x7C,8);//brighten up shadows a bit end point 8

        //wrReg(0x88,238);//darken highligts end point 176

      //wrReg(0x89,211);//try to get more highlight detail

      //wrReg(0x7A,60);//slope

      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC

      //hueSatMatrix(0,100);

      //ov7670_store_cmatrix();

      //wrReg(0x20,12);//set ADC range to 1.5x

      wrReg(REG_COM9,0x6A);//max gain to 128x

      //    #ifdef qvga

      wrReg(0x11,4);//using scaler for divider

      pinMode(4,OUTPUT);
      digitalWrite(4,HIGH);
      Serial.println("Iniciando conexao");
      Ethernet.begin(mac, ip);
      Serial.println("Por favor, espere.");
      delay(1000);

    }


    EthernetClient client;
    void loop (){

    connectWeb(7000,server);
    foto(480,640);

    }


    byte wrReg(int regID, int regDat )

    { 

      Wire.beginTransmission(sensor_addr >> 1);
      Wire.write(regID & 0x00FF);   
      Wire.write(regDat & 0x00FF);  
      if(Wire.endTransmission())
      {
        return 0; 
        PORTB|=32;
        while (1) {
        }
      }
      delay(1);
      return(1);
    }

    uint16_t d;


    void foto(uint16_t linha, uint16_t coluna)
    { 
      while (!(PIND&8)) {
      }//wait for high
      while ((PIND&8)) {
      }//wait for low
      //uint16_t a =millis(); //teste de tempo
      if (linha != 0)
      {
        //while (!(PINB&1)) {}//wait for high
        //while ((PINB&1)) {}//wait for low
        //while (!(PINB&1)) {}//wait for high

        while (linha--)
        {

          while (!(PIND&4)) {
          }//wait for high
          while ((PIND&4)) {
          }//wait for low
          //      int a = millis(); //teste de tempo

          uint16_t byte1, byte2;
          uint8_t buf[512];

          uint16_t  coluna_temp=coluna;
          while (coluna--){

            for(int i=0; i<2;i++){
              while (!(PIND&4)) {
              }//wait for high
              if(i==0){             
                byte1= (uint8_t)(PINC&15)|(PIND&240); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
              }
              else{
                byte2= (uint8_t)(PINC&15)|(PIND&240);

                //((byte1<<8)|byte2);
               /* for(int x=0;x<512;x++){
                  buf[x]= (((byte1<<8)|byte2),BIN);
                  d+=buf[x];        
                }*/
            sendMsg(client, ((byte1<<8)|byte2));    
                //Serial.println(d);

                // Serial.println(((byte1<<8)|byte2),BIN); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
                //teste++;
              }
              while ((PIND&4)) {
              }//wait for low
            }

          }
          //                                        int b = millis(); //teste de tempo
          //  Serial.println((b-a)); //teste de tempo
          coluna=coluna_temp;
        }

        //while ((PIND&1)) {}//wait for low



      }
      //uint16_t b =millis(); //teste de tempo
      //Serial.println((b-a)); //teste de tempo
     // return teste;

    }



    void connectWeb(int port, byte ipServer[]){

      if (client.connect(ipServer,port)){
        Serial.println("Conectado");
        //essa e a parte que da erro. Perceba que estou enviando a mensagem
        //aqui, mas a intençao e enviar na funcao de tirar a foto.Aqui e teste
       // sendMsg(client, 800);

      }else{
        Serial.println("Conexao falhou");
      }

       if (!client.connected()) {
        Serial.println();
        Serial.println("disconnecting.");
        client.stop();

        // do nothing forevermore:
        while(true);
      }

    }

    //void sendMsg(EthernetClient client, uint8_t msg){
    //      client.println("valor "+String(msg));
    //}

    void sendMsg(EthernetClient client, uint32_t msg){
          client.println(msg,DEC);
    }


user42034: translation from page: http://privateblog.info/arduino-uno-i-kamera-ov7670-primer-ispolzovaniya/ (consult links in the original link as I couldn't post them because I need at least 10 reputation blah blah blah)
Arduino Uno and camera ov7670 - an example of use
(December 15, 2015)
Currently, the ov7670 is the most affordable image acquisition module for Arduino fans. Once it cost about $ 12, now its price dropped to less than $ 5.
ov7670 ( datasheet ) has good opportunities for its price:


different resolution VGA (640 x 480); - QVGA (320 x 240); - CIF (352 x 240); - QCIF (176 × 144);
transmission speed up to 30 fps,
several ways to encode an image RAW RGB, RGB 565/555, YUV / YCbCr 4: 2: 2
interface interaction I2C.


It would be ideal if not for one problem - connecting and getting at least a test image, as in any more or less complex hardware. There are a lot of discussions on the Internet, articles, recommendations, but it's impossible to find clear steps: someone is lazy to write them, someone lays only a diagram or code, somebody does not spread anything at all, but reports only about successful connection. Especially it would be desirable to note ComputerNerd which has laid out fine example with the small description, but for the beginner it is not enough.
This article is intended to show how to connect, configure and get a test image using a small program on java, which will be an excellent starting point for further experiments.
I conducted my experiments on Arduino Uno, as it was best described - connection schemes and articles. There was an attempt to set up on Arduino Mega, but it ended badly. It turned out that on the scaffold A4 and A5 this board already has a reference voltage of 5v, which burned the camera.
In my example, the camera will be used


AtmelStudio + arduino plugin
ov7670 without buffer, operating mode qvga (320 × 240), encoding YUV
Arduino Uno
2 resistors per 10kΩ
2 resistors at 4.7 kΩ
a computer.



Connection scheme for ov7670 to Arduino Uno

Programming the camera needs to start with the correct connection. The voltage of the camera inputs differs from Arduino voltage in places, so resistors are needed.

Connection scheme ov7670 to Arduino Uno

The program for ov7670 and Arduino Uno

To compile the program, we used an example from ComputerNerd, which had to be cut off a bit and then replaced in places. The code can be downloaded from the link .
The basic steps in the code are as follows:

Setting the Arduino Uno PWM, so that it gives out 8mhz on the 11th leg.


DDRB | = (1 << 3); // pin 11 
ASSR & = ~ (_BV (EXCLK) | _BV (AS2)); 
TCCR2A = (1 << COM2A0) | (1 << WGM21) | (1 << WGM20); 
TCCR2B = (1 << WGM22) | (1 << CS20); 
OCR2A = 0; // (F_CPU) / (2 * (X + 1)) 
DDRC & = ~ 15; // low d0-d3 camera 
DDRD & = ~ 252; // d7-d4 and interrupt pins


Configuring the I2C Interface


TWSR & = ~ 3; // disable prescaler for TWI 
TWBR = 72; // set to 100khz


Configuring RS232.


UBRR0H = 0;
UBRR0L = 1; // 0 = 2M baud rate. 1 = 1M baud. 3 = 0.5M. 7 = 250k 207 is 9600 baud rate.
UCSR0A | = 2; // double speed aysnc 
UCSR0B = (1 << RXEN0) | (1 << TXEN0); // Enable receiver and transmitter 
UCSR0C = 6; // async 1 stop bit 8bit char no parity bits


Camera setup


.... 
wrReg (0x12, 0x80); 
delay_ms (100); 
wrSensorRegs8_8 (ov7670_default_regs); 
wrReg (REG_COM10, 32); // PCLK does not toggle on HBLANK. 
...


Obtaining an Image

The operating mode of the image transmission camera was set to YUV. In this case, each pixel is encoded with two bytes. The first byte encodes the gradation of gray, the second - color-difference component.

The task for us is to get at least a black and white image, so the second byte can be discarded.
Next, we need to bring an oscillogram from which it becomes clear what signals we expect with high and low values.

oscillogram ov7670
StringPgm (PSTR ( "* RDY *" ));  

// VSYNC  
while  (! (PIND &  8 )); // wait for high  
while  ((PIND &  8 )); // wait for low  

y = hg;  
while  (y -) {  
   x = wg;  
   while  (x -) {  
      // PCLK  
      while  ((PIND &  4 )); // wait for low  
      UDR0 = (PINC &  15 ) | (PIND &  240 );  
      while  (! (UCSR0A & ( 1  << UDRE0))); // wait for byte to transmit  
      while  (! (PIND &  4 )); // wait for high  
      while  ((PIND &  4 )); // wait for low  
      while  (! (PIND &  4 )); // wait for high  
   }  
}  
_delay_ms ( 100 );  


The program on java to get the image from ov7670 via Arduino Uno

The program for obtaining images is extremely simple. It receives data from the COM9 port using the Java Communication API  and saves it as bmp. All variables are set directly in the code, so you'll have to change it to your own.
grabber

Results

On the basis of the images you can immediately draw a conclusion about the shortcomings: 


The lack of an internal buffer leads to the blurring of the picture, it is immediately transferred to the computer, and this takes time. 
There are artifacts in the form of horizontal stripes - synchronization failure in obtaining a picture. Instead of the gradation of gray sent tsvetraznostnaya component. 
The subject must be in the focus of the camera for a clear image


This article can be finished. Waiting for comments and suggestions.

user15624: You should start from connecting Arduino UNO to PC. For this purpose use the following article: Arduino Uno и камера ov7670 — пример использования. You can disregard the longer text in Russian on top, it discusses why choose exactly this camera.
As listed in that source, the main problems you will find are:

The camera input current is not 100% compatible with the Arduino current. You will need to use resistors. The linked blog includes a schematic how to connect both.

You will need to write code for connecting both. There are examples on the Internet. You can also see the code used in the link. The main gotcha here is that the camera works in YUV mode. Each pixel in that format is coded with two bytes. The first byte codes the grey gradient, the second carries the chroma information. For a simple test, it is sufficient to get a greyscale image, so discard the second byte.


The oscillograms in the linked site show the signal we are expecting, followed by the code needed to read the image information.

The actual program for getting the image can be very simple. The author of the linked article wrote one. It reads from COM9, uses Java communication API and saves in bmp. You can download it here.

This simple test connection has following disadvantages:

Without buffering, the picture smears
There are synchronisation artefacts in the image
You cannot change the focus, the subject has to be kept at the camera's focused distance.


Transferring data via Wi-Fi will be the next step. But it will be hard because Uno and Wi-Fi module are connected via UART interface and maximum speed is limited to 230.4Kbps.
Here is example how to transmit image via bluetooth, Передача картинки с OV7670 через Arduino Uno на Android телефон. It maybe useful to you.
It assumes that you have connected the Arduino and the camera as described above, as step 1.
In step 2, you have to solve the problem of speed mismatch. The HC-06 UART interface and the Arduino Uno have following speeds:

HC-06: 1200 / 2400 / 4800 / 9600 / 19200 / 38400 / 57600 / 115200 / 230400 / 460800 / 921600 / 1382400
Arduino Uno: 2400 / 4800 / 9600 / 14400 / 19200 / 28800 / 38400 / 57600 / 76800 / 115200 / 230400 / 250000 / 500000 / 1000000 / 2000000

The maximum speed common to both is 230400, so you have to use that. You then need to reduce the internal processing speed with wrReg(0x11, 31);. You still cannot send at 230400, because the picture is sent in two steps, first the even rows, then the odd ones. You have to write the Arduino application to capture the image.
Finally, you can write the phone software. It only has to read the picture and show it on the page, nothing more. On a Bluetooth 2.1, the blog author measured more than 1 minute per frame, and the result was highly distorted. On Bluetooth 4.0, the picture quality was acceptable, and sending took less than 15 sec per frame.

8218: <p>I want to capture images from my OV7670 (w/o FIFO) and send it to my PC via Wi-Fi (ESP8266) (which I know how to use) using an Arduino Uno. I have read so many blogs and threads on the internet but couldn't find a simple and exact solution for the problem. I am a newbie in this and all I want is the simple wiring schema, code that can be used with Arduino IDE and the direction on how to proceed.</p>

<p>I found this random code. Please see if I can use it.</p>

<pre><code>    #include &lt;Wire.h&gt;
    #include &lt;Ethernet.h&gt;
    #include &lt;SPI.h&gt;
    uint8_t sensor_addr = 0x42;

    //************ REGISTRADORES **********************//

    #define REG_COM1    0x04    /* Control 1 */

    #define REG_COM7    0x12    /* Control 7 */

    #define   COM7_RESET      0x80    /* Register reset */

    #define   COM7_FMT_MASK   0x38

    #define   COM7_FMT_VGA    0x00

    #define   COM7_FMT_CIF    0x20    /* CIF format */

    #define   COM7_FMT_QVGA   0x10    /* QVGA format */

    #define   COM7_FMT_QCIF   0x08    /* QCIF format */

    #define   COM7_RGB    0x04    /* bits 0 and 2 - RGB format */

    #define   COM7_YUV    0x00    /* YUV */

    #define   COM7_BAYER      0x01    /* Bayer format */

    #define   COM7_PBAYER     0x05    /* "Processed bayer" */

    #define REG_RGB444  0x8c    /* RGB 444 control */

    #define   R444_ENABLE     0x02    /* Turn on RGB444, overrides 5x5 */

    #define   R444_RGBX   0x01    /* Empty nibble at end */

    #define REG_COM9    0x14    /* Control 9  - gain ceiling */

    #define REG_COM10   0x15    /* Control 10 */

    #define REG_COM13   0x3d    /* Control 13 */

    #define   COM13_GAMMA     0x80    /* Gamma enable */

    #define   COM13_UVSAT     0x40    /* UV saturation auto adjustment */

    #define   COM13_UVSWAP    0x01    /* V before U - w/TSLB */

    #define REG_COM15   0x40    /* Control 15 */

    #define   COM15_R10F0     0x00    /* Data range 10 to F0 */

    #define   COM15_R01FE     0x80    /*            01 to FE */

    #define   COM15_R00FF     0xc0    /*            00 to FF */

    #define   COM15_RGB565    0x10    /* RGB565 output */

    #define   COM15_RGB555    0x30    /* RGB555 output */

    #define REG_COM11   0x3b    /* Control 11 */

    #define   COM11_NIGHT     0x80    /* NIght mode enable */

    #define   COM11_NMFR      0x60    /* Two bit NM frame rate */

    #define   COM11_HZAUTO    0x10    /* Auto detect 50/60 Hz */

    #define   COM11_50HZ      0x08    /* Manual 50Hz select */

    #define   COM11_EXP   0x02

    #define REG_COM16   0x41    /* Control 16 */

    #define   COM16_AWBGAIN   0x08    /* AWB gain enable */

    #define REG_COM17       0x42    /* Control 17 */

    #define COM17_AECWIN    0xc0    /* AEC window - must match COM4 */

    #define COM17_CBAR      0x08    /* DSP Color bar */

    #define REG_TSLB    0x3a    /* lots of stuff */

    #define   TSLB_YLAST      0x04    /* UYVY or VYUY - see com13 */

    #define MTX1            0x4f    /* Matrix Coefficient 1 */

    #define MTX2            0x50    /* Matrix Coefficient 2 */

    #define MTX3            0x51    /* Matrix Coefficient 3 */

    #define MTX4            0x52    /* Matrix Coefficient 4 */

    #define MTX5            0x53    /* Matrix Coefficient 5 */

    #define MTX6            0x54    /* Matrix Coefficient 6 */

    #define REG_CONTRAS     0x56    /* Contrast control */

    #define MTXS            0x58    /* Matrix Coefficient Sign */

    #define AWBC7           0x59    /* AWB Control 7 */

    #define AWBC8           0x5a    /* AWB Control 8 */

    #define AWBC9           0x5b    /* AWB Control 9 */

    #define AWBC10          0x5c    /* AWB Control 10 */

    #define AWBC11          0x5d    /* AWB Control 11 */

    #define AWBC12          0x5e    /* AWB Control 12 */

    #define REG_GFIX        0x69    /* Fix gain control */

    #define GGAIN           0x6a    /* G Channel AWB Gain */

    #define DBLV            0x6b    

    #define AWBCTR3         0x6c    /* AWB (Automatic White Balance) Control 3 */

    #define AWBCTR2         0x6d    /* AWB Control 2 */

    #define AWBCTR1         0x6e    /* AWB Control 1 */

    #define AWBCTR0         0x6f    /* AWB Control 0 */

    #define REG_COM8    0x13    /* Control 8 */

    #define   COM8_FASTAEC    0x80    /* Enable fast AGC/AEC (Automatic Gain Control - Automatic Exposure Control)*/

    #define   COM8_AECSTEP    0x40    /* Unlimited AEC step size */

    #define   COM8_BFILT      0x20    /* Band filter enable */

    #define   COM8_AGC    0x04    /* Auto gain enable */

    #define   COM8_AWB    0x02    /* White balance enable */

    #define   COM8_AEC    0x01    /* Auto exposure enable */

    #define REG_COM3        0x0c    /* Control 3 */

    #define COM3_SWAP       0x40    /* Byte swap */

    #define COM3_SCALEEN    0x08    /* Enable scaling */

    #define COM3_DCWEN      0x04    /* Enable downsamp/crop/window */

    #define REG_BRIGHT      0x55    /* Brightness */

    #define REG_COM14      0x3E    

    //*************************************************************************//

    byte mac[] = {
      0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC do arduino
    IPAddress ip(192,168,0,120); // IP do arduino
    byte server[] = {
      192,168,0,105}; //Endereço do servidor



    void setup (){

      DDRC&amp;=~15;//low d0-d3 camera  PORTC (pino A0 ao pino A5) (11110000) A0 a A3 como entrada e A4 (SDA) e A5 (SCL) como saídas - essa linha tem a mesma função de pinMode que declara quem 
      //é pino de saída e de entrada. Se for 0 é entrada e se for 1 é saída. O valor é não 15 (acima).                 
      DDRD&amp;=~255;//d7-d4 and interupt pins PORTD (pino 0 ao pino 7) (0000 d7 ao d4           0=d3=vsync 0=d2=pclock               0=d1=href   1=d0=button)

      DDRB&amp;=~1;

      Serial.begin(57600);
      Wire.begin();

      UCSR0B = (1&lt;&lt;RXEN0)|(1&lt;&lt;TXEN0);//Enable receiver and transmitter (habilita bit 4 e bit 3)

      UCSR0C=6;// B (00000110) async (b7 e b6 = 00); (b3 = 0) 1 stop bit; (b2 e b1 = 1)  8bit char; no parity bits (b5 e b4 = 00); (b0 = 0)clock polaridade

      //set up twi for 100khz
      TWSR&amp;=~3;//disable prescaler for TWI
      TWBR=72;//set to 100khz

      //SET UP CAMERA
      wrReg(0x15,32);//pclk does not toggle on HBLANK COM10 vsync falling
      //wrReg(0x15,0);//pclk does not toggle on HBLANK COM10 vsync falling
      wrReg(REG_RGB444, 0x00);             // Disable RGB444
      wrReg(REG_COM11,226);//enable nigh mode 1/8 frame rate COM11*/
      wrReg(REG_TSLB,0x04);                // 0D = UYVY  04 = YUYV     
      wrReg(REG_COM13,0x88);               // connect to REG_TSLB
      //definição para o RGB 565
      wrReg(REG_COM7, 0x04);           // RGB + color bar disable 
      wrReg(REG_COM15, 0xD0);          // Set rgb565 with Full range    0xD0

        wrReg(REG_COM3,0);    // REG_COM3

      wrReg(0x32,0xb6);        // HREF   
      wrReg(0x17,0x13);        // HSTART
      wrReg(0x18,0x01);        // HSTOP
      wrReg(0x19,0x02);        // VSTART
      wrReg(0x1a,0x7a);        // VSTOP
      wrReg(0x03,0x0a);        // VREF

      wrReg(REG_COM1, 0x00);



      //COLOR SETTING
      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size
      wrReg(0xAA,0x14);            // Average-based AEC algorithm
      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)
      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)
      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration
      wrReg(0xB1,4);//really enable auto black level calibration
      wrReg(MTX1,0x80);        
      wrReg(MTX2,0x80);      
      wrReg(MTX3,0x00);        
      wrReg(MTX4,0x22);        
      wrReg(MTX5,0x5e);        
      wrReg(MTX6,0x80);        
      wrReg(MTXS,0x9e);        
      wrReg(AWBC7,0x88);
      wrReg(AWBC8,0x88);
      wrReg(AWBC9,0x44);
      wrReg(AWBC10,0x67);
      wrReg(AWBC11,0x49);
      wrReg(AWBC12,0x0e);
      wrReg(REG_GFIX,0x00);
      //wrReg(GGAIN,0x40);
      wrReg(AWBCTR3,0x0a);
      wrReg(AWBCTR2,0x55);
      wrReg(AWBCTR1,0x11);
      wrReg(AWBCTR0,0x9f);

      wrReg(0xb0,0x84);//not sure what this does
      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment
      //wrReg(REG_COM16,0);
      wrReg(0x4C,0);//disable denoise
      wrReg(0x76,0);//disable denoise
      wrReg(0x77,0);//disable denoise
      wrReg(0x7B,4);//brighten up shadows a bit end point 4
      wrReg(0x7C,8);//brighten up shadows a bit end point 8
      //wrReg(0x88,238);//darken highligts end point 176
      //wrReg(0x89,211);//try to get more highlight detail
      //wrReg(0x7A,60);//slope
      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC
      //hueSatMatrix(0,100);
      //ov7670_store_cmatrix();
      //wrReg(0x20,12);//set ADC range to 1.5x
      wrReg(REG_COM9,0x6A);//max gain to 128x
      wrReg(0x11,9);//using scaler for divider
      delay(100);//i2c uses interupts to write data wait for all bytes to be written



      //            #ifdef qqvga || ifdef qvga

      wrReg(REG_COM3,4);    // REG_COM3 

      //    #ifdef qqvga

      wrReg(REG_COM14, 0x1a);          // divide by 4

      wrReg(0x72, 0x22);               // downsample by 4

      wrReg(0x73, 0xf2);               // divide by 4

      wrReg(0x17,0x16);

      wrReg(0x1A,0x04);

      wrReg(0x32,0xa4);           

      wrReg(0x19,0x02);

      wrReg(0x18,0x7a);

      wrReg(0x03,0x0a);




      wrReg(REG_COM1, 0x00);

      // COLOR SETTING



      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size

      wrReg(0xAA,0x14);            // Average-based AEC algorithm

      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)

      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)

      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration

      wrReg(0xB1,4);//really enable auto black level calibration

      wrReg(MTX1,0x80);        

      wrReg(MTX2,0x80);      

      wrReg(MTX3,0x00);        

      wrReg(MTX4,0x22);        

      wrReg(MTX5,0x5e);        

      wrReg(MTX6,0x80);        

      wrReg(MTXS,0x9e);        

      wrReg(AWBC7,0x88);

      wrReg(AWBC8,0x88);

      wrReg(AWBC9,0x44);

      wrReg(AWBC10,0x67);

      wrReg(AWBC11,0x49);

      wrReg(AWBC12,0x0e);

      wrReg(REG_GFIX,0x00);

      //wrReg(GGAIN,0x40);

      wrReg(AWBCTR3,0x0a);

      wrReg(AWBCTR2,0x55);

      wrReg(AWBCTR1,0x11);

      wrReg(AWBCTR0,0x9f);



      wrReg(0xb0,0x84);//not sure what this does

      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment

      //wrReg(REG_COM16,0);

      wrReg(0x4C,0);//disable denoise

      wrReg(0x76,0);//disable denoise

      wrReg(0x77,0);//disable denoise

      wrReg(0x7B,4);//brighten up shadows a bit end point 4

        wrReg(0x7C,8);//brighten up shadows a bit end point 8

        //wrReg(0x88,238);//darken highligts end point 176

      //wrReg(0x89,211);//try to get more highlight detail

      //wrReg(0x7A,60);//slope

      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC

      //hueSatMatrix(0,100);

      //ov7670_store_cmatrix();

      //wrReg(0x20,12);//set ADC range to 1.5x

      wrReg(REG_COM9,0x6A);//max gain to 128x

      //    #ifdef qvga

      wrReg(0x11,4);//using scaler for divider

      pinMode(4,OUTPUT);
      digitalWrite(4,HIGH);
      Serial.println("Iniciando conexao");
      Ethernet.begin(mac, ip);
      Serial.println("Por favor, espere.");
      delay(1000);

    }


    EthernetClient client;
    void loop (){

    connectWeb(7000,server);
    foto(480,640);

    }


    byte wrReg(int regID, int regDat )

    { 

      Wire.beginTransmission(sensor_addr &gt;&gt; 1);
      Wire.write(regID &amp; 0x00FF);   
      Wire.write(regDat &amp; 0x00FF);  
      if(Wire.endTransmission())
      {
        return 0; 
        PORTB|=32;
        while (1) {
        }
      }
      delay(1);
      return(1);
    }

    uint16_t d;


    void foto(uint16_t linha, uint16_t coluna)
    { 
      while (!(PIND&amp;8)) {
      }//wait for high
      while ((PIND&amp;8)) {
      }//wait for low
      //uint16_t a =millis(); //teste de tempo
      if (linha != 0)
      {
        //while (!(PINB&amp;1)) {}//wait for high
        //while ((PINB&amp;1)) {}//wait for low
        //while (!(PINB&amp;1)) {}//wait for high

        while (linha--)
        {

          while (!(PIND&amp;4)) {
          }//wait for high
          while ((PIND&amp;4)) {
          }//wait for low
          //      int a = millis(); //teste de tempo

          uint16_t byte1, byte2;
          uint8_t buf[512];

          uint16_t  coluna_temp=coluna;
          while (coluna--){

            for(int i=0; i&lt;2;i++){
              while (!(PIND&amp;4)) {
              }//wait for high
              if(i==0){             
                byte1= (uint8_t)(PINC&amp;15)|(PIND&amp;240); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
              }
              else{
                byte2= (uint8_t)(PINC&amp;15)|(PIND&amp;240);

                //((byte1&lt;&lt;8)|byte2);
               /* for(int x=0;x&lt;512;x++){
                  buf[x]= (((byte1&lt;&lt;8)|byte2),BIN);
                  d+=buf[x];        
                }*/
            sendMsg(client, ((byte1&lt;&lt;8)|byte2));    
                //Serial.println(d);

                // Serial.println(((byte1&lt;&lt;8)|byte2),BIN); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
                //teste++;
              }
              while ((PIND&amp;4)) {
              }//wait for low
            }

          }
          //                                        int b = millis(); //teste de tempo
          //  Serial.println((b-a)); //teste de tempo
          coluna=coluna_temp;
        }

        //while ((PIND&amp;1)) {}//wait for low



      }
      //uint16_t b =millis(); //teste de tempo
      //Serial.println((b-a)); //teste de tempo
     // return teste;

    }



    void connectWeb(int port, byte ipServer[]){

      if (client.connect(ipServer,port)){
        Serial.println("Conectado");
        //essa e a parte que da erro. Perceba que estou enviando a mensagem
        //aqui, mas a intençao e enviar na funcao de tirar a foto.Aqui e teste
       // sendMsg(client, 800);

      }else{
        Serial.println("Conexao falhou");
      }

       if (!client.connected()) {
        Serial.println();
        Serial.println("disconnecting.");
        client.stop();

        // do nothing forevermore:
        while(true);
      }

    }

    //void sendMsg(EthernetClient client, uint8_t msg){
    //      client.println("valor "+String(msg));
    //}

    void sendMsg(EthernetClient client, uint32_t msg){
          client.println(msg,DEC);
    }
</code></pre>
 42034: <p>translation from page: <a href="http://privateblog.info/arduino-uno-i-kamera-ov7670-primer-ispolzovaniya/" rel="nofollow noreferrer">http://privateblog.info/arduino-uno-i-kamera-ov7670-primer-ispolzovaniya/</a> (consult links in the original link as I couldn't post them because I need at least 10 reputation blah blah blah)</p>

<p><strong>Arduino Uno and camera ov7670 - an example of use
(December 15, 2015)</strong></p>

<p>Currently, the ov7670 is the most affordable image acquisition module for Arduino fans. Once it cost about $ 12, now its price dropped to less than $ 5.</p>

<p>ov7670 ( datasheet ) has good opportunities for its price:</p>

<blockquote>
  <ol>
  <li><p>different resolution VGA (640 x 480); - QVGA (320 x 240); - CIF (352 x 240); - QCIF (176 × 144);</p></li>
  <li><p>transmission speed up to 30 fps,</p></li>
  <li><p>several ways to encode an image RAW RGB, RGB 565/555, YUV / YCbCr 4: 2: 2</p></li>
  <li><p>interface interaction I2C.</p></li>
  </ol>
</blockquote>

<p>It would be ideal if not for one problem - connecting and getting at least a test image, as in any more or less complex hardware. There are a lot of discussions on the Internet, articles, recommendations, but it's impossible to find clear steps: someone is lazy to write them, someone lays only a diagram or code, somebody does not spread anything at all, but reports only about successful connection. Especially it would be desirable to note ComputerNerd which has laid out fine example with the small description, but for the beginner it is not enough.</p>

<p>This article is intended to show how to connect, configure and get a test image using a small program on java, which will be an excellent starting point for further experiments.</p>

<p>I conducted my experiments on Arduino Uno, as it was best described - connection schemes and articles. There was an attempt to set up on Arduino Mega, but it ended badly. It turned out that on the scaffold A4 and A5 this board already has a reference voltage of 5v, which burned the camera.</p>

<p>In my example, the camera will be used</p>

<blockquote>
  <ul>
  <li><p>AtmelStudio + arduino plugin</p></li>
  <li><p>ov7670 without buffer, operating mode qvga (320 × 240), encoding YUV</p></li>
  <li><p>Arduino Uno</p></li>
  <li><p>2 resistors per 10kΩ</p></li>
  <li><p>2 resistors at 4.7 kΩ</p></li>
  <li><p>a computer.</p></li>
  </ul>
</blockquote>

<ol>
<li>Connection scheme for ov7670 to Arduino Uno</li>
</ol>

<p>Programming the camera needs to start with the correct connection. The voltage of the camera inputs differs from Arduino voltage in places, so resistors are needed.</p>

<p><a href="https://i.stack.imgur.com/r7TsL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r7TsL.jpg" alt="enter image description here"></a></p>

<p>Connection scheme ov7670 to Arduino Uno</p>

<ol start="2">
<li>The program for ov7670 and Arduino Uno</li>
</ol>

<p>To compile the program, we used an example from ComputerNerd, which had to be cut off a bit and then replaced in places. The code can be downloaded from the link .</p>

<p>The basic steps in the code are as follows:</p>

<ol>
<li>Setting the Arduino Uno PWM, so that it gives out 8mhz on the 11th leg.</li>
</ol>

<blockquote>
  <p>DDRB | = (1 &lt;&lt; 3); // pin 11 </p>
  
  <p>ASSR &amp; = ~ (_BV (EXCLK) | _BV (AS2)); </p>
  
  <p>TCCR2A = (1 &lt;&lt; COM2A0) | (1 &lt;&lt; WGM21) | (1 &lt;&lt; WGM20); </p>
  
  <p>TCCR2B = (1 &lt;&lt; WGM22) | (1 &lt;&lt; CS20); </p>
  
  <p>OCR2A = 0; // (F_CPU) / (2 * (X + 1)) </p>
  
  <p>DDRC &amp; = ~ 15; // low d0-d3 camera </p>
  
  <p>DDRD &amp; = ~ 252; // d7-d4 and interrupt pins</p>
</blockquote>

<ol start="2">
<li>Configuring the I2C Interface</li>
</ol>

<blockquote>
  <p>TWSR &amp; = ~ 3; // disable prescaler for TWI </p>
  
  <p>TWBR = 72; // set to 100khz</p>
</blockquote>

<ol start="3">
<li>Configuring RS232.</li>
</ol>

<blockquote>
  <p>UBRR0H = 0;</p>
  
  <p>UBRR0L = 1; // 0 = 2M baud rate. 1 = 1M baud. 3 = 0.5M. 7 = 250k 207 is 9600 baud rate.</p>
  
  <p>UCSR0A | = 2; // double speed aysnc </p>
  
  <p>UCSR0B = (1 &lt;&lt; RXEN0) | (1 &lt;&lt; TXEN0); // Enable receiver and transmitter </p>
  
  <p>UCSR0C = 6; // async 1 stop bit 8bit char no parity bits</p>
</blockquote>

<ol start="4">
<li>Camera setup</li>
</ol>

<blockquote>
  <p>.... </p>
  
  <p>wrReg (0x12, 0x80); </p>
  
  <p>delay_ms (100); </p>
  
  <p>wrSensorRegs8_8 (ov7670_default_regs); </p>
  
  <p>wrReg (REG_COM10, 32); // PCLK does not toggle on HBLANK. </p>
  
  <p>...</p>
</blockquote>

<ol start="5">
<li>Obtaining an Image</li>
</ol>

<p>The operating mode of the image transmission camera was set to YUV. In this case, each pixel is encoded with two bytes. The first byte encodes the gradation of gray, the second - color-difference component.</p>

<p><a href="https://i.stack.imgur.com/grxzk.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/grxzk.gif" alt="enter image description here"></a></p>

<p>The task for us is to get at least a black and white image, so the second byte can be discarded.</p>

<p>Next, we need to bring an oscillogram from which it becomes clear what signals we expect with high and low values.</p>

<p><a href="https://i.stack.imgur.com/eSTbM.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eSTbM.gif" alt="enter image description here"></a></p>

<p>oscillogram ov7670</p>

<pre><code>StringPgm (PSTR ( "* RDY *" ));  

// VSYNC  
while  (! (PIND &amp;  8 )); // wait for high  
while  ((PIND &amp;  8 )); // wait for low  

y = hg;  
while  (y -) {  
   x = wg;  
   while  (x -) {  
      // PCLK  
      while  ((PIND &amp;  4 )); // wait for low  
      UDR0 = (PINC &amp;  15 ) | (PIND &amp;  240 );  
      while  (! (UCSR0A &amp; ( 1  &lt;&lt; UDRE0))); // wait for byte to transmit  
      while  (! (PIND &amp;  4 )); // wait for high  
      while  ((PIND &amp;  4 )); // wait for low  
      while  (! (PIND &amp;  4 )); // wait for high  
   }  
}  
_delay_ms ( 100 );  
</code></pre>

<ol start="3">
<li>The program on java to get the image from ov7670 via Arduino Uno</li>
</ol>

<p>The program for obtaining images is extremely simple. It receives data from the COM9 port using the Java Communication API  and saves it as bmp. All variables are set directly in the code, so you'll have to change it to your own.</p>

<p>grabber</p>

<ol start="4">
<li>Results</li>
</ol>

<p>On the basis of the images you can immediately draw a conclusion about the shortcomings: </p>

<blockquote>
  <ol>
  <li><p>The lack of an internal buffer leads to the blurring of the picture, it is immediately transferred to the computer, and this takes time. </p></li>
  <li><p>There are artifacts in the form of horizontal stripes - synchronization failure in obtaining a picture. Instead of the gradation of gray sent tsvetraznostnaya component. </p></li>
  <li><p>The subject must be in the focus of the camera for a clear image</p></li>
  </ol>
</blockquote>

<p>This article can be finished. Waiting for comments and suggestions.</p>
 15624: <p>You should start from connecting Arduino UNO to PC. For this purpose use the following article: <a href="http://privateblog.info/arduino-uno-i-kamera-ov7670-primer-ispolzovaniya/" rel="nofollow noreferrer">Arduino Uno и камера ov7670 — пример использования</a>. You can disregard the longer text in Russian on top, it discusses why choose exactly this camera.</p>
<p>As listed in that source, the main problems you will find are:</p>
<ol>
<li><p>The camera input current is not 100% compatible with the Arduino current. You will need to use resistors. The linked blog includes a schematic how to connect both.</p>
</li>
<li><p>You will need to write code for connecting both. There are examples on the Internet. You can also see the code used in the link. The main gotcha here is that the camera works in YUV mode. Each pixel in that format is coded with two bytes. The first byte codes the grey gradient, the second carries the chroma information. For a simple test, it is sufficient to get a greyscale image, so discard the second byte.</p>
</li>
</ol>
<p>The oscillograms in the linked site show the signal we are expecting, followed by the code needed to read the image information.</p>
<ol start="3">
<li>The actual program for getting the image can be very simple. The author of the linked article wrote one. It reads from COM9, uses Java communication API and saves in bmp. You can download it <a href="http://privateblog.info/files/FrameGrabber.7z" rel="nofollow noreferrer">here</a>.</li>
</ol>
<p>This simple test connection has following disadvantages:</p>
<ul>
<li>Without buffering, the picture smears</li>
<li>There are synchronisation artefacts in the image</li>
<li>You cannot change the focus, the subject has to be kept at the camera's focused distance.</li>
</ul>
<hr />
<p>Transferring data via Wi-Fi will be the next step. But it will be hard because Uno and Wi-Fi module are connected via UART interface and maximum speed is limited to 230.4Kbps.</p>
<p>Here is example how to transmit image via bluetooth, <a href="http://privateblog.info/peredacha-kartinki-s-ov7670-cherez-arduino-uno-na-android-telefon/" rel="nofollow noreferrer">Передача картинки с OV7670 через Arduino Uno на Android телефон</a>. It maybe useful to you.</p>
<p>It assumes that you have connected the Arduino and the camera as described above, as step 1.</p>
<p>In step 2, you have to solve the problem of speed mismatch. The HC-06 UART interface and the Arduino Uno have following speeds:</p>
<blockquote>
<p>HC-06: 1200 / 2400 / 4800 / 9600 / 19200 / 38400 / 57600 / 115200 / 230400 / 460800 / 921600 / 1382400</p>
<p>Arduino Uno: 2400 / 4800 / 9600 / 14400 / 19200 / 28800 / 38400 / 57600 / 76800 / 115200 / 230400 / 250000 / 500000 / 1000000 / 2000000</p>
</blockquote>
<p>The maximum speed common to both is 230400, so you have to use that. You then need to reduce the internal processing speed with <code>wrReg(0x11, 31);</code>. You still cannot send at 230400, because the picture is sent in two steps, first the even rows, then the odd ones. You have to write the Arduino application to capture the image.</p>
<p>Finally, you can write the phone software. It only has to read the picture and show it on the page, nothing more. On a Bluetooth 2.1, the blog author measured more than 1 minute per frame, and the result was highly distorted. On Bluetooth 4.0, the picture quality was acceptable, and sending took less than 15 sec per frame.</p>
