Let’s see the equipment we used for the purposes of this project:

  1. Zedboard development kit
  2. OV7670 camera module
  3. Petalinux 2015.2
  4. Vivado and SDK 2015.2 (following this compatibility guide)
  5. Ethernet Cable

Camera3

This is our project Block Diagram

DiagramCamera

You can find the instructions on how to establish a connection via Ethernet between your PC and a Zedboard running Petalinux on chapter H and I of this post by embeddedcentric.

Let’s now begin explaining the hardware part of this project which code and Petalinux boot images are available here.

The Hardware

block_camera

First of all we modify the processing system according to the bring up guide for petalinux.

Now to the cameraIp module. We use some of the code of this project by Mike Field and with some additions we managed to add the functionality for the camera to take snapshots. We basically removed the vga part of the code, created the snapshot module and also we modified the top module according to our current specifications. All this modules were packaged in an Axi-4-Lite Ip to work with the processing system. The control signals and the captured image were used in the Axi bus and the camera function signals were made external so as to be connected to the pmod pins of the Zedboard.

The logic part of this Ip works like this:

  1. The control signal of the arm processor arrives
  2. The camera freezes and a snapshot is stored in a Bram of the Ip with the dimensions of 640×480 in 8-bit format.
  3. At every access of the data from the processor, the hardware converts the pixels format to 24-bit(the client uses a 24-bit format to print out the images) and propagates 4 pixels to the output registers.
  4. After a successful image reading a control signal from the processor arrives and the camera unfreezes.

Now the hardware part is completed and we used these steps to create the hardware platform to run petalinux on it.

The Petalinux Server Software

We created the server application to work this way:

  1. The server opens a TCP socket and waits for a connection from the client
  2. When connected it waits for the client request signal to start streaming
  3. When the request signal arrives, the server freezes the image through a control signal sent to the specific address of the cameraIp interface
  4. The server reads the image from the cameraIp interface and stores it in a array
  5. When finished, the image array is sent through the socket port to the client
  6. Unfreezes the camera and waits for another request to run again from step 3

The Client Software

Finally we created a simple application in python which receives the image from the TCP socket port and renders it in a graphical window. We use the pygame library of python to create the image window and update it with the new images from the socket port.