|
Neighborhood Surveillance
So, we've had some problem with thefts in the neighborhood. I got fed
up and decided to set up a camera network.
I
already own several x10 cams. I've been largely happy with these
cameras. They're relatively cheap, they're wireless and they
actually
work quite well. I'm not even sure that they sell the original x10
camera anymore, but it would seem the models they sell now are actually
better.
However, given my requirements for this project, x10 wouldn't
quite
work. First of all, I don't want a limit to the number of cameras I can
use. I also want this system to be as IP based as possible. Which is to
say that I want to be able to view the surveillance on my
computers and
the internet. The problem with the x10 cameras
is that the cameras beam
their NTSC signal to a wireless receiver which then outputs the NTSC
signal to regular RCA outputs. From there, I feed the signal to my
video card which has video capture on it. I can then view the stream on
my computer or capture it to disk. Ok for one camera, but,
more
than one camera results in alot of wireless receivers, video capture
cards,
etc.
I
know the X10 cams have advanced alot, and x10 offers Out-Of-The-Box
solutions for setting up a multi-camera network, but, it's still not as
flexible as I want. I want to be able to get the stream from the camera
to various outputs (save it to disk, serve it on my webpage, etc.) with
as little intervening hardware/software as possible. And, oh yeah. I
don't want Winblows to be in the mix at all.
After looking around I found a fairly new type of device called a
network camera or IP camera. These are small inexpensive cameras that
connect directly to your network. They contain a webserver and use
various other network protocols to serve the video stream as you
desire. There are some really kickass cameras out there, but I settled
on the NC1000-L10.
I ordered a D-Link DCS-950 and was very
dissapointed. It is NOT usable with anything except Winblows/IE. I
tried every linux browser I had but nothing worked. Apparently, it's
because it uses Active-X.
The NC1000-L10 does actually require Winblows/IE for advanced
configuration, but most configuration can be done on any old browser.
Not ideal, but a hell of alot better than that turd DCS-950. It is not
only capable of seeing IR (for night vision; not all cameras have that
ability)
but it also has an array of IR LEDs to provide it's own
non-visible
IR lightsource for night vision. This seems to only be useful for
indoors are close range outside, as the IR LED array isn't that
powerful. On top of all this, it uses Linux
for
its firmware. I won't bore you with more details, but you can see
and purchase the camera here. I've had this camera in
operation now for about 6 months. By and large, I've been very
happy with it. It's been ouside in an enclosure that I built for
it. In the summer it was exposed to 100+ degree temperatures
(Lord knows what it got up to inside the enclosure) and temperatures in
the single digits. So far, these extremes have not caused any
problems. In fact, I don't think I've ever seen this camera crash
or hang or have problems otherwise.
Now, I'm not going to tell you that I chose the best camera on the
market. However, if you're looking to spend around
$100, you'll
probably end up buying this camera, particularly if you consider the following crieteria while
shopping around.
- Price (duh.)
- LUX
(amount of light required to produce a decent picture. 2.5 seems to be
standard. 1.0 is the amount of light during a full moon)
- Framerate
and Frame size (Research this carefully! Most cameras have very poor
framerates once you get to a decent size, like 5 FPS at 640X480)
- Supported network protocols (such as
TCP/IP, DNS, DDNS, NFS, NTP, HTTP, FTP, etc.)
- Audio (most cams don't have it)
- IOs (some cameras have IO ports that
you can use for various other purposes)
- Operating temps (relevant if you'll
be mounting the cam in an outdoor environment)
- Lens compatibility (in case you want
to attach a wide angle lens or something)
- Size of the cmos sensor (bigger the
better. It'll probably be 1/4 inch or 1/3 inch. 1/3 inch is better)
- Ability
to see IR. (This is usually not something listed in the
specs,
but sometimes user reviews will comment regarding this. Even
if
it doesn't have it's own IR array, you can always build one later, if
you want)
- Multi-OS
compatibility. (I don't know why you wouldn't make a product like this
platform independent, but alot of companies don't)
The
NC1000-L10 does reasonably well in all of these categories for around
$100. And there are some known hacks for this camera that make it
somewhat flexible. Here are the ones I know about:
To just get the latest frame from the camera point your browser to:
http://camera_address/Jpeg/CamImg.jpg
To get just a video stream from the camera point your browser to:
http://camera_address/GetData.cgi
You can use those to plant images or streams in any webpage you like.
So, I've got the cameras picked out. Now, there's the issue of cabling.
The cameras require a network cable and a power cable (I don't do
wireless). I wanted to
reduce the cabling as much as possible, so, I elected to use POE (Power
over ethernet). You might already know that Cat5 cable, when used for
100 mb/s networks,
actually only uses two of the four pairs of copper wire to transmit
data. The others are just there to help prevent crosstalk between the
wires. Somebody realized that a small amount of power can be
transmitted over those unused wires safely. This has become a project in and of itself.
Anyway, using POE reduces the cabling to each camera to only
one piece of cat5 each.
Now, with all of the cameras up and running I wanted to build a page
that would have a small, low framerate stream from each camera and the
ability to click on a small stream to get the full framerate, full size
stream from that camera. To do this, I needed a piece of javascript
that would grab one frame per second from the cameras. Here is that
code (this particular code uses 3 cameras). This is one of the few
truly
useful parts of this page, as it seems to be easy to find a script on
the net for refreshing images within a page, but I found it difficult
to write one for multiple images (keeping in mind that I don't know
javascript). Some hacking aside, here's what I came up with:
<script language="javascript">
var
refreshrate=1; //SECONDS BETWEEN REFRESH
var
image1="http://cam.joewise.com/Jpeg/CamImg.jpg"; //IMAGE1 NAME
var
image2="http://cam.joewise.com/Jpeg/CamImg.jpg"; //IMAGE2 NAME
var
image3="http://cam.joewise.com/Jpeg/CamImg.jpg"; //IMAGE2 NAME
var
imgheight=120; //IMAGE HEIGHT
var
imgwidth=160; //IMAGE WIDTH
function
refresh(){
document.images["pic1"].src=image1+"?"+new
Date();
document.images["pic2"].src=image2+"?"+new
Date();
document.images["pic3"].src=image3+"?"+new
Date();
setTimeout('refresh()',
refreshrate*1000);}
document.write('<A
HREF="CAM1_URL"><IMG SRC="'+image1+'"
NAME="pic1"
ID="pic1" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" BORDER="0" STYLE=
"border:
1px solid Black;"></A>\
<A
HREF="CAM2_URL"><IMG SRC="'+image2+'"
NAME="pic2"
ID="pic2" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" BORDER="0" STYLE="border: 1px solid
Black;"></A>\
<A
HREF="CAM3_URL"><IMG SRC="'+image3+'"
NAME="pic3"
ID="pic3" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" BORDER="0" STYLE="border: 1px solid
Black;"></A>\
');
if(document.images)window.onload=refresh;
</script>
That is a simplified version of the code that I actually use.
To see how to insert more
tags and such between the images, just read the full blown code for the
surveillance
page.
So, that gets me through the realtime viewing of the cameras, but what
about when I'm not home? Well, I wrote some scripts
that
will go out and grab one frame per second from each camera.
Then,
every hour, the days frames are compressed into a movie.
Those
scripts are below. I actually don't use the automatic compressing script anymore. The individual frames have better resolution, so, when an event worth reviewing occurs I look at the frames and if I want a movie, I compress the frames manually.
Perl script
for grabbing the frames.
Perl script
for compressing the frames.
Have a comment or suggestion?
|
|