Security Camera System


83 posts   Page 1 of 4   1, 2, 3, 4
by sisk » Mon Jan 16, 2012 10:43 pm
I got the crazy idea to build a security camera system out of Raspberry Pis and webcams the other day. After some quick number crunching, it turns out that I could build a five camera system plus the recieving/recording station for right around $400. Just out of curiosity I looked at what I could buy a system for. The only one I could find locally (I was out shopping when the idea hit me) was about $750.

Each camera would be a webcam, a Raspberry Pi, and a USB wireless-G card (N is overkill for streaming a webcam). The software to set it up to stream to HTTP is already in the Debian repository, so that's a non-issue. The reciever would either be another Raspberry Pi and a big (two or three TB at least) USB hard drive or a more traditional server with a RAID array. On that end there would need to be a little custom programming, but nothing I can't handle. Basically, I'd need a script to grab the video streams from the cameras and write them to the disk. There are other considerations (cleaning up old files and switching files for simplicity in review come to mind), but again, nothing terribly complex for someone with a little experience coding.
Posts: 7
Joined: Thu Jan 12, 2012 5:04 pm
by abishur » Mon Jan 16, 2012 10:53 pm
I also have this similar idea.  I was also planning on putting some magnetic switches on the windows or doors so I would get an alarm when the door was opened.  Was also considering putting a keypad up and maybe even a live video stream at the arming station using an r-pi and touch screen :-P .  One thing I was wondering about was weather or not you'd come ahead with purchasing a unique pi+webcam, or if you wouldn't be able to send the usb signal down an ethernet line.  I guess it all depends how long a line it is, but I've used ethernet to send usb signals a little over 50'  I'll have to check and see how it looks with webcam hooked up to it.
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4330
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by Darinlh » Tue Jan 17, 2012 12:45 am
I would like to see a full system setup aka

Camera
http://www.tigerdirect.com/app.....CatId=5203

RP
Collecting all feeds from camera's and broadcasting all feeds to uStream

aka a 1 person mobile news station in a backpack.

add this to a http://villagetelco.org/ system and all kinds of fun could happen.
Posts: 1
Joined: Tue Jan 17, 2012 12:27 am
by bitplane » Tue Jan 17, 2012 3:42 am
I've been thinking about this myself, it would be cool to have a high resolution camera taking pictures of the high street in my town, as I'd like run it through some software to figure out the number of people on the street at any one time (should be easy!). The only problem is finding a portable device that is cheap enough to risk leaving somewhere.

Motion looks like a good start for this sort of thing
Posts: 25
Joined: Sun Jan 08, 2012 6:20 am
by orbitoid » Tue Jan 17, 2012 4:09 am
I've just recently had a bit of a play around with some Playstation eye toys (both namtech and logitech) and a "Playstation eye" doing exactly this on a headless server at home.

I just used "Streamer" and a little script to copy the files to a different folder.

"sudo apt-get install streamer" should be all you need to get it installed on any Debian based system.

I plugged 3 eyetoys in and then ran this script:


#!/bin/bash
for (( ; ; ))
do
streamer -c /dev/video0 -s 640x480 -o cam0.jpeg
streamer -c /dev/video1 -s 640x480 -o cam1.jpeg
streamer -c /dev/video2 -s 640x480 -o cam2.jpeg

sleep 10
cp /var/www/webcam/cam0.jpeg /mnt/1TB/Pictures/webcam\ security/cam0/"`date +%Y%m%d_%H_%M_%S`_cam0.jpeg"
cp /var/www/webcam/cam1.jpeg /mnt/1TB/Pictures/webcam\ security/cam1/"`date +%Y%m%d_%H_%M_%S`_cam1.jpeg"
cp /var/www/webcam/cam2.jpeg /mnt/1TB/Pictures/webcam\ security/cam2/"`date +%Y%m%d_%H_%M_%S`_cam2.jpeg"
done


Each webcam was set to take a pic every 10 seconds using  a sleep command (i know cron is better but I'm new at this ok :D )

The only issue i had with this is that after a month of it running I ended up with a huge amount of little pictures. So much so that it took for ever (read: several minutes) to see the latest image if I was browsing the whole folder using SAMBA.

I've also had a play around with hasciicam which is the coolest thing ever! not as good for a security cam but really cool to be able to stream your webcam to everyone in ASCII. To give you an idea of how it looks think matrix style video from your webcam.
Posts: 14
Joined: Fri Oct 14, 2011 11:51 pm
by roelfrenkema » Tue Jan 17, 2012 9:43 am
sisk said:


I got the crazy idea to build a security camera system out of Raspberry Pis and webcams the other day. After some quick number crunching, it turns out that I could build a five camera system plus the recieving/recording station for right around $400. Just out of curiosity I looked at what I could buy a system for. The only one I could find locally (I was out shopping when the idea hit me) was about $750.

Each camera would be a webcam, a Raspberry Pi, and a USB wireless-G card (N is overkill for streaming a webcam). The software to set it up to stream to HTTP is already in the Debian repository, so that's a non-issue. The reciever would either be another Raspberry Pi and a big (two or three TB at least) USB hard drive or a more traditional server with a RAID array. On that end there would need to be a little custom programming, but nothing I can't handle. Basically, I'd need a script to grab the video streams from the cameras and write them to the disk. There are other considerations (cleaning up old files and switching files for simplicity in review come to mind), but again, nothing terribly complex for someone with a little experience coding.



Have a look at motion http://www.lavrsen.dk/foswiki/.....on/WebHome

sudo aptitude install motion

Everything you need fot a security cam realy
Posts: 105
Joined: Sat Jan 07, 2012 5:17 pm
by Neon22 » Fri Jan 20, 2012 3:49 am
You should check out zoneminder - a linux package - also available in a liveCD distro.

home: http://www.zoneminder.com/

Download: http://sourceforge.net/project.....oneminder/

Tut: http://www.howtoforge.com/vide.....der_ubuntu

It does all this and talks to video capture cards or webcams.

As the raspberrypi has USB - looks like webcams for now.

But it also has a connector for future camera use. So maybe the driver for that would show up in /dev/video and zoneMinder could use it. (probable).

I think this would be a great standalone distro to out on an SD card.
Posts: 29
Joined: Mon Sep 19, 2011 4:11 am
by jamesh » Fri Jan 20, 2012 9:09 am
You know, considering I work on cameras on the Videocore, I don't know if its possible to do slow recording of video ie take video at one frame every 10s or whatever, rather than lots of individual pictures (and perhaps post process to video). Hangon, guy at next desk might know...
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12428
Joined: Sat Jul 30, 2011 7:41 pm
by CookieMonster » Fri Jan 20, 2012 11:41 pm
sisk said:


...

Each camera would be a webcam, a Raspberry Pi, and a USB wireless-G card (N is overkill for streaming a webcam).



I haven't priced a (USB) webcam lately, but if things have not changed much your idea of a webcam plus a Pi would be cheaper than the IP cams I was playing with recently or, for the same price, have better resolution.
Posts: 46
Joined: Tue Dec 27, 2011 12:05 am
by CookieMonster » Fri Jan 20, 2012 11:51 pm
Neon22 said:


You should check out zoneminder - a linux package - also available in a liveCD distro.


I've been working with ZoneMinder. I don't know if it can be crammed into a Pi, but it does offer some solutions for those of you who are collecting way too many photos. For example, it can do motion detection and then record for x seconds after motion stops. You can also select how many seconds of pictures are retained prior to the trigger. So, for example, someone walks up to your door ZoneMinder stores pictures from 10 seconds before motion begins until 30 seconds after motion stops.

And, people have been talking about running XBMC on a PI. There is a ZoneMinder plugin for XBMC. You can be watching TV in XBMC and then have it show you one of your ZoneMinder cameras.

So, Pis might work on the display end and the camera end, but you might want a box with some big RAM and a big HDD in the middle. I'm really looking forward to seeing how much Pi sweats under real world load. We may have a whole new paradigm about to land in our laps.
Posts: 46
Joined: Tue Dec 27, 2011 12:05 am
by aperry » Sat Jan 21, 2012 3:25 am
I have Zoneminder running on a Seagate Dockstar (using Debian), monitoring my driveway.  It's a little slow, but it's been remarkably stable over the last year+.  I have it talking to one IP cam ($60 DealExtreme cam) and it uses a 2.5" USB hard drive for storage.

From what I gather the Raspi CPU is similar in horsepower to the Dockstar.  I've found the Dockstar can really only handle one zone of "active" processing (where it's analyzing frames for motion), but I'm sure it could handle several zones just for recording or monitoring with no processing.  The WebUI is a little on the slow side with this CPU, but it gets the job done.

Zoneminder is great software IMO.  It has sophisticated and highly customizable motion detection technology, and I have it sending me emails with screenshots of movement that it detects.
Posts: 60
Joined: Wed Dec 28, 2011 3:47 pm
by EricMiddleton » Sat Jan 21, 2012 3:50 am
Why don't you get a CMOS image sensor and directly connect it to the CSI connector. It might be cheaper and probably higher quality.
Posts: 47
Joined: Wed Jan 18, 2012 3:47 am
by perfo » Mon Jan 30, 2012 3:04 am
This site says it already has a camera on it ?

http://blog.websitepulse.com/r.....pberry-pi/

Did this idea get ditched at some point ?

You can pick up a HD web cam for something like £7 in the uk and this board
should be $35 = £23 ish so for £30 a HD IP camera!! That is way way cheaper
than anything else on the market. It will need a box of course but then you
have options for external or internal type uses. I know the developers are
thinking about it but if they offer POE in the next version then this increases
the WOW factor for security cam uses.

I've got a system running at the moment on zoneminder and foscams and find
both the foscam or zoneminder movement detection difficult to get right. I normally
end up with a disk full of shadows and sun movement or nothing even if someone
walks past. For this reason I'm learning about Linux / python etc and
triggering ZM from PIRs. It is unclear at the moment how you would access the
digital I/O on the R-PI but if it's not that difficult then a PIR can be
connected to the cameras as well and via the Ethernet send triggers direct to
ZM. Perfect all in one box. At present my foscams email a snap shot when they
detect movement and as I'm just learning python I don't know how hard this
would be to do on the R-PI but I'm guessing it should be quite do able. I think
for a multi cam system you will need a Linux box somewhere running the ZM or
other view software with a few MB's of memory and a large HDD. Are there any
updates on when these will be for sale?

I take my hat off to the developers of this I hope they will go down in
history as per the Sinclair and commodore.
Maybe even get it down to $15 if the world goes mad and orders millions
of them J.
Posts: 16
Joined: Mon Jan 30, 2012 2:42 am
by rasppi » Mon Jan 30, 2012 11:01 am
why would you use a PI for each point?....

Personally id use a USB webcam, run a Ethernet cable to the webcam (using a converter to send signal down the Ethernet)

run all the cables back to a patch panel, then patch them to a network switch with the PI back at this area to control it all

with a box of ethernet cable (£20 quid ebay for 305m)

a switch and 1 PI you could probably achieve what you want for a lot less the price.

well this is the way im going to do my system anyways
Posts: 7
Joined: Sun Jan 08, 2012 5:47 pm
by mole125 » Mon Jan 30, 2012 12:48 pm
Orbitoid said:



cp /var/www/webcam/cam0.jpeg /mnt/1TB/Pictures/webcam\ security/cam0/"`date +%Y%m%d_%H_%M_%S`_cam0.jpeg"
cp /var/www/webcam/cam1.jpeg /mnt/1TB/Pictures/webcam\ security/cam1/"`date +%Y%m%d_%H_%M_%S`_cam1.jpeg"
cp /var/www/webcam/cam2.jpeg /mnt/1TB/Pictures/webcam\ security/cam2/"`date +%Y%m%d_%H_%M_%S`_cam2.jpeg"
done


Each webcam was set to take a pic every 10 seconds using  a sleep command (i know cron is better but I'm new at this ok :D )

The only issue i had with this is that after a month of it running I ended up with a huge amount of little pictures. So much so that it took for ever (read: several minutes) to see the latest image if I was browsing the whole folder using SAMBA.



Many file systems (but particularly via Samba) have problems having a large number of files in the same directory. My advice is to have a seperate directory for each day eg have something like

mkdir  /mnt/1TB/Pictures/webcam/security/cam0/`date +%Y%m%d`/

cp /var/www/webcam/cam0.jpeg /mnt/1TB/Pictures/webcam/security/cam0/`date +%Y%m%d`/`date +%Y%m%d_%H_%M_%S`_cam0.jpeg"
Posts: 228
Joined: Tue Jan 10, 2012 2:01 pm
by perfo » Mon Jan 30, 2012 6:15 pm
Like everything in life there’s normally a good few valid
ways of achieving the same goal it purely depends on your own particular spec
and preferences.

If you are going to have a centralised system like that then
maybe using analogue cameras and a bit of coax back to a digitizer maybe just
as easy for you.

The beauty of having a bit of processing power at each
camera site is, you can end up with a distributed system so the cameras themselves
can do motion detection via PIR , mag switches, software etc and they can also
email, FTP snap shots or videclips etc thus there is very little processor load
on the storage device and as long as you have a network the cameras will still
work independent of other cameras or the storage device (main Linux box). The
other huge advantage for time lapse recording (especially with HD)  is the ability to drop to maybe 1 or 2 frames
per second normal stream then ramp up to whatever the max is when motion is detected
and have a few seconds worth buffered on board so you don’t miss anything.
Again you can do that at the remote end with a PC etc but the processing load
and network load is significantly increased as everything is working at max resolution
all the time with software then crunching the images. I’ve been running ZM on a
acer revo and it struggles with anything more than about four cameras at max
res with motion detection and time-lapse and these weren’t HD cameras these are
Foscams at 640 X 320.

The other use for the R-pi would be to control a couple of
steppers to move the cam if you so wanted. How much are the usb to Ethernet converters?
You’d need two per camera I assume ? Would they work out a lot cheaper than $35
?
Posts: 16
Joined: Mon Jan 30, 2012 2:42 am
by tqhien » Thu Feb 02, 2012 10:23 am
Hi every one,

I have several potential projects using R-Pis. For a surveillance project, I found T'nB's Moonpix webcam, which has a night vision (6 infrared led). It's quite cheap and is recognised in Ubuntu (my test server).

For In/Outs, I intend to use one (or more) Velleman's K8055 kit, which provides 5 Digital inputs and 8 Digital outputs throught a simple usb connection, if the lsusb library is available (should be, as it exists in debian).

Hien.
Posts: 2
Joined: Thu Feb 02, 2012 10:07 am
by xj25vm » Wed Feb 08, 2012 11:29 pm
This is an interesting thread. I've been using and testing webcams as CCTV cameras for about 2 years now with Linux – including a project to build a Linux based cctv system for buses (I've uploaded some details at http://www.open-t.co.uk/iroko).

Regarding some of the issues raised above:

1. One could indeed use analog cameras – but their resolution is limited in general to TV resolution (or lower) – and the quality of regular ones is really quite low compared to high quality webcams of pretty much the same price.

2. Some of the current usb webcams have quite good sensors and onboard firmware – and produce really good results in low light conditions – at least compared to anything else at a similar price point.

3. To those suggesting ethernet based USB extenders – I haven't used them myself – but there is a good chance you won't get very far. Most of them support in reality only USB 1.1 speeds (even if they advertise 2.0) – and webcams are fussier then other USB devices about USB link quality – including sync issues – not just pure bandwidth.

I have tried four different models of active USB extenders (non-ethernet) with webcams, and the results vary greatly. Of the three 5 metre models I've tried, the older NewLink model, with beige/gray connector box and NEC chip inside seems to be the best. I've managed to run webcams through a maximum of 3 of them connected together reliably (15 metres). The newer model from Newlink in black barely manages 2 repeaters together for webcams – and another model from Pluscom seems to manage only one length of repeater reliably. Testing these repeaters can be sometimes quite frustrating – compounded by the fact that sometime the model you receive is not the one pictured on the website you buy from.

There is also a newer 12 metre model of active usb extender in white at Maplin (in UK) and on Amazon.co.uk – which so far shows great promise – and has behaved well in tests. However, I haven't tested it extensively enough to be sure. If 2 or 3 of these would work reliably together – it would mean 24-36 metres of possible usb extension for webcams (plus the camera lead) – which is not bad going.

Another problematic issue I've encountered is the fact that some of the best webcams I've tested – the MS LifeCam Cinema and LifeCam Studio – have a firmware/design bug which means they ask for the maximum usb bandwidth (at least under Linux) even though they don't need it. This has been confirmed by the Linux uvc kernel module developers. These webcams will not work in setups of more then one at a time on the same USB root hub. This means that a multi camera system using these models would only be possible by using a USB PCI-e card with independent USB channels/root hubs for each port – or indeed, one Raspberry Pi for each camera – all linked through with ethernet cable (I would prefer ethernet which has rather more predictable bandwidth than WiFi). The other advantage of having one Raspberry Pi next to each camera is the fact that it could transcode the stream to mpeg4 – which is far more efficient then mjpeg – which is what these cameras output (unless you use the raw stream – which is even worse).

I have even seen reports online that the Logitech C910 (another high quality webcam) suffers from the USB bandwidth hogging issue – but I don't have one yet to confirm the problem.

Another aspect of preoccupation when it comes to using Raspberry Pi's for CCTV is their ability to restart automatically in case of trouble. Many embedded platforms (such as wifi routers) are known to lock in limbo from time to time – and don't have the ability to restart automatically. A box attached to a camera which is supposed to work by itself without constant intervention would need to be able to auto-reset when hardware crashing – so to speak. I don't know where the Raspberry Pi fits in this respect.
Posts: 10
Joined: Wed Feb 08, 2012 10:59 pm
by gjs » Thu Feb 09, 2012 3:30 pm
perfo said:


You can pick up a HD web cam for something like £7 in the uk...


Do you have any links?
Posts: 148
Joined: Fri Dec 02, 2011 8:04 pm
by RaTTuS » Thu Feb 09, 2012 3:40 pm
gjs said:


perfo said:


You can pick up a HD web cam for something like £7 in the uk...


Do you have any links?


http://www.amazon.co.uk/Megapi.....38;sr=1-47 ? maybe good enough
http://www.catb.org/esr/faqs/smart-questions.html <- ask smart Questions
"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
User avatar
Posts: 5629
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by gjs » Thu Feb 09, 2012 6:52 pm
Thanks for the link.  Unfortunately, that one looks like VGA res with 'software enhancement', whatever that means:

"Up to 12.0 Megapixel resolution, Image Capture: 4000*3000 (using VGA Hardware, enhanced by software), High Definition CMOS Sensor"

I don't seem to be able to find a USB camera that is capable of taking proper high resolution stills.
Posts: 148
Joined: Fri Dec 02, 2011 8:04 pm
by xj25vm » Thu Feb 09, 2012 7:02 pm
Have you had a look at the top end cameras, such as the MS LifeCam Studio, Creative Socialize HD 1080 (not 720) and Logitech C910 and C920? Some of them have sensors of 7-15 megapixels for stills.
Posts: 10
Joined: Wed Feb 08, 2012 10:59 pm
by error404 » Thu Feb 09, 2012 9:10 pm
As an alternative to capturing the images/video on the Pis at the camera sites and then sending them to a server, perhaps it makes sense to just use the Pi as a USB host and transfer the entire USB traffic over the interface instead? Might make it easier to integrate with things like ZoneMinder if you want decent framerates - though doing a simple V4L->JPEG via HTTP is probably more reliable.

USB/IP can be used for this: http://usbip.sourceforge.net/ . With a GigE switch and decent server this should support quite a lot of cameras streaming decent quality video. you can even use (blech) Windows on the server-side if you wanted...

xj25vm said:


Another aspect of preoccupation when it comes to using Raspberry Pi"s for CCTV is their ability to restart automatically in case of trouble. Many embedded platforms (such as wifi routers) are known to lock in limbo from time to time – and don"t have the ability to restart automatically. A box attached to a camera which is supposed to work by itself without constant intervention would need to be able to auto-reset when hardware crashing – so to speak. I don"t know where the Raspberry Pi fits in this respect.


What's especially lame about this is that most of these devices have hardware watchdogs that should be able to reboot them if the hardware locks up. Not sure if RPi has one or not. Even if it doesn't you could use the Linux software watchdog (softdog module) to reboot the machine if some software you write stops responding. As long as the OS doesn't crash this should work fine.
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm
by gjs » Fri Feb 10, 2012 5:06 pm
xj25vm said:


Have you had a look at the top end cameras, such as the MS LifeCam Studio, Creative Socialize HD 1080 (not 720) and Logitech C910 and C920? Some of them have sensors of 7-15 megapixels for stills.



Unfortunately, they all seem to have 2Mpx sensors.  "Software enhancement" sales speak again.
Posts: 148
Joined: Fri Dec 02, 2011 8:04 pm
by jamesh » Fri Feb 10, 2012 8:49 pm
gjs said:


xj25vm said:


Have you had a look at the top end cameras, such as the MS LifeCam Studio, Creative Socialize HD 1080 (not 720) and Logitech C910 and C920? Some of them have sensors of 7-15 megapixels for stills.


Unfortunately, they all seem to have 2Mpx sensors.  "Software enhancement" sales speak again.


Depends. 1080p only needs a 2MP sensor. You can sharpen detail a bit with the right processing, but most of the sales speak of images much above the actual sensor resolution is pretty much bo***cks.
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12428
Joined: Sat Jul 30, 2011 7:41 pm