front OV7670 Camera Demo
Author: J. Bajić
2019 03 29 172747 

This project is demo project for OmniVision OV7670 CMOS VGA camera module. OV7670 image sensor is low voltage CMOS device that provides the full functionality of a single-chip VGA camera and image processor in small footprint package. Camera module can be configured using Serial Camera Control Bus (SCCB) interface, which is equivalent to I2C interface. Through SCCB interface frame rate, image size (VGA, QVGA, CIF, QCIF,...) and format (YUV422, RGB565, RGB888,...) can be configured. Additionally,  all required image processing functions, including exposure and gain control, white balance, color saturation, denoising and more, are also programmable through the SCCB interface. After configuration, camera image can be acquired using 8 bit parallel data interface (D7,...,D0) and appropriate synchronization signals: pixel clock (PCLK), horizontal synchronization signal (HREF/HSYNC) and vertical synchronization signal (VSYNC). In demo bellow, OV7670 camera module is connected to Mikromedia 7 for STM32F7 development board by Mikroelektronika. Mikromedia development board contains STM32F746ZG microcontroller and integrated 7-inch TFT display with touch screen driven by SSD1963 graphics controller and STMPE610 touch controller. I2C2 module is used for camera configuration (SCCB), while digital camera interface or DCMI is used for data (image) acquisition (wiring can be found below and in the image gallery). Using DCMI interface provides a simple, fast and efficient way for frame capturing. For OV7670 camera operation external clock signal (XCLK) needs to be supplied. In this demo XCLK is supplied via LPTIM1 timer module.

ov7670                      mikromedia

Two demo codes are provided below: full and simple. In full demo project STemWin graphical library and Libjpeg are used for building an embedded GUI application for camera module configuration with possibility of reading and writing JPEG image files (JPEG images captured using OV7670 can be found bellow). In simple demo captured images are directly displayed (no GUI).

Demo projects is developed using following STM32 ecosystem:

  1. mikromedia 7 for STM32F7 development board by Mikroelektronika with STM32F746ZG mcu.
  2. STM32CubeMX 5.6.0 initialization code generator by STMicroelectronics.
  3. STM32CubeIDE 1.3.0 Integrated Development Environment for STM32.
  4. STemWin GUI library (SEGGER's emWin library for STM32)
  5. mikroProg v1.5. Mikromedia 7 board has onboard mikroProg programmer and debugger.


  • On mikromedia 7 for STM32F7 board, pins PB6 and PB7 are shared between touch screen controller STMPE610 connected to I2C1 module and camera module wired to DCMI interface (Vsync is on PB7 and D5 is on PB6), so some kind of multiplexing is required. In full demo example this multiplexing is done simply by alternately switching modules and reconfiguring shared pins.
  • Demo supports two image formats: YUV422 and RGB565. However, images captured in RGB565 format have poor quality for unknown reason. Anyhow, images captured in YUV422 are converted to RGB565 prior to displaying 


 - OV7670 datasheet: pdf
 - OV7670 application notepdf
Application note on DCMI interface: pdf
 - Wiring OV7670 to mikromedia 7 for STM32F7: wiring
 - Full demo project with GUI on github: full demo 
 - Simple demo
(no GUI) on github: simple demo
 - Full demo
project on youtube: video


Images captured using OV7670 camera:

  • IMG_0IMG_0
  • IMG_5IMG_5
  • IMG_6IMG_6
  • IMG_4IMG_4
  • IMG_3IMG_3
  • IMG_1IMG_1
  • IMG_2IMG_2


  • 00
  • 11
  • 22
  • 33
  • 44
  • 55
  • 66



© - Faculty of Technical Sciences, Novi Sad, 2016