book collections email follower instructable user
Picture of Raspberry PI Camera and Light Control Death Star

As always I looking to build devices which are useful, work robustly and often are even improvements compared to the current off the shelf solutions.

Here is yet another great project, originally named Shadow 0f Phoenix, a Raspberry PI shield in conjunction with Arduino based motion detection and light controls.

Step 1: The State of Commercial IP Cameras

Picture of The State of Commercial IP Cameras

Besides that building your own camera/surveillance system is more cool let's see why is this an improvement from an off the shelf solution.

I will compare it with the NEO COOLCAM Full HD 1080P Wireless IP Camera series since I have owned a lot of these various models of neo coolcams (ONVIF) cameras. They come in different shapes and sizes, outdoors and indoors, most of them have built in wifi support but let's see their caveats:

  • Chinese manufacturers who sell these cameras almost always lie about the built in image sensor resolution, when you buy a 5MP/8MP camera on Ebay you might end up with a cheap 2MP camera with bad picture (it works but the quality is garbage). When you buy the 8MP Raspberry PI v2 camera from the original retailer you will get what you paid for and actual 8MP sensor with the resolution 3280 × 2464 pixels =>
  • From security standpoint these cameras (even the more expensive Dlink and other models) are terrible, they use default passwords such as 123456 or built in users such as admin/admin operator/operator what you might won't even be able to change or the change is gone after a reboot. Top it off with many of these cameras phone home (connect to their servers in china, some even streams back video/pictures without asking you just to make it easier in case you decide to install their Android/Iphone app one day to check on your home). Even if you put these devices behind a router it is just not good enough, the best is if you don't set a default gateway in them, firewall them out or put them into a VLAN to make it impossible for them to go out to the Internet or even better: don't use them at all.
  • Are they more reliable? nope, a lot of them even the more expensive DLINKs have the option to reboot the camera daily/weekly etc. That option is there for a reason, because after X days they often lose Wifi connectivity or misbehave on other ways. Just think of them as good old Win95 boxes which needed to be rebooted more often than not :) I don't say that the Raspi based hardware are so rock solid that you can build them into control nuclear power plants but with proper hardware/software configuration, heatsinks, automatic cooling fans and minimized RW operation on the SDCARD they can easily hit that 100+ days uptime without problem. At the time of writing my DeathStar runs since 34 days, been over 100 but sometimes I was hacking on the feed in power source which is powering some other of my circuits so had to shut it down :(
  • Targeted hardware: they are made for 1 specific purpose, often come with a small nvram area and busybox but some models make the access of this shell impossible as well so all you can use them for is what they meant to be used for while you can use your Raspi based camera to whatever other tasks: file server, tftp/dhcp server, web server, quake server... the options are unlimited.
  • Storage space: they either have none or they use microsd cards with FAT32 filesystem VS on the raspberry pis you can even attach a 2 TB hard drive if you like.
  • Controlling lights: some does have an ALARM output where you might be able to connect a small relay to have lights triggered. As I will show you in this tutorial using infrared cameras are complete waste of time since you will not be able to identify anyone on the IR pictures due to the bad quality. If you need to record a video in the dark the best way to do so is turn on some light first then record the video.

So you might ask are there any PROs of using an off the shelf camera? Yes for businesses where the work hours to set it up would be more expensive than tinkering around with Raspberry pis (not for me anyway :)) and yes there are top of the line cameras (500$+ with better resolution than the pi camera of course). As another advantage I could say that the cameras following the ONVIF standard made centralized provisioning easier. This provides a standard interface what can be used to send commands to the camera to set it's IP/Network mask/Gateway and other things. For this you could download the Onvif device manager from Sourceforge. A lot of these devices come with crappy broken web frontends where for example it does not allow you to set the ip or netmask correctly because the javascript which validates these fields is malfunctioning and your only way to set these parameters correctly is through ONVIF.