{"id":756,"date":"2013-02-20T00:24:48","date_gmt":"2013-02-19T23:24:48","guid":{"rendered":"http:\/\/quantum-bits.org\/?p=756"},"modified":"2022-08-12T17:33:44","modified_gmt":"2022-08-12T16:33:44","slug":"project-jarvis-step-four-look-at-me","status":"publish","type":"post","link":"https:\/\/www.quantum-bits.org\/?p=756","title":{"rendered":"Project &#8220;Jarvis&#8221;: step five (look at me)"},"content":{"rendered":"<p>Tonight, I&#8217;ll go for a very simple hack: connect a webcam, detect motions and stream a live feed over HTTP. Not sure how it&#8217;ll fit with Project &#8220;Jarvis&#8221;, but who knows &#8230;<\/p>\n<p><a href=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1297\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks.jpg\" alt=\"rasbperrypi-hacks\" width=\"985\" height=\"503\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks.jpg 985w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks-300x153.jpg 300w\" sizes=\"(max-width: 985px) 100vw, 985px\" \/><\/a><\/p>\n<p><strong>Hardware<\/strong><\/p>\n<p>First things first: the hardware. For some reasons, the only webcam that I had was an old Apple <a title=\"iSight\" href=\"http:\/\/en.wikipedia.org\/wiki\/ISight\" target=\"_blank\" rel=\"noopener\">iSight<\/a>. You know, the old firewire one&#8230; Since there is no IEEE 1394A port on the Raspberry Pi, I had to buy a new one.<\/p>\n<p>I settled for a Hewlett-Packard HD-2300 USB webcam. I took a chance, since it was not on <a href=\"http:\/\/elinux.org\/RPi_VerifiedPeripherals\" target=\"_blank\" rel=\"noopener\">hardware compatibility list<\/a>, but it was available, reasonably priced for its category, and didn&#8217;t look like too bad (I know, it is silly, but it is actually one of my buying criteria):<\/p>\n<p><center><img decoding=\"async\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2013\/02\/hp-hd-2300.png\" alt=\"\"><\/center><\/p>\n<p>Nevertheless, it appeared right away:<br \/>\n&nbsp;<\/p>\n<pre highlight=\"8\" lang=\"bash\">root@applepie \/etc\/motion # lsusb\nBus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. \nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\nBus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. \nBus 001 Device 004: ID 050d:1102 Belkin Components F7D1102 N150\/Surf Micro Wireless Adapter v1000 [Realtek RTL8188CUS]\nBus 001 Device 005: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub\nBus 001 Device 006: ID 04b8:0007 Seiko Epson Corp. Printer\nBus 001 Device 007: ID 03f0:e207 Hewlett-Packard\nroot@applepie \/etc\/motion #\n<\/pre>\n<p>A subsequent &#8220;lsusb -v&#8221; command gave my nice details about the webcam. Cool \ud83d\ude0e<\/p>\n<p><strong>Setting up &#8220;Motion&#8221;<\/strong><\/p>\n<p>Now, the software part. Motion is a nice piece of Open Source software that (among other thing):<\/p>\n<ul>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">Does motion detection (and optionnaly record video and\/or frames whenever a motion is detected)<\/span><\/li>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">Takes timed snapshots regardless of motion detection.<\/span><\/li>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">Lives video IP stream in MJPEG format.<\/span><\/li>\n<\/ul>\n<p>The installation was pretty easy:<\/p>\n<pre line=\"1\" lang=\"bash\">apt-get install motion\n<\/pre>\n<p>I only changed a a few settings. Namely:<\/p>\n<ul>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">I turned &#8220;start_motion_daemon&#8221; to &#8220;yes&#8221; in \/etc\/default\/motion to enable the daemon<\/span><\/li>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">I switched &#8220;location&#8221; to &#8220;on&#8221; in \/etc\/motion\/motion.conf to turn motion detection on<\/span><\/li>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">I switched &#8220;webcam_localhost&#8221; to &#8220;off&#8221; in \/etc\/motion\/motion.conf to enable access to live streams from anywhere on the LAN<\/span><\/li>\n<li style=\"list-style: square inside; color: #aaaaaa;\"><span style=\"color: #666666;\">I tweaked the &#8220;text_left&#8221; setting to let the message &#8220;ApplePie&#8221; appear on the bottom left of the streams<\/span><\/li>\n<\/ul>\n<p>I left all the other setting as they were (including frame rates and resolution, as it was only a matter of test), and fired up the daemon:<\/p>\n<pre line=\"1\" lang=\"bash\">\/etc\/init.d\/motion start\n<\/pre>\n<p>I set the Firefox&#8217;s URL to http:\/\/applepie:8081 (as 8081 is the default port used by motion), pointed the webcam at my &#8220;<a href=\"http:\/\/en.wikipedia.org\/wiki\/Forbidden_Planet\" target=\"_blank\" rel=\"noopener\">Forbidden Planet<\/a>&#8221; poster and shook the cam a bit to simulate a motion:<\/p>\n<p><center><img decoding=\"async\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2013\/02\/webcam-raspi.png\" alt=\"\"><\/center>Not bad \ud83d\ude42 It thought that <a href=\"http:\/\/en.wikipedia.org\/wiki\/Robby_the_Robot\" target=\"_blank\" rel=\"noopener\">Robby the robot<\/a> moved. Now, that&#8217;s kinda cool \ud83d\ude0e<\/p>\n<p>I guess, that&#8217;s it for tonight (and was quite easy, as it was widely documented on many other web sites).<\/p>\n<p>Note: for some reason, I have not received yet a password for my requested account on elinux.org wiki, even though I got the e-mail address confirmation message and activated the account. I guess I&#8217;ll update the Raspberry Pi compatibility list later.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tonight, I&#8217;ll go for a very simple hack: connect a webcam, detect motions and stream a live feed over HTTP. Not sure how it&#8217;ll fit with Project &#8220;Jarvis&#8221;, but who &#8230;<\/p>\n","protected":false},"author":1,"featured_media":3853,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[5,21],"tags":[],"_links":{"self":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/756"}],"collection":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=756"}],"version-history":[{"count":0,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/media\/3853"}],"wp:attachment":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}