I am a new user of Aurdino and want to interface OV7670 camera with aurdino uno which uses i2c mode of communication.I want to check the configuration of the device control registers and set them as per requirement. In this case, OV7670 is my slave device.

How can I access a particular register inside the slave device?(The parameters for commands like wire.begin() etc., include slave address but not the address of the registers inside a slave device.)

  • 1
    I think this belongs on the Arduino SE
    – stefandz
    May 27, 2016 at 13:01
  • @stefandz I am using arduino uno
    – Prajna Sri
    May 27, 2016 at 13:34
  • Thanks - my comment is meant to suggest that this question be migrated to the Arduino StackExchange site.
    – stefandz
    May 27, 2016 at 13:39

2 Answers 2


To communicate with the OV7670:

  • SIOC => SCL (pulled up to 3.3V)
  • SIOD => SDA (pulled up to 3.3V)
  • RESET => 3.3V
  • PWDN => GND
  • XCLK => Clock signal is necessary (at least 10 Mhz)
  • Vcc => 3.3V
  • GND => GND

The XCLK needs at least 10 MHz according to the datasheet, but from other accounts, it seems that's not a hard limit. You can get a 4 MHz clock from the Uno using its timer0; check out this post on how to do it. After this, you can write a small sketch along the lines of:

Wire.write(0x12);  // software reset
delay(500); // wait for reset to complete

Wire.write(0x01);  // u now read from reg 0x01
Wire.requestFrom(0x21, 1);
while (Wire.available() == 0);  //block till u get something
while (Wire.available())
  Serial.println(Wire.read(), HEX);

You can place everything in setup() after including the Wire library and setting up the XCLK clock signal. If all goes well, 80 should be printed in the serial monitor and this will confirm that you're now communicating over the SCCB with the camera.

I should warn you that while others have used the Uno to grab images from the OV7670, the process is moderately complex, especially for a beginner, and it's not what the Uno is intended for; all you'll be able to do is grab frames and pass them on to some TFT screen or your PC and even then you'll get at most 5 fps, I think, with QVGA or QCIF output. You'd be better off with some ARM dev board, one running Linux perhaps. Good luck.


Take a look at the datasheet - that will show you the correct waveforms / transactions for this. However, something like this should work (assuming 8-bit addresses and registers)

// reading

Wire.write(reg); // set address to read from our requested register
Wire.endTransmission(false); // repeated start
Wire.requestFrom(address,(unsigned char)1);  // just a single byte
    // put error code here
readValue = Wire.read();

// writing

    // put error code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.