Lab 4
FPGA & Shape Detection
Read The Report


Lab 4


The overall goal for this lab is to build a system that can detect treasurers of different shapes and colors. This consists of the following parts:

  1. From the FPGA’s specifications, what is the maximum size of the buffer you can create? Given that each entry is ___, how many entries large can the RAM be?
  2. The OV7670 offers a variety of pixels formats to sample data. Which of the formats available provides the most info on the base colors making up each pixel?
  3. Given that the input to the VGA adapter is RGB332, how can you convert (downsize) the pixel format from Q2 to be accepted by the VGA module?
  4. Now that you know the downsized memory per pixel (from Q3), you need to know how many you can fit into memory. Which of the predefined resolutions that the OV7670 supports provides the max amount of pixels in an image, given the constrained max size of the buffer (from Q1)? What’s the size of the buffer?
  5. Using the Register Set table on pages 10-23 of the OV7670 datasheet, find the registers you will need to set.
  6. Take a look at the timing diagrams (Fig 5 and 6) on Page 7 (Ignore HSYNC, you won’t use it). Use both diagrams to determine when you should sample your data. (Hint: You only want to sample valid bytes, and each one only once)
  7. Discuss with your entire team, what method you want to use to communicate information from the FPGA to the Arduino. Parallel? Serial?

To begin, we split into two groups of two. Each group progressed through the lab individually, as described below.


GOAL: setup the camera and create an FPGA-Arduino communication protocol

Credit to Kirstin for both schematic diagrams

Camera-to-Arduino power schematic

Camera-to-Arduino I2C schematic

Full system wiring                

Setting up the camera registers

FPGA-to-Arduino communication scheme


GOAL: setup the FPGA to perform shape and color detection

Buffer reader test image

RGB565 timing diagram

VGA frame timing diagram


This video demonstration shows our robot completing all required behaviors: