Microcontroller Tutorials

Arduino, Raspberry Pi, PIC, Beaglebone Resources

Arduino Camera (OV7670) Tutorial

Electronics projects like movement and obstacle detection, drones, and robots require a camera for capturing images. I personally recommend using a Raspberry Pi or BeagleBone Black for these kind of projects because the Arduino doesn’t have enough juice to handle the complexities of pictures and, more so, videos. However, if the project doesn’t require a high resolution image then the OV7670 camera module might be for you. This arduino camera tutorial features such camera and how you can use it to capture VGA-sized pictures.

I managed to buy a OV7670 camera module that looks like this:

As you can see, the module has 18 output pins with the following functions:

Some modules contain 16 pins; these lack the RESET and PWON pins. Since I own the 18-pin OV7670 module, the rest of the tutorial will be based on such module.

If you noticed, the OV7670 camera module has a serial data and clock pin. This means that the Arduino can communicate with the module using I2C. Also, the module operates on 3.3 V so if we are to send data to the OV7670 from the Arduino, we must use a voltage divider to bring the level down.

Here is a common wiring diagram used to build an Arduino camera using the OV7670 camera module:

Note that there is no efficient way for the Arduino to display the captured image. What it only does is command the module to take a picture, acquire the image and then send it to a computer via the Arduino’s USB port. Thus, you need to have another application that will display the image from the USB port to your desktop computer.

Here is a code to be used to capture an image using the Arduino and OV7670 camera module:

Note that this code requires the ov7670 library which was originally done by ComputerNerd. Download the library on this repository.

Next, we need a desktop application that will read the image data from the Arduino’s USB port and display it on screen. Download this C/C++ package and run it using G++ for Linux or DevC++ for Windows. Unfortunately, C/C++ programming on desktop computers is beyond the scope of this tutorial so I can’t help you with this further.

Hopefully I’ve helped you in setting up the OV7670 camera module with the Arduino UNO. However, I would still recommend you use more advanced boards like Raspberry Pi or BeagleBone Black to handle images as the Arduino UNO is simply not powerful enough. Check out my tutorial on using a web camera with the Raspberry Pi and create cool projects!

Leave a Reply

Your email address will not be published. Required fields are marked *