RPi Projects/serialJpegCam

From eLinux.org
< RPi Projects
Revision as of 06:44, 16 July 2012 by Dirkx (Talk | contribs) (Wiring things up)

Jump to: navigation, search

Serial JPEG camera (TTL, µCAM)

This project is about attaching the "Serial JPEG µCAM" (UK) to the GPIO pins and take pictures on command.



You will need the following:

  • A Raspberry PI, any model
  • A µCAM (see above). Ideally one which comes with the connector and wires already pre-soldered. Most do.
  • A 26pin IDC (female) socket that fits onto the GPIO connector of your Pi. ({http://uk.rs-online.com/web/p/headers-pcb-receptacles/6935353/%7CRS} or any electronics supplier).
  • Some flat pliers or, better a small vice.
  • A recent raspberry linux SD images.

About the camera

Consult the [1] for full details - but the short of it is that the camera is connected to your Pi by a '3.3v TTL serial connection'. One talks to the camera using a simple serial command protocol. Such as 'get started', 'measure the light', 'take an image NOW' and ultimately 'give me the image'. The camera (mostly) expects a simple master/slave model. Where the Pi is the master and the camera the slave. The master then gives commands and the slave reacts with things such as 'Ok, done that', 'Error' or 'here is what you asked for'.

Serial Connections

Serial connections are relatively simple affairs. They consists of two wires; one which goes from the Pi to the camera. The Pi then 'transmits (Yx)' on this wire to the camera its receive wire 'Rx'. And a second wire going from the camera to the Pi where the Camera Transmits and the receiver listens. The only issue is the voltage.

There are various voltages in common use: from 15 volt (the old RS232) all the way down to the more modern 5 and 3.3 volt digital. Your Pi supports 3.3 volt digital TTL. As does above camera (it also supports 5 volt; but we won't be using that).


Wiring things up

We need to wire up 4 things:

  • The Tx pin of the GPIO to the RX wire of the camera.
  • The Rx wire of the GPIO to the TX wire of the camera.
  • The ground of the Pi to the ground of the camera (as otherwise above Tx and Rx signals would not have any common ground).
  • And, as the camera needs power, we need to wire the 3.3volt wire up to the 3.3volt of the PI.

We can find the various pins of the GPIO socket in the documentation of the PI. On the {http://elinux.org/Rpi_Low-level_peripherals%7Cdetailed} documentation page you will find this image:


and what we now need to find are the 4 pins:

function Tx - serial transmission to the camera Rx - serial information from camera to PI GND - 0 volt, or common ground 3.3 volt power


Now we do the same for the camera. Page 5 and 6 of the {http://www.coolcomponents.co.uk/catalog/camera-module-serial-jpeg-p-369.html%7Cdatasheet} tell you that on the camera the wiring is as follows:

function Rx - serial information inbound from the PI Tx - serial transmission outbound back to the Pi GND - 0 volt, or common ground 3.3 volt power


So combing this we get the wiring diagram.

Camera|function 5|Pi to Camera 4|Camera to PI 3|GND - 0 volt, or common ground 2|3.3 volt power