projects and ideas

The OV7670 Camera

I recently received the Arduino camera module OV7670 manufactured by Omnivision, which I had ordered on Ebay 4 days ago. It has 18 pins, with a parallel data interface. It looks like this:

OV7670 camera from Omnivision

It is extremely difficult to get it to work with the Arduino Uno, despite several stackExchange questions, Arduino forum threads extending to over 40 pages, several blog posts and GitHub repositories dedicated to this camera module.

It is a 3.3V device, which communicates with the Arduino using an 8 bit parallel data interface and the Serial Camera Control Bus (SCCB) protocol. I inferred that this protocol is similar to the I2C protocol used in the Wii nunchuck and Wii remote IR Camera, apart from several other Arduino compatible sensors. I was also able to gather that for the purpose of wiring it up to the Arduino Uno, considering it a I2C device will suffice.

Front of the OVUNO project

Since I didn’t have a bi-directional logic level converter to convert the voltages from 3.3V to 5V and vice-versa, I found a useful document by Philips, the creators of the I2C protocol, which detailed a method to connect several devices which ran at different voltage levels using two MOSFETs for the logic level conversions. Since I already had the 2N7000 MOSFETs from the Wii IR Camera project, I used them and with the help of the Philips note, I was able to wire the I2C lines. I used 1.5K and 10K resistors to pull them up to logical HIGH voltages.

The original code I used for the Arduino Uno provided for a clock signal for the camera using PWM on pin 11, without which the camera does not send ANY data. Without a clock signal on the XCLK pin, the camera does not work at all. But the output of pin 11 was at the 5V Arduino logic level. To convert it to 3.3V for the XCLK pin, I used a resistive voltage divider with 4.7K and 10K to get ~3.3V. The flaw in this system was that the voltage could vary, ie, oscillate about 3.3V and since even slight variations in the clock signal affected the image, I decided to replace it with an oscillator.

I had an oscillator of 20.025 MHz, to which I attached a 10M resistor in parallel, and used an 18 pF capacitor on each of its legs to ground it. I used a 74AC04 series hex inverter (basically a set of 6 separate NOT gates in one chip) for one NOT gate parallel to the oscillator, and one after this system. I sent the final signal to the XCLK, and it improved the camera frame rate by nearly 20x! Improvement even by this HUGE amount is actually nothing. Initially it was around 0.1 FPS, now it is around 2 FPS…

Anyway, despite all this, and considerable troubleshooting and testing, I was only able to make the camera output a greenish noisy image, which varied reasonably quickly but in a non-understandable way.

I will continue to try and get this working, after which I can use the camera to take pictures programatically.

Sorry I was unable to fix this problem, and I am not able to find the cause either. I would suggest going with a more powerful microprocessor or microcontroller family, or using the ov7670 camera with a FIFO BUFFER, which allows the Arduino to access the stored data at it’s own pace, and data is not streaming to the Arduino faster than it can handle it.