You are on page 1of 2

Cheap Surveillance Camera System [DIY] http://dev.emcelettronica.

com/print/51992

Your Electronics Open Source


(http://dev.emcelettronica.com)
Home > Blog > allankliu's blog > Contenuti

Cheap Surveillance Camera System [DIY]


By allankliu
Created 10/16/2008 - 06:08

Technology arm camera LPC2100 SD card

Cheap Surveillance Camera System is a DIY project.


I just launched a low cost surveillance camera project, which is named as PCam (Peek
Camera). The project is made up of an LPC2100 microcontroller, a serial camera, and an SD
card slot. An optional passive IR detector can be connected to the microcontroller as the alert
input. Up to now I am using an LPC2142 board for software development. I plan to use
LPC2103 in the final design. The retail price of a regular surveillance camera is about
USD50. I have confidence this camera module will be the price leader in low-end cameras.

I will not offer the schematics design since such design is available from an existing EV board
from Keil (Please check out the links in section Read More). The LPC2142 is powerful
enough for this application. It has two UARTs, which connect to camera and debug terminal.
It has an SSP/SPI port, which connects to an SD card slot in SPI mode. Its RTC offers the
real time clock for timestamps of stored pictures. The external triggers and PIR detectors can
be connected to the GPIO and ADC input. The microcontroller will read the image bit stream
from the serial camera and store the JPEG file into a SD card when it detects the trigger
signals from internal timer, external input or the PIR input.

The design challenges of PCam project are SD card storage and Camera modules
connectivity. Fortunately, we solve the SD card storage quite easily with an EFSL port from
Martin Thomas, as I mentioned in another blog - Open source software for FAT file system
over MMC SDC. This port is available for LPC2138 and WinARM (GCC). However the
camera modules indeed confused me for a while.

First of all, it is difficult to select the cameras and the suppliers. The serial cameras were as
popular as USB PC cameras. The first serial camera module (C328/OV528) from Omnivision
is designed for the add-on modules for old PDAs and mobile phones. Do you remember the
external camera for Sony Ericsson's T618? Yes, that is one of the serial cameras. I can not
find the data sheet from Omnivision’s web site any more. On the other hand, the serial
cameras are still very popular in the embedded surveillance market, such as the taxi video
surveillance system. In this application, the serial camera connects to a mobile module to
send the captured image to the server with the geographic information. Finally I choose a
complete serial camera from a C2C auction site to complete my design. The communication
protocol of this camera is slightly different from C328/OV528. Anyway I can complete my
design. And it is an easy job to support both protocols.

Second issue is the JPEG format. It is claimed that the serial camera delivers JPEG image
over serial communication. However I want to make sure what is the difference between
JPEG file stored in SD card and JPEG image transmitted over serial communication. I found
some projects and blogs which involve JPEG over serial cameras. The conclusion is very

1 din 2 21.10.2008 21:37


Cheap Surveillance Camera System [DIY] http://dev.emcelettronica.com/print/51992

simple: the JPEG information is the JPEG file stored in the SD card. I have verified this with a
hex editor. The leading SOI marker is 0xFFDB, and the EOI marker is 0xFFD9, with a trailing
end of file marker 0x00. So the task now is quite simple. The microcontroller downloads the
file image, stores into the SD card with timestamp. Since writing SD card is faster than the
UART communication, we can ignore the buffer overrun issue.

After the basic PCam project, my partner asks for a feature up version of PCam, an IP
Camera with Ethernet connectivity. The video recording/transmission is required, rather than
a static image. I have to select a suitable SoC for this product, because a general purpose
microcontroller based design is not cost effective any more.

Read More

Keil offers MCB2140 evaluation board with NXP LCP214X. There is a SD card slot on the
board. It is my current working platform to test my software.
http://www.keil.com/mcb2140/

SRV1 Robot (LPC2106), this project uses LPC2106 to build a remote control robot. It
includes an OV328 driver to crab the JPEG image, decode it locally then transmit to PC with
WiFi connection. The source code reveals the communication detail for JPEG processing for
OV328.
http://www.surveyor.com/srvdownload/

TechDesign Electronics, an online component shop, which sells C328 serial camera module.
http://www.techdesign.be/shop/product_info.php?products_id=266

COMeida Ltd is a Chinese camera manufacturer, which produces and sells the serial camera
modules.
http://www.comedia.com.hk/

JPEG Draft International Standard (ISO DIS 10918-1), the JFIF refers to JPEG File
Interchange Format.
http://www.jpeg.org/jpeg/index.html

Mikrocontroller.net is a Germany electronics design forum, some people have discussed the
JPEG format for serial camera a lot.
http://www.mikrocontroller.net/

Trademarks

Source URL: http://dev.emcelettronica.com/cheap-surveillance-camera-system-diy

2 din 2 21.10.2008 21:37

You might also like