Embedded Video Surveillance Project
I made a PCAM (Pico Camera) project with an ARM microcontroller (LPC2142-datasheet) and a serial camera (C328). That project is very simple and low cost. Now I can share a project for a more complicated video surveillance product. Because a blog is too small to cover every detail for the implementation, I will try to offer the orientation information for the people who are going to DIY.

The system employs an off-the-shelf ARM9 evaluation board and commercial USB web camera. Please note, it is not a commercial project, so its BOM cost is not the major consideration. The most commonly available ARM kit is S2C2410/2440 (ARM920T), you also can get the beagle board with powerful OMAP3530 as well. However, in this project, the video processing will be handled by ARM processor with V4L (Video for Linux) library, rather than the DSP in the OMAP3530. We have following on board peripherals: SDRAM, NOR/NAND flash memory, USB host, Ethernet, RS232, audio I/O (I2S) and JTAG.
The major tasks for this project are: driver development, video capture and backend processing (either local storage in USB storage device or send to the internal or external web server).
Driver
The major suppliers for USB cameras have Omnivision, VICMicro, Micron and Sunplus. Sometimes it is hard to get the specification and driver source code from these vendors directly. However most of the USB cameras can be recognized in the desktop Linux. And you can get the drivers from the open source communities. You can visit Spca5xx project and find the drivers, then build for your ARM board. The following steps are familiar to a Linux developer.
-
1) Download the patch and patch your kernel;
2) Enable USB SPCA5XX Sunplus Vimicro Sonix Cameras as module;
3) enable usb-ohci and V4L in the kernel;
4) Rebuild the kernel;
5) Create file system entry for your camera by: $mknod /dev/video0 c 81 0
6) register your camera by: $insmod spca5xx.o
Video for Linux
Please refer to the V4L manual for detail information of video capture program development. We can use V4L API to access the camera and capture the image. There are so many sample programs available in the desktop Linux which can be referred to. For instance, the Cheese in Ubuntu is a good starting point. Check out the following API in V4L you may use.
-
1) dev = open(ope_cam ,O_ RDWR) open the video capture device;
2) ioctl (dev , VIDIOCGCAP , &vid_caps) get the properties of this device;
3) ioctl (dev , VIDIOCGCHAN , &vid_chnl) get the channel parameters for one channel;
4) ioctl (dev , VIDIOCGFBUF , &vid_buf) get the properties of frame buffer;
5) ioctl (dev , VIDIOCGPICT , &vid_pi) get the setup of the picture capture;
6) ioctl (dev , VIDIOCSPICT , &vid_pic) parameters include color depth, contrast, and brightness;
7) ioctl (dev , VIDIOCSWIN , &vid_win) setup window parameter;
8) fwrite (m_buf ,1 ,230400 ,p) save the capture data;
9) ioctl ( dev , VIDIOCMCAPTURE , &vid_mmap) start to capture one frame;
Improvement
The video surveillance is an active market segment with many innovations. This market can be further divided into many small segments. In general, the cameras are becoming smarter (video recognition, network connections), clearer (from low resolution to HD) and cheaper. As a homemade camera project, this project can be upgraded to commercial versions.
There is much room to improve this design. You can use the native camera interface of S3C2440. You can add PTZ (Pan/Tilt/Zoom) control to your cameras. You can upgrade the Ethernet to WiFi. You can add local mass storage on the flash cards. You can setup the embedded server and DDNS to allow you to access the camera remotely. You can connect your camera to your mobile phone via a WAP server. You can add the audio if you want. You can use gstreamer framework to convert the images into AVI or other stream media formats. You can put your camera on a mobile robot. You can deploy the object moving recognition by comparing the consequential images.
If you want to build a high-end high resolution video surveillance camera, you have to use the OMAP3530 board or Blackfin board. They claim to be able to handle H.264 video encoding. But I am not good at DSP.
BTW, if you have no ARM board, try QEMU first. Alternatively, you can try to develop the code in your Linux PC, then port it on a NAS.
Reference
Video for Linux
http://www.thedirks.org/v4l2/
Spca5xx and Linux Embedded
http://mxhaard.free.fr/embedded.html
- allankliu's blog
- 2492 reads





A caution on H.264
Thanks for the very informative article! As was discussed, there are limitless variations one can do with video surveillance camera projects. You can use cameras from low-end USB cameras to high-end HD cameras. You can select what transmission medium you prefer – ethernet, internet or WiFi. You can also use your preferred processor and the corresponding video codec. H.264 was mentioned but take note that though it could offer significant savings in bandwidth, this codec is machine-heavy. The new algorithm is an improvement over that of MPEG-2 but more complex, thus may require more powerful processors.
hello~ I have just started
hello~
I have just started to learn the embedded linux, i would like to use lpc2200 + uclinux + c328-7640 to do image capture.
can you give me a share from the 28-7640 driver?
I want to learn with you ~
Thank you ~
zsx
Post new comment