{"id":857,"date":"2017-12-30T12:59:22","date_gmt":"2017-12-30T04:59:22","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=857"},"modified":"2018-09-22T15:52:38","modified_gmt":"2018-09-22T07:52:38","slug":"how-i-setup-a-raspberry-pi-zero-w-cctv-camera-with-motioneye-and-raspbian-stretch-lite","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-i-setup-a-raspberry-pi-zero-w-cctv-camera-with-motioneye-and-raspbian-stretch-lite\/","title":{"rendered":"How I setup a Raspberry Pi Zero W CCTV camera with motionEye and Raspbian Stretch Lite"},"content":{"rendered":"<p>I had previously <a href=\"https:\/\/www.techcoil.com\/blog\/how-i-setup-a-cctv-camera-with-raspberry-pi-zero-w-and-motioneyeos-image-for-home-surveillance\/\" rel=\"noopener\" target=\"_blank\">built a Raspberry Pi Zero W CCTV camera with motionEyeOS<\/a> which was connected to the Wifi network of my old <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00NCEYGHE\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00NCEYGHE&linkId=5fab2f69f61013214622b6aec7d247eb\" target=\"_blank\">DLink router<\/a>.<\/p>\n<p>After I started using <a href=\"https:\/\/www.amazon.com\/Linksys-AC1900-Wireless-Router-EA7500\/dp\/B019WAQMVY\/ref=as_li_ss_tl?&imprToken=BhlRAOMtFAxEaIihXtCcrQ&slotNum=0&ie=UTF8&qid=1503367796&sr=8-2&keywords=linksys+ea7500+max-stream%E2%84%A2+ac1900&linkCode=ll1&tag=clivsperswebs-20&linkId=0d6b04850aaf8081c22c0264a2a43b9d\" rel=\"noopener\" target=\"_blank\">Linksys AC1900 Dual Band Wireless Router<\/a> as my home router, I could no longer connect to that Raspberry Pi Zero W CCTV camera.<\/p>\n<p>After reinstalling motionEyeOS a couple of times on my Raspberry Pi Zero W, I determined that motionEyeOS is not suitable for this new Wifi network.<\/p>\n<p>On the other hand, my <a href=\"https:\/\/www.techcoil.com\/blog\/setting-up-wordpress-on-raspberry-pi-zero-w-with-raspbian-stretch-lite-nginx-mariadb-and-php-as-the-lemp-stack\/\" rel=\"noopener\" target=\"_blank\">setup of WordPress on Raspberry Pi Zero W with Raspbian Stretch Lite, Nginx, mariadb and PHP<\/a> was able to connect to my new Wifi network, even after multiple system reboots. <\/p>\n<p>Hence, I figured that if I wanted to build a Raspberry Pi Zero W CCTV camera that can connect to my new Wifi network, I could use Raspbian Stretch Lite as the base operating system and install motionEye for the web frontend to view the camera footage.<\/p>\n<p>This post documents how I setup a Raspberry Pi Zero W CCTV with motionEye and Raspbian Stretch Lite.<\/p>\n<h2>Hardware used for this CCTV camera setup<\/h2>\n<p>I utilized the following hardware component for this CCTV camera setup:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B06XD18H6K\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B06XD18H6K&linkId=dfbc249fe8b4825d9c8d9e6dbb04e2bb\" target=\"_blank\"> Raspberry Pi Zero W (Wireless) & Official Case <\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B00E1GGE40\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00E1GGE40&linkId=f0914fa9c06442f5feec0d0c2b96d3c5\" target=\"_blank\">Raspberry Pi 5MP Camera Board Module<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B010Q57S62\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B010Q57S62&linkId=59d887701de92d95b419d7396cea24f9\" target=\"_blank\">SanDisk Ultra 128GB microSDXC UHS-I Card with Adapter, Black, Standard Packaging <\/a><\/li>\n<li><a title=\"Amazon page on Belkin 4-Foot MIXIT Micro USB cable\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00E65OM3Q\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00E65OM3Q&linkCode=as2&tag=clivsperswebs-20&linkId=6U5CEOWOEZBQANTR\" target=\"_blank\" data-amzn-asin=\"B00E65OM3Q\">Belkin micro USB cable<\/a> <\/li>\n<li>Unused <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=USB+charger&linkCode=ll2&tag=clivsperswebs-20&linkId=3f0cc3128101afcfe7ccdc4d9c856568\" rel=\"noopener\" target=\"_blank\">USB charger<\/a><\/li>\n<\/ul>\n<p>Note that I had utilized an earlier version of the Raspberry Pi Camera module. If you do not have a Raspberry Pi Camera module, you may want to get the <a href=\"https:\/\/www.amazon.com\/gp\/product\/B01ER2SKFS\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01ER2SKFS&linkId=b9cb4fca0f1ec7f01f9879067686d31e\" target=\"_blank\">Raspberry Pi Camera module V2<\/a> instead. <\/p>\n<h2>Required hardware to install Raspbian Stretch Lite onto the microSD<\/h2>\n<p>Raspberry Pi Zero W board will load Raspbian Stretch Lite from a microSD card. Hence, we will need to have a computer with a SD card reader. If your computer does not come with a <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00NNF4I5M?ie=UTF8&camp=1789&creativeASIN=B00NNF4I5M&linkCode=xm2&tag=clivsperswebs-20\" target=\"_blank\">SD card reader<\/a>, you have to get one.<\/p>\n<h2>Downloading Raspbian Stretch Lite for Raspberry Pi Zero W<\/h2>\n<p>Compared to Raspbian Stretch, Raspbian Stretch Lite does have a desktop environment. Hence, it is suitable to be used as the operating system for motionEye on a Raspberry Pi Zero W board.<\/p>\n<p>With the hardware on my table, I proceeded to download a copy of Raspbian Stretch Lite. As of this writing, the one that was available was dated 29th November 2017:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-download-page-dated-20171129.gif\" alt=\"Raspbian Stretch download page dated 20171129\" \/><\/p>\n<p>I clicked on the <a href=\"https:\/\/downloads.raspberrypi.org\/raspbian_lite\/images\/raspbian_lite-2017-12-01\/2017-11-29-raspbian-stretch-lite.zip\"><strong>Download Zip<\/strong><\/a> button for Raspbian Stretch Lite and saved the zip file onto my file system.<\/p>\n<h2>Installing Raspbian Stretch Lite onto the microSD card<\/h2>\n<p>Once my browser had completed the download for the <code>.zip<\/code> file, I extracted the <code>.img<\/code> file from the <code>.zip<\/code> file. The <code>.img<\/code> file was the operating system image that I used for installing Raspbian Stretch Lite onto my microSD card.<\/p>\n<p>I <a href=\"\/blog\/an-easy-way-to-install-raspberry-pi-operating-system-on-a-mac\/\" target=\"_blank\">used Etcher on my MacBook Pro to install the operating system image onto the microSD card<\/a>.<\/p>\n<p>If you are using a windows machine, you can <a href=\"\/blog\/how-to-prepare-the-operating-system-to-run-your-raspberry-pi-with-your-windows-machine\/\" target=\"_blank\">use Win32DiskImager to install the operating system for your Raspberry Pi Zero W<\/a>.<\/p>\n<p>If you are using a Linux desktop, you should be able to Etcher to install the operating system for your Raspberry Pi Zero W.<\/p>\n<h2>Enabling SSH server on Raspbian Stretch Lite first boot<\/h2>\n<p>With an SSH server running on Raspbian Stretch Lite, I do not have to find a spare keyboard, spare monitor, a <a href=\"https:\/\/www.amazon.com\/CableCreation-Mini-HDMI-Converter-Adapter-Resolution\/dp\/B01HQ2H2S2\/ref=as_li_ss_tl?ie=UTF8&qid=1512019368&sr=8-1-spons&keywords=mini-HDMI-to-HDMI+adapter&psc=1&linkCode=ll1&tag=clivsperswebs-20&linkId=55d25ff7b08f0cecca289c6a7c425ab1\" rel=\"noopener\" target=\"_blank\">mini HDMI to HDMI adapter<\/a> and a <a href=\"https:\/\/www.amazon.com\/UGREEN-Adapter-Samsung-Android-Function\/dp\/B00LN3LQKQ\/ref=as_li_ss_tl?s=electronics&ie=UTF8&qid=1512019500&sr=1-4&keywords=OTG+Cable&linkCode=ll1&tag=clivsperswebs-20&linkId=4465cebca9c0e464d7811712a7dabceb\" rel=\"noopener\" target=\"_blank\">OTG cable<\/a> in order to configure Raspbian Stretch Lite after it had booted up for the first time. <\/p>\n<p>To ensure that I had the SSH server running after the first boot, I created an empty file named \"ssh\u201d in the boot partition of the microSD card:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171212-boot-with-ssh-file.gif\" alt=\"Raspbian Stretch Lite 20171212 boot with ssh file\"\/><\/p>\n<h2>Getting Raspberry Pi Zero W connect to your 2.4 GHz Wi-Fi network on first boot<\/h2>\n<p>The SSH server is the first piece to allow remote configuration of the Raspbian Stretch Lite operating system running the Raspberry Pi Zero W. The other piece is the Wi-Fi connection from my Raspberry Pi Zero W to my home network.  <\/p>\n<p>The Wi-Fi chip on Raspberry Pi Zero W connects to a 2.4 GHz Wi-Fi network. To get my Raspberry Pi Zero W to connect to my 2.4 GHz Wi-Fi network, I first created a text file with the following contents:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncountry=SG\r\nctrl_interface=DIR=\/var\/run\/wpa_supplicant GROUP=netdev\r\nupdate_config=1\r\n \r\nnetwork={\r\n        scan_ssid=1\r\n        ssid=&quot;the_2.4-hz-wireless-network&quot;\r\n        psk=&quot;the_2.4-hz-wireless-network_password&quot;\r\n        proto=WPA\r\n        key_mgmt=WPA-PSK \r\n}\r\n<\/pre>\n<p>and placed it into the boot partition of the microSD card:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171212-boot-folder-with-wpa_supplicant-and-ssh.gif\" alt=\"Raspbian Stretch Lite 20171212 boot folder with wpa_supplicant and ssh\" \/><\/p>\n<p>Be sure to replace the country, ssid and psk values to the appropriate values for your 2.4GHz Wi-Fi network.<\/p>\n<p>After I got the <code>wpa_supplicant.conf<\/code> file into the boot partition of the microSD card, I removed it from my computer and inserted it into the microSD card slot on my Raspberry Pi Zero W board.<\/p>\n<h2>Connecting the Raspberry Pi Camera Module to Raspberry Pi Zero W board and the Official Case<\/h2>\n<p>After preparing the microSD card, I inserted the microSD card into the microSD card slot on my Raspberry Pi Zero W board. With that, I could then <a href=\"https:\/\/www.techcoil.com\/blog\/connect-raspberry-pi-camera-module-raspberry-pi-zero-w-official-case\/\" target=\"_blank\">connect the Raspberry Pi Camera Module to the Raspberry Pi Zero W board and the Raspberry Pi Zero Official Case<\/a>. After assembling the parts, my Raspberry Pi Zero W CCTV camera looks like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-official-case-with-camera-module-and-zero-w-board.jpg\" alt=\"Raspberry Pi Zero Official Case with Camera Module and Zero W board\"\/><\/p>\n<h2>Booting up Raspbian Stretch Lite<\/h2>\n<p>After assembling the Raspberry Pi Zero W board to the Raspberry Pi Zero official case, I then proceeded to connect my <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00E65OM3Q\/ref=as_li_ss_tl?imprToken=jky7QAgoympL0aTiNaqUhw&slotNum=7&ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=1e64dfea82959dfcc78b306f51ad44b7\" rel=\"noopener\" target=\"_blank\">Belkin micro USB cable<\/a> to my USB charger and the power port on my Raspberry Pi Zero W board. After switching on the wall socket which my USB charger was plugged into, the Raspberry Pi Zero W board booted up the Raspbian Stretch Lite operating system.<\/p>\n<h2>Getting the IP address of my Raspberry Pi Zero W<\/h2>\n<p>When Raspbian Stretch Lite booted up, it requested an IP address from <a href=\"https:\/\/www.amazon.com\/Linksys-AC1900-Wireless-Router-EA7500\/dp\/B019WAQMVY\/ref=as_li_ss_tl?ie=UTF8&qid=1513180397&sr=8-1&keywords=Linksys+EA7500+Max-Stream+AC1900&linkCode=ll1&tag=clivsperswebs-20&linkId=44bb12933151ca6c5655e6390ca50fcb\" rel=\"noopener\" target=\"_blank\">my router<\/a>. This IP address was needed for me to SSH into my Raspberry Pi Zero W. To get the IP Address that my router had allocated to my Raspbian Stretch Lite, I went to my router's address allocation table and find an entry with the name <strong>raspberrypi<\/strong>. In my case, the router allocated <strong>192.168.1.122<\/strong> to my Raspbian Stretch Lite.<\/p>\n<h2>Getting into the Raspbian Stretch Lite operating system via SSH from my computer<\/h2>\n<p>The default credentials to log into Raspberry Pi Stretch Lite is as follows:<br \/>\nUsername: <strong>pi<\/strong><br \/>\nPassword: <strong>raspberry<\/strong><\/p>\n<p>With the default credentials and the IP address that my router had given to my Raspbian Stretch Lite, I then used SSH to get into the operating system:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nssh pi@192.168.1.122\r\n<\/pre>\n<p>I entered <strong>raspberry<\/strong> when Raspbian Stretch Lite prompted for password. With that, my Raspbian Stretch Lite greeted me with the following output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nLinux raspberrypi 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l\r\n\r\nThe programs included with the Debian GNU\/Linux system are free software;\r\nthe exact distribution terms for each program are described in the\r\nindividual files in \/usr\/share\/doc\/*\/copyright.\r\n\r\nDebian GNU\/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\r\npermitted by applicable law.\r\nLast login: Thu Dec 28 05:00:23 2017 from 192.168.1.145\r\n\r\nSSH is enabled and the default password for the 'pi' user has not been changed.\r\nThis is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.\r\n<\/pre>\n<h2>Changing the default password of the pi user<\/h2>\n<p>Since Raspbian Stretch Lite suggested that using the default password for the <strong>'pi'<\/strong> user is a security risk, the next thing that I did was to change the default password. To do so, I entered the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npasswd\r\n<\/pre>\n<p>For the three prompts that followed the command, I entered <strong>raspberry<\/strong> and my favourite password twice.<\/p>\n<h2>Configuring the locale settings on Raspbian Stretch Lite<\/h2>\n<p>The next thing that I did was to configure the locale settings for my Raspbian Stretch Lite. To do so, I first opened up the Raspberry Pi Software Configuration Tool:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo raspi-config\r\n<\/pre>\n<p>I then followed through the following screens to generate the \"en_US.UTF-8\" locale and set it as the default locale for the system environment:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-w-raspi-config-raspbian-stretch-lite-with-localisation-options-selected.gif\" alt=\"Raspberry Pi Zero W raspi-config Raspbian Stretch Lite with localisation options selected\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-stretch-lite-20171129-with-localisation-options-change-locale-selected.gif\" alt=\"raspi-config Raspbian Stretch Lite 20171129 with localisation options change locale selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-stretch-lite-screen-for-generating-en-us-utf-8-locale.gif\" alt=\"raspi-config Raspbian Stretch Lite screen for generating en-us utf-8 locale\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-stretch-lite-setting-en-us-utf-8-as-default-locale-for-system-environment.gif\" alt=\"raspi-config Raspbian Stretch Lite setting en-us utf-8 as default locale for system environment\" \/><\/p>\n<p>After doing so, I opened up <code>\/etc\/default\/locale<\/code> with nano:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/default\/locale\r\n<\/pre>\n<p>And updated the contents to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nLANG=en_US.UTF-8\r\nLC_ALL=en_US.UTF-8\r\nLANGUAGE=en_US.UTF-8\r\n<\/pre>\n<p>This would ensure that the locale settings for my Raspbian Stretch Lite persist through system reboots.<\/p>\n<h2>Changing Timezone<\/h2>\n<p>The default timezone of Raspbian Stretch Lite is \"Etc\/UTC\". However, since my Raspberry Pi Zero W will be residing in Singapore, I wanted it to follow Singapore's Timezone.<\/p>\n<p>To change the timezone on my Raspbian Stretch Lite, I used the Raspberry Pi Software Configuration Tool mentioned earlier and went through the following steps:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-w-raspi-config-raspbian-stretch-lite-with-localisation-options-selected.gif\" alt=\"Raspberry Pi Zero W raspi-config Raspbian Stretch Lite with localisation options selected\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-w-raspi-config-raspbian-stretch-lite-20171129-with-change-timezone-selected.gif\" alt=\"Raspberry Pi Zero W raspi-config Raspbian Stretch Lite 20171129 with change timezone selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-w-raspi-config-raspbian-stretch-lite-with-asia-selected.gif\" alt=\"Raspberry Pi Zero W raspi-config Raspbian Stretch Lite with Asia selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspberry-pi-zero-w-raspi-config-raspbian-stretch-lite-with-singapore-selected.gif\" alt=\"Raspberry Pi Zero W raspi-config Raspbian Stretch Lite with Singapore selected\" \/><\/p>\n<p>After configuring the Timezone, I restarted Raspbian Stretch Lite by entering the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo shutdown -r now\r\n<\/pre>\n<p>Once my Raspberry Pi Zero W had successfully restarted, I got back into my Raspbian Stretch Lite via SSH.<\/p>\n<h2>Making sure that the camera interface is enabled<\/h2>\n<p>After I got into my Raspbian Stretch Lite, the next step that I did was to make sure that the camera interface was enabled.<\/p>\n<p>To do so, I entered the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo raspi-config\r\n<\/pre>\n<p>and followed through the following configuration screens:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-on-rpi-zero-w-raspi-config-with-interfacing-options-selected.gif\" alt=\"Raspbian Stretch Lite 20171129 on rpi zero w raspi-config with Interfacing Options selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-with-p1-camera-selected.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config with P1 Camera selected\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-enabling-camera-interface-yes-no-dialog.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config enabling camera interface yes no dialog\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-camera-enabled-notification-message.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config camera enabled notification message\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-with-finish-selected.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config with finish selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-enabling-camera-interface-yes-no-dialog.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config enabling camera interface yes no dialog\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-stretch-lite-20171129-raspi-config-with-reboot-notification-yes-no.gif\" alt=\"Raspbian Stretch Lite 20171129 raspi-config with reboot notification yes no\" \/><\/p>\n<h2>Turning off LED indicator of the Raspberry Pi Camera module in Raspbian Stretch Lite<\/h2>\n<p>Since the Raspberry Pi Zero Official Case is opaque, it doesn't make much sense to turn on the camera LED indicator. Furthermore, turning off the camera LED indicator can also reduce the power consumption of my Raspberry Pi Zero W CCTV camera.<\/p>\n<p>To disable the camera LED indicator of the Raspberry Pi Camera module from Raspbian Stretch Lite, I first opened up the <code>\/boot\/config.txt<\/code> file with nano:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/boot\/config.txt\r\n<\/pre>\n<p>Added the following line at the end of <code>\/boot\/config.txt<\/code>:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndisable_camera_led=1\r\n<\/pre>\n<p>Saved the file and reboot Raspbian Stretch Lite: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo shutdown -r now\r\n<\/pre>\n<h2>Preventing Hash Sum mismatch errors<\/h2>\n<p>By default, this installation of Raspbian Stretch Lite will attempt to download packages from a mirror that is nearest to my location. However, the download processes for some of the packages threw Hash Sum mismatch errors. To prevent such errors from occurring, I configured apt-get to always download packages from archive.raspbian.org. To do so, I changed the contents of the \/etc\/apt\/sources.list file to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#deb http:\/\/mirrordirector.raspbian.org\/raspbian\/ stretch main contrib non-free rpi\r\n# Uncomment line below then 'apt-get update' to enable 'apt-get source'\r\n#deb-src http:\/\/archive.raspbian.org\/raspbian\/ stretch main contrib non-free rpi\r\n \r\ndeb http:\/\/archive.raspbian.org\/raspbian\/ stretch main contrib non-free rpi\r\n<\/pre>\n<p>After editing the \/etc\/apt\/sources.list file, I then entered the following command to persist the new configurations: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\n<\/pre>\n<h2>Installing motionEye on Raspbian Stretch Lite<\/h2>\n<p>Once the initial configurations for Raspbian Stretch Lite was done, I went on to follow the <a href=\"https:\/\/github.com\/ccrisan\/motioneye\/wiki\/Install-On-Raspbian\" rel=\"noopener\" target=\"_blank\">instructions provided by Calin Crisan on how to install motionEye on Raspbian<\/a>:<\/p>\n<ol>\n<li>Install <code>ffmpeg<\/code> and <code>v4l-utils<\/code>:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install ffmpeg v4l-utils -y\r\n<\/pre>\n<\/li>\n<li>Install <code>libmariadbclient18<\/code> and <code>libpq5<\/code> required by motion:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install libmariadbclient18 libpq5 -y\r\n<\/pre>\n<\/li>\n<li>Install <code>motion<\/code>:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo wget https:\/\/github.com\/Motion-Project\/motion\/releases\/download\/release-4.1\/pi_stretch_motion_4.1-1_armhf.deb\r\nsudo dpkg -i pi_stretch_motion_4.1-1_armhf.deb\r\n<\/pre>\n<\/li>\n<li>Install the dependencies from the repositories:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev -y\r\n<\/pre>\n<\/li>\n<li>Install <code>motioneye<\/code> globally. This will automatically pull Python dependencies (<code>tornado<\/code>, <code>jinja2<\/code>, <code>pillow<\/code> and <code>pycurl<\/code>):\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo -H pip install motioneye\r\n<\/pre>\n<\/li>\n<li>Prepare the configuration directory:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mkdir -p \/etc\/motioneye\r\nsudo cp \/usr\/local\/share\/motioneye\/extra\/motioneye.conf.sample \/etc\/motioneye\/motioneye.conf\r\n<\/pre>\n<\/li>\n<li>Prepare the media directory:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mkdir -p \/var\/lib\/motioneye\r\n<\/pre>\n<\/li>\n<li>Add an init script, configure it to run at startup and start the motionEye server:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo cp \/usr\/local\/share\/motioneye\/extra\/motioneye.systemd-unit-local \/etc\/systemd\/system\/motioneye.service\r\nsudo systemctl daemon-reload\r\nsudo systemctl enable motioneye\r\nsudo systemctl start motioneye\r\n<\/pre>\n<\/li>\n<\/ol>\n<p>After completing the instructions, I then checked motionEye status with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status motioneye\r\n<\/pre>\n<p>which returned me the following output to indicate that motionEye had started successfully:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf motioneye.service - motionEye Server\r\n   Loaded: loaded (\/etc\/systemd\/system\/motioneye.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Fri 2017-12-29 23:57:55 +08; 7s ago\r\n Main PID: 4483 (meyectl)\r\n   CGroup: \/system.slice\/motioneye.service\r\n           \u251c\u25004483 \/usr\/bin\/python \/usr\/local\/bin\/meyectl startserver -c \/etc\/motioneye\/motioneye.conf\r\n           \u251c\u25004491 \/bin\/sh -c \/usr\/bin\/ffmpeg -version\r\n           \u2514\u25004492 \/usr\/bin\/ffmpeg -version\r\n\r\nDec 29 23:57:55 raspberrypi systemd&#x5B;1]: Started motionEye Server.\r\nDec 29 23:57:57 raspberrypi meyectl&#x5B;4483]:     INFO: hello! this is motionEye server 0.38\r\n<\/pre>\n<h2>Logging into my Raspberry Pi Zero W CCTV for the first time<\/h2>\n<p>After I had installed the relevant software for my Raspberry Pi Zero W CCTV, I entered <strong>http:\/\/192.168.1.122:8765<\/strong> into the location bar of my browser to access the motionEye server. With that I was shown the following screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-login-screen.gif\" alt=\"motionEye server 0.38 login screen\" \/> <\/p>\n<p>I then entered <strong>admin<\/strong> as the username, left the password field blank and clicked on <strong>Login<\/strong>.<\/p>\n<p>With that I was shown the following screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-not-configured-any-camera-message-screen.gif\" alt=\"motionEye server 0.38 not configured any camera message screen\" \/><\/p>\n<h2>Adding the Raspberry Pi Camera module to motionEye server<\/h2>\n<p>The motionEye server instance did not auto-detect my Raspberry Pi Camera module. As such, I had to manually add the Raspberry Pi Camera module to the motionEye server.<\/p>\n<p>To do so, I clicked on the message and chose the \"Local MMAL Camera\" option in the dialog that appeared:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-add-local-mmal-camera-screen.gif\" alt=\"motionEye server 0.38 add local mmal camera screen\"\/><\/p>\n<p>Once I clicked on <strong>OK<\/strong>, I was shown the following screen with video streaming from my Raspberry Pi Camera module:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-after-adding-local-mmal-camera.jpg\" alt=\"motionEye server 0.38 after adding Local MMAL Camera\"\/><\/p>\n<h2>Making sure that my Raspberry Pi Zero W CCTV camera can only be accessed through my user account<\/h2>\n<p>By default, motionEyeOS allows anybody with a browser to watch the camera video stream of my Raspberry Pi Zero W CCTV camera without any restriction. I am definitely not comfortable with this default setting. Hence, the next configuration that I made to my Raspberry Pi Zero W CCTV camera was to set some passwords to restrict access to the camera stream.<\/p>\n<h3>Setting a password for the admin user<\/h3>\n<p>In motionEyeOS, only the admin user is allowed to configure motionEyeOS and the username of the admin user cannot be changed.<\/p>\n<p>To set a password for the admin user, I entered a password in the \"Admin Username\" text field.<\/p>\n<h3>Creating the surveillance user<\/h3>\n<p>The surveillance user is only granted view access to the video stream from my Raspberry Pi Zero W CCTV camera. Configuring a username and password for the surveillance user would ensure that the video stream from my Raspberry Pi Zero W CCTV camera only displays after either the surveillance user or admin user logs in successfully.<\/p>\n<p>To create a surveillance user, I entered a username in the \"Surveillance Username\" field and a password in the \"Surveillance Password\" text field.<\/p>\n<h3>Saving the new user credentials for the admin user and surveillance user<\/h3>\n<p>After I had entered the new credentials for the admin user and surveillance user, I clicked on the \"Apply\" button at the top to commit the changes. <\/p>\n<p>Once I did so, my motionEye server showed the login screen again. I entered my new admin credentials to continue with the rest of the configurations.<\/p>\n<p>When I had logged in successfully with my admin user, I clicked on the hamburger icon on the top left corner of the screens to bring out the configurations panel.<\/p>\n<h2>Turning on Advanced Settings for motionEye server<\/h2>\n<p>With the access control configured, the next thing that I did was to turn on \"Advanced Settings\" so that I could configure my Raspberry Pi Zero W CCTV further.<\/p>\n<p>To do so, I clicked on the toggle button next to \"Advanced Settings\" under the \"General Settings\" tab:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-after-turning-on-advanced-settings.jpg\" alt=\"motionEye server 0.38 after turning on Advanced Settings\"\/><\/p>\n<h2>Changing video resolution on motionEye server<\/h2>\n<p>The default video resolution that came with my motionEye server installation was 640 X 480. Since I had a 128 GB microSD card, I could afford my videos having a higher resolution. As such, I changed the video resolution to \"1024 X 768\" from the drop down box besides \"Video Resolution\" and clicked \"Apply\" at the top:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-after-setting-video-resolution-to-1024x768.jpg\" alt=\"motionEye server 0.38 after-setting-video resolution to 1024x768\" \/><\/p>\n<h2>Limiting the preservation of still images and movies<\/h2>\n<p>By default, motionEyeOS keeps images and movies for as long as it can. In the event where the storage space on the microSD card got maxed out, it will stop recording movies. This is not an ideal behaviour for my use case. To ensure that there is always storage space for new videos, there is a need to limit the preservation of still images and movies.<\/p>\n<p>To configure the preservation period of pictures and movies, I clicked on the hamburger icon to bring out the configuration panel. Inside the configuration panel, I clicked on the \"Still Images\" and \"Movies\" tabs to expand both sections. I then chose the \"For One Month\" option for both the \"Preserve Pictures\" and \"Preserve Movies\" drop down boxes.<\/p>\n<p>Changes to both drop down boxes caused the following prompt to appear:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-after-changing-preserve-pictures-option.jpg\" alt=\"motionEye server 0.38 after changing preserve pictures option\" \/><\/p>\n<p>I clicked the \"Ok\" button on both prompts and got the following configuration state:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/motionEye-server-0.38-configurating-perserve-pictures-and-movies-to-one-month.jpg\" alt=\"motionEye server 0.38 configurating perserve pictures and movies to one month\" \/><\/p>\n<p>Once I was done with that, I clicked on the \"Apply\" button at the top to persist the configurations and rebooted my Raspberry Pi Zero W CCTV camera.<\/p>\n<p>With that, I was satisfied with the configurations that I wanted for my Raspberry Pi Zero W CCTV camera.<\/p>\n<h2>Making my Raspberry Pi Zero W CCTV camera accessible from outside my home network through HTTPS<\/h2>\n<p>Up to this point, I had configured a Raspberry Pi Zero W CCTV camera which I can access from computers that are connected to the same Wifi network that my Raspberry Pi Zero W CCTV camera had connected to.<\/p>\n<p>However, being able to access my Raspberry Pi Zero W CCTV from the Internet will be useful for me. Furthermore, I would want to access my Raspberry Pi Zero W CCTV via HTTPS. Without HTTPS, it would be insecure to access my Raspberry Pi Zero W CCTV camera from outside my home network. <\/p>\n<p>As mentioned in my post on <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-host-multiple-websites-from-home\/\" rel=\"noopener\" target=\"_blank\">how to host multiple websites from home<\/a>, protecting the HTTP traffic between a web browser and my Raspberry Pi Zero W CCTV camera would require a <a href=\"https:\/\/www.techcoil.com\/blog\/the-reverse-proxy-server\/\" rel=\"noopener\" target=\"_blank\">reverse proxy server<\/a>, a domain name and a SSL certificate. That reverse proxy server must receive port 80 and 443 traffic that is directed at the home router.<\/p>\n<p>Since I had already <a href=\"https:\/\/www.techcoil.com\/blog\/building-a-reverse-proxy-server-with-nginx-certbot-raspbian-stretch-lite-and-raspberry-pi-3\/\" rel=\"noopener\" target=\"_blank\">setup a reverse proxy server with Certbot installed<\/a>, I could use it as a proxy for HTTPS traffic made to my Raspberry Pi Zero W CCTV.<\/p>\n<h3 id=\"create-subdomain-at-digitalocean\">Creating a sub domain from a domain that I already owned and point that sub domain to the public IP address of my home router<\/h3>\n<p>Since I own a couple of domain names, I could create a sub domain from one of the domain names. And since I am leveraging on DigitalOcean name servers to translate my domain names into IP addresses, I could create a sub domain via DigitalOcean's control panel. <\/p>\n<p>To create a sub domain via DigitalOcean's control panel, I logged into my <a href=\"https:\/\/m.do.co\/c\/68b7d9b94341\" target=\"_blank\">Digital Ocean<\/a> account and go to the \"Networking\" page. I then proceeded to the \"Domain\" tab to select a domain which I wanted to create a sub domain from. <\/p>\n<p>At the \"Create new record\" page, I entered the sub domain that I wanted for my Raspberry Pi Zero W CCTV camera and the public IP address of my home router:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/digital-ocean-page-to-create-a-new-type-a-dns-record-for-cctv-camera.gif\" alt=\"Digital Ocean page to create a new Type A DNS record for CCTV camera\" \/><\/p>\n<p>After clicking on the \"Create Record\" button, I was able to get the IP address of my home router by sending a ping to <code>cctv.adomainname.com<\/code>.<\/p>\n<p>And being able to reach my home router will meant that I was able to reach <a href=\"https:\/\/www.techcoil.com\/blog\/building-a-reverse-proxy-server-with-nginx-certbot-raspbian-stretch-lite-and-raspberry-pi-3\/\" rel=\"noopener\" target=\"_blank\">my reverse proxy server<\/a>.<\/p>\n<h3>Configuring Nginx to facilitate Certbot in acquiring the SSL certificate for my sub domain<\/h3>\n<p>Once I was sure that the Nginx server running on my <a href=\"https:\/\/www.techcoil.com\/blog\/building-a-reverse-proxy-server-with-nginx-certbot-raspbian-stretch-lite-and-raspberry-pi-3\/\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3 reverse proxy server<\/a> could receive <a href=\"https:\/\/www.techcoil.com\/glossary\/http-request\/\" rel=\"noopener\" target=\"_blank\">HTTP requests<\/a> directed at my sub domain, I proceeded on with creating the Nginx configurations to facilitate Certbot in acquiring the SSL certificate for my sub domain.<\/p>\n<p>To do so, I connected to my <a href=\"https:\/\/www.techcoil.com\/blog\/building-a-reverse-proxy-server-with-nginx-certbot-raspbian-stretch-lite-and-raspberry-pi-3\/\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3 reverse proxy server<\/a> via SSH:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nssh pi@192.168.1.123\r\n<\/pre>\n<p>Once I got into my Raspberry Pi 3 reverse proxy server, I used nano to create a configuration file at <code>\/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf\r\n<\/pre>\n<p>Once inside my nano editor, I created the following nginx configuration:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n\tlisten 80;\r\n\tserver_name  cctv.adomainname.com;\r\n\r\n\troot \/var\/www\/cctv.adomainname.com;\r\n\r\n\tlocation ~ \/.well-known {\r\n\t\tallow all;\r\n\t}\r\n}<\/pre>\n<p>After creating the Nginx configurations, I saved the file and restarted my Nginx server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<p>I also created the directory <code>\/www\/var\/cctv.adomainname.com<\/code> for Certbot to use in the process of acquiring the SSL certificate for my sub domain:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mkdir \/www\/var\/cctv.adomainname.com\r\nsudo chown www-data:www-data \/www\/var\/cctv.adomainname.com\r\n<\/pre>\n<h3>Running Certbot to get the SSL certificate artefacts for the sub domain to my Raspberry Pi Zero W CCTV camera<\/h3>\n<p>Once I had the configurations necessary for Certbot to acquire the SSL certificate artefacts for my sub domain, I ran the following command to get Certbot running:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo certbot certonly -a webroot --webroot-path=\/var\/www\/cctv.adomainname.com -d cctv.adomainname.com\r\n<\/pre>\n<h3>Generating a strong Diffie-Hellman group<\/h3>\n<p>After the SSL certificate and the corresponding private key were created successfully, I went on to precompute a strong Diffie-Hellman group for my server to use for exchanging cryptographic keys with its clients:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo openssl dhparam -out \/etc\/ssl\/certs\/dhparam.pem 2048\r\n<\/pre>\n<p>This process took a very long time to complete but it was worth the effort as it would make communicating with my server more secure.<\/p>\n<h3>Creating the Nginx configurations for serving HTTPS on behalf of my Raspberry Pi Zero W CCTV camera<\/h3>\n<p>Once I had the corresponding SSL certificate artefacts for my sub domain, my Nginx was ready for the corresponding configurations to serve HTTPS on behalf of my Raspberry Pi Zero W CCTV camera. The following is the last set of configurations that I included in <code>\/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf<\/code>. These set of configurations allows me to access my Raspberry Pi Zero W CCTV camera over HTTPS via my sub domain:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# Redirect HTTP requests to HTTPS \r\nserver {\r\n\tlisten 80;\r\n\tserver_name  cctv.adomainname.com;\r\n\treturn 301 https:\/\/$host$request_uri;\r\n}\r\n\r\n# For ssl\r\nserver {\r\n\tssl on;\r\n\tssl_certificate \/etc\/letsencrypt\/live\/cctv.adomainname.com\/fullchain.pem;\r\n\tssl_certificate_key \/etc\/letsencrypt\/live\/cctv.adomainname.com\/privkey.pem;\r\n\tssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n\tssl_prefer_server_ciphers on;\r\n\tssl_dhparam \/etc\/ssl\/certs\/dhparam.pem;\r\n\tssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';\r\n\tssl_session_timeout 1d;\r\n\tssl_session_cache shared:SSL:50m;\r\n\tssl_stapling on;\r\n\tssl_stapling_verify on;\r\n\tadd_header Strict-Transport-Security max-age=15768000;\r\n\t\r\n\tdefault_type  application\/octet-stream;\r\n\t\r\n\tlisten 443;\r\n\tserver_name  cctv.adomainname.com;\r\n\r\n\troot \/var\/www\/cctv.adomainname.com;\r\n\r\n\tlocation ~ \/.well-known {\r\n\t\tallow all;\r\n\t}\r\n\r\n\tlocation \/ {\r\n\t\tproxy_pass http:\/\/192.168.1.122:8765;\r\n\t}\r\n}\r\n<\/pre>\n<p>With that, I had setup a Raspberry Pi Zero W CCTV camera with motionEye and Raspbian Stretch Lite that I could access from the Internet via HTTPS.<\/p>\n<h2>Buying your Raspberry Pi Zero W CCTV camera from Amazon<\/h2>\n<p>If you do not have the Raspberry Pi Zero W CCTV components mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi Zero W CCTV components to your cart. You may remove anything that you already have or replace some of the components with other components.<\/p>\n<p><center><\/p>\n<form action=\"https:\/\/www.amazon.com\/gp\/aws\/cart\/add.html\" method=\"GET\" target=\"_blank\"><input name=\"AssociateTag\" type=\"hidden\" value=\"clivsperswebs-20\"><input name=\"SubscriptionId\" type=\"hidden\" value=\"[AKIAIMND5UBCQU2HRSUA]\"><input name=\"ASIN.1\" type=\"hidden\" value=\"B06XD18H6K\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B01ER2SKFS\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B010Q57S62\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><input name=\"ASIN.4\" type=\"hidden\" value=\"B00E65OM3Q\"><input name=\"Quantity.4\" type=\"hidden\" value=\"1\"><br \/>\n<input alt=\"Buy from Amazon.com\" name=\"add\" type=\"image\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/associates\/remote-buy-box\/buy4.gif\" value=\"Buy from Amazon.com\"><\/form>\n<p><\/center><\/p>\n<h2>Further enhancements for your Raspberry Pi Zero CCTV camera<\/h2>\n<p>If you want to make your Raspberry Pi Zero W CCTV camera see a wider view, you may want to get a pack of  <a href=\"https:\/\/www.amazon.com\/Fisheye-Magnetic-Camera-iPhone-Samsung\/dp\/B00Y2BEPR2\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=90e4fb21f439fb02d6a5ec3fbe16d765&language=en_US\" rel=\"noopener\" target=\"_blank\">Camera Lens Kit for mobile phones<\/a>. In case, you are curious about the effects of those lens, <a href=\"https:\/\/www.techcoil.com\/blog\/comparing-the-0-67x-wide-angle-lens-and-the-fisheye-lens-on-a-raspberry-pi-cctv\/\" rel=\"noopener\" target=\"_blank\">this is a comparison of the 0.67x wide angle lens and the Fisheye lens on a Raspberry Pi CCTV<\/a>.<\/p>\n<p>Since there is a 0.67x wide angle lens and a Fisheye lens in the pack, you will have the option to:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.techcoil.com\/blog\/how-to-turn-your-raspberry-pi-zero-w-cctv-into-a-wide-angle-security-camera\/\" rel=\"noopener\" target=\"_blank\">turn your Raspberry Pi Zero W CCTV into a wide angle security camera<\/a>.<\/li>\n<li><a href=\"https:\/\/www.techcoil.com\/blog\/how-to-make-your-raspberry-pi-zero-w-camera-see-an-ultra-wide-view\/\" rel=\"noopener\" target=\"_blank\">make your Raspberry Pi Zero W camera see an ultra-wide view<\/a>.<\/li>\n<\/ul>\n<h2>Reducing the number of false positives for your video recordings<\/h2>\n<p>When your surveillance area has a background with changes that you are not interested in capturing, your Raspberry Pi Zero W CCTV will create a lot of redundant video recordings. In such a situation, you may want to <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-configure-motioneye-to-only-capture-video-if-there-are-movements-in-particular-sections-of-the-surveillance-area\/\" rel=\"noopener\" target=\"_blank\">configure motionEye to only capture video if there are movements in particular sections of the surveillance area<\/a>.<\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-dP\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-dP&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-dP&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F857&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p>I had previously <a href=\"https:\/\/www.techcoil.com\/blog\/how-i-setup-a-cctv-camera-with-raspberry-pi-zero-w-and-motioneyeos-image-for-home-surveillance\/\" rel=\"noopener\" target=\"_blank\">built a Raspberry Pi Zero W CCTV camera with motionEyeOS<\/a> which was connected to the Wifi network of my old <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00NCEYGHE\/ref=as_li_tl?ie=UTF8&#038;tag=clivsperswebs-20&#038;camp=1789&#038;creative=9325&#038;linkCode=as2&#038;creativeASIN=B00NCEYGHE&#038;linkId=5fab2f69f61013214622b6aec7d247eb\" target=\"_blank\">DLink router<\/a>.<\/p>\n<p>After I started using <a href=\"https:\/\/www.amazon.com\/Linksys-AC1900-Wireless-Router-EA7500\/dp\/B019WAQMVY\/ref=as_li_ss_tl?&#038;imprToken=BhlRAOMtFAxEaIihXtCcrQ&#038;slotNum=0&#038;ie=UTF8&#038;qid=1503367796&#038;sr=8-2&#038;keywords=linksys+ea7500+max-stream%E2%84%A2+ac1900&#038;linkCode=ll1&#038;tag=clivsperswebs-20&#038;linkId=0d6b04850aaf8081c22c0264a2a43b9d\" rel=\"noopener\" target=\"_blank\">Linksys AC1900 Dual Band Wireless Router<\/a> as my home router, I could no longer connect to that Raspberry Pi Zero W CCTV camera.<\/p>\n<p>After reinstalling motionEyeOS a couple of times on my Raspberry Pi Zero W, I determined that motionEyeOS is not suitable for this new Wifi network.<\/p>\n<p>On the other hand, my <a href=\"https:\/\/www.techcoil.com\/blog\/setting-up-wordpress-on-raspberry-pi-zero-w-with-raspbian-stretch-lite-nginx-mariadb-and-php-as-the-lemp-stack\/\" rel=\"noopener\" target=\"_blank\">setup of WordPress on Raspberry Pi Zero W with Raspbian Stretch Lite, nginx, mariadb and PHP<\/a> was able to connect to my new Wifi network, even after multiple system reboots. <\/p>\n<p>Hence, I figured that if I wanted to build a Raspberry Pi Zero W CCTV camera that can connect to my new Wifi network, I could use Raspbian Stretch Lite as the base operating system and install motionEye for the web frontend to view the camera footage.<\/p>\n<p>This post documents how I setup a Raspberry Pi Zero W CCTV with motionEye and Raspbian Stretch Lite.<\/p>\n","protected":false},"author":1,"featured_media":1198,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[275,431,277,266,474,225,240,410,409,412,445,423],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/Raspberry-Pi-Zero-W-CCTV-held-by-mobile-phone-holder-clamped-to-desk.jpg","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-dP","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/857"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=857"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1198"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}