{"id":398,"date":"2013-09-17T09:51:16","date_gmt":"2013-09-17T14:51:16","guid":{"rendered":"http:\/\/www.bitquill.net\/blog\/?p=398"},"modified":"2016-05-12T14:34:29","modified_gmt":"2016-05-12T19:34:29","slug":"weekend-hack-surveillance-on-the-cheap","status":"publish","type":"post","link":"https:\/\/bitquill.net\/blog\/weekend-hack-surveillance-on-the-cheap\/","title":{"rendered":"Weekend hack: surveillance on the cheap"},"content":{"rendered":"<p>Some time ago I bought a few <a title=\"Foscam FI8910W - Amazon.com\" href=\"http:\/\/www.amazon.com\/gp\/product\/B006ZPWS4U\" target=\"_blank\">Foscam MJPEG cameras<\/a> and installed them in our apartment, originally for baby monitoring, and I wanted to set up a proper security surveillance system. \u00c2\u00a0I already have a Netgear ReadyNAS box, so I thought this should be easy. \u00c2\u00a0However, I soon found out that video surveillance solutions from major NAS vendors (e.g., Netgear, QNap, Synology) require per-camera licenses, in the range of $50-60\/camera. \u00c2\u00a0That would be over $200 to enable functionality already present in the device! \u00c2\u00a0Although this is already an order of magnitude cheaper than hardware from traditional NVR (network video recorder) vendors, it still felt unreasonably high.\u00c2\u00a0Oh, and Foscam cameras still aren&#8217;t supported by ReadyNAS Surveillance.\u00c2\u00a0 There used to be a KMotion port for ReadyNAS, but it disappeared around the time Netgear&#8217;s official solution came out on the market. \u00c2\u00a0Since ReadyNAS is almost Debian (with customizations), I gave installing KMotion from source a shot, but after an afternoon fiddling with custom configurations as well as tweaks for the low-power Atom CPU, I gave up.<\/p>\n<p>Perhaps the NVR industry is ripe for &#8220;disruption&#8221;, but I wasn&#8217;t willing to wait. Last time I did that (for car stereos) was almost three years ago&#8230; and I&#8217;m still waiting. \u00c2\u00a0Luckily, an NVR is a much simpler build than a custom car stereo (<a title=\"Adventures in fiberglassing: custom fabricated tweeter pods - bitquill.net\" href=\"http:\/\/www.bitquill.net\/blog\/?p=352\">this <\/a>was enough for me, thank you :). \u00c2\u00a0There are several low-cost hardware options and <a title=\"zoneminder.com\" href=\"http:\/\/www.zoneminder.com\/\" target=\"_blank\">ZoneMinder<\/a>\u00c2\u00a0is a great open-source surveillance system that was originally built to scratch an itch (the original author&#8217;s power tools were stolen from his garage, and he couldn&#8217;t find any reasonably-priced commercial surveillance solutions he liked). \u00c2\u00a0Here is what I got after about a day:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"399\" data-permalink=\"https:\/\/bitquill.net\/blog\/weekend-hack-surveillance-on-the-cheap\/cubie-nvr1\/\" data-orig-file=\"https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?fit=1942%2C1451&amp;ssl=1\" data-orig-size=\"1942,1451\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPad&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1379236909&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.28&quot;,&quot;iso&quot;:&quot;400&quot;,&quot;shutter_speed&quot;:&quot;0.066666666666667&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Cubieboard NVR\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?fit=300%2C224&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?fit=1024%2C765&amp;ssl=1\" class=\"alignnone wp-image-399\" src=\"https:\/\/i0.wp.com\/www.bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1-1024x765.jpg?resize=737%2C551\" alt=\"Cubieboard NVR\" width=\"737\" height=\"551\" srcset=\"https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?resize=1024%2C765&amp;ssl=1 1024w, https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?resize=300%2C224&amp;ssl=1 300w, https:\/\/i0.wp.com\/bitquill.net\/blog\/wp-content\/uploads\/2013\/09\/cubie-nvr1.jpg?w=1942&amp;ssl=1 1942w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p>In addition to some familiarity with installing Linux, a 3D printer, and\u00c2\u00a0<a title=\"Cubieboard NVR case - Thingiverse\" href=\"http:\/\/www.thingiverse.com\/thing:151160\" target=\"_blank\">my case design from Thingiverse<\/a>, you&#8217;ll also need:<\/p>\n<ul>\n<li><a title=\"cubieboard.org\" href=\"http:\/\/cubieboard.org\/\" target=\"_blank\">Cubieboard2<\/a> (<a title=\"Cubieboard2 - IO Technologies\" href=\"https:\/\/store.iotllc.com\/product.php?productid=17\" target=\"_blank\">$64.50 from IO Technologies<\/a>)<\/li>\n<li><a title=\"Western Digital 500GB WD Blue SATA drive - WD5000LPVX - Amazon.com\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00C9TECFO\" target=\"_blank\">500GB WD Blue 2.5&#8243; SATA HDD, 500GB<\/a> ($54.50 on Amazon)<\/li>\n<li>2A 5V USB power adapter (e.g., <a title=\"AmazonBasics Wall Charger with USB Outlet (2.1 Amp Output) - Amazon.com\" href=\"http:\/\/www.amazon.com\/gp\/product\/B005CG2ATQ\" target=\"_blank\">this one<\/a> for $8.50 on Amazon)\u00e2\u20ac\u201doptional, if you have one already<\/li>\n<li>microSD card (about $6 on Amazon)\u00e2\u20ac\u201doptional, you can install on built-in NAND<\/li>\n<li>Eight screws<\/li>\n<\/ul>\n<p>Total cost comes to $120 if you have some spare parts around, or about $140 if you get everything and add shipping too.<strong> That&#8217;s about half the price of just software licenses for a NAS box, and an order of magnitude cheaper than NVR boxes in the market.<\/strong> \u00c2\u00a0Plus, there&#8217;s CPU cycles to spare, for more cameras, and it leaves the ReadyNAS Atom CPU free to handle its main tasks (file and media serving).<\/p>\n<p>Although I love the Raspberry Pi and already have a couple for various tasks, I went with the Cubieboard since it has a much more powerful CPU (AllWinner A20 dual-core ARM) and built-in SATA, for just $20 more. \u00c2\u00a0Adding a powered USB hub and SATA-to-USB adaptor to a RasPi would probably have cost more (plus require funky wiring solutions); the Cubieboard was mostly plug-and-play.<\/p>\n<p>The A20 can handle all four cameras in &#8220;modect&#8221; mode (motion detection triggered recording) at 1fps with one alarm zone per camera, without problems. \u00c2\u00a0The load average can be high (between 0.5 and 1.5) probably due to the continuous I\/O, but actual utilization per core seems to peak around 20-25% and is typically in the single digits. \u00c2\u00a0Not bad at all for a low-power (10W max) single-board computer!<\/p>\n<p>There are several Linux distributions for the Cubieboard (including Android) and the documentation is a bit messy, so I installed Linux a few times before I settled with\u00c2\u00a0<a title=\"cubian.org\" href=\"http:\/\/cubian.org\/\" target=\"_blank\">Cubian<\/a>\u00c2\u00a0(basically Debian Wheezy, in the spirit of Raspbian) which is great. \u00c2\u00a0It can be installed on either an SD card or built-in NAND flash (I went with the former). \u00c2\u00a0There are already DEBs for\u00c2\u00a0<a title=\"zoneminder.com\" href=\"http:\/\/www.zoneminder.com\/\" target=\"_blank\">ZoneMinder<\/a>, so this is a fairly standard Linux install. \u00c2\u00a0The only additional steps were moving data directories for ZoneMinder and MySQL, as well as temporary files and logs (to minimize flash wear), over to the hard drive; see\u00c2\u00a0<a title=\"Cubieboard NVR case - Instructions - Thingiverse\" href=\"http:\/\/www.thingiverse.com\/thing:151160\/#instructions\" target=\"_blank\">brief instructions<\/a>\u00c2\u00a0on Thingiverse.<\/p>\n<p>If you have a 3D printer and some basic Linux skills, perhaps this might save you a few hundred to a few thousand dollars. YMMV with other video formats (e.g., H.264 HD cameras).\u00c2\u00a0 Let me know if it works for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some time ago I bought a few Foscam MJPEG cameras and installed them in our apartment, originally for baby monitoring, and I wanted to set up a proper security surveillance system. \u00c2\u00a0I already have a Netgear ReadyNAS box, so I thought this should be easy. \u00c2\u00a0However, I soon found out that video surveillance solutions from [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[67,45],"tags":[69,68,73,82],"class_list":["post-398","post","type-post","status-publish","format-standard","hentry","category-make","category-scitech","tag-3d-print","tag-hacks","tag-linux","tag-make"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7x9xm-6q","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/posts\/398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/comments?post=398"}],"version-history":[{"count":12,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/posts\/398\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/posts\/398\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/media?parent=398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/categories?post=398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitquill.net\/blog\/wp-json\/wp\/v2\/tags?post=398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}