I read an article about using the RPI as a surveillance camera and about putting one inside a dummy camera, so I had a go at trying it out with the latest Pi Zero (v1.3) ie the one with the CSI connector.

First things first, the Pi zero v1.3 has a smaller CSI camera connection that is used with the Compute module Pi.

Here are list of materials used:

  • the Pi Zero (v1.3) with the small CSI camera connector
  • the newer PI NOIR camera (v2.1 which has the newer chip ie the Sony IMX219 8-megapixel but it should work with the other ones from 2013
  • the Pi Zero camera cable
  • usb Wifi dongle (edup 150n which uses the Realtek RTL8188CUS chipset)
  • SanDisk microSD card 64Gb, but you can use smaller, but recommend Class 10 for speed)
  • Konig Dummy CCTV Outdoor with flashing IR LEDs, available on the net, like Amazon, ebay, etc..
  • 2 standard AA batteries to power the cameras flashing IR
  • Raspbian Jessie Linux OS (there is a customised version of motionEye but I like to do it myself to understand how everything works
  • microUSB power supply like the official one or one with enough output to power the Pi Zero (5volts, 1mA)
  • mini to HDMI adapter & HDMI cable & monitor or TV with HDMI (only used for initial configuration)
  • usb keyboard (only used for initial configuration)

I hope that by now you know how to write a distro image to your microSD or SD card so I'll skip that bit but if your stuck read the Raspberry's own foundation help pages and maybe use NOOBS, but for this tutorial I am using Raspbian Jessie without PIXEL https://www.raspberrypi.org/downloads/raspbian/

The next step involves install eyeMotion (again if you used the motionEyeOS you can skip this bit)

First we need to do the initial configuration, like expand File system, naming the pi, Enable camera and most importantly the WiFi as the Zero like A has no Ethernet port.  

So with the Pi Zero connected with a mini HDMI connected to my LED TV I boot up Raspbian Jessie.

Login with default user pi and password raspberry

NB As changing all configurations in Linux most commands are pre-fixed with the sudo as the pi user is not allowed too.

So with that in mind start with

sudo raspi-config

Here we will choose 1 to expand to our full SD card

The resize will be performed after a reboot

Next we will enable the camera (not yet connected), so using the arrow keys move down to number 6, choose Enable and then Ok

In screen 9 Advance Options, you can find sub option A2 which allows you to give your Pi a new name.

Once you've finished you will be asked if you'd like to reboot.

Once backup I configure the wifi, using nano https://www.nano-editor.org/

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Of course change country (using raspi-config) SSID and psk to match your own settings, then press CTRL+O to save file and then CTRL+X to exit nano.

I also edit /etc/network/interfaces to ensure the WiFi will work

sudo nano /etc/network/interfaces

Same again using nano and putting the relevant ssid and psk

NB To be able to access your PI from the net you might want to use a static ip address instead of DHCP, or alternatively like me I set this in my modem/router so that the MAC address is always receiving the same IP using DHCP

With the WiFi configured go ahead and shutdown pi and connect the camera.

Once booted up again you can check if your connected to your WiFi with a simple ping command

ping -c 5 www.google.com

You should see something like this

If all working use ifconfig to know your Pi's IP address and we can now use a remote ssh connection and disconnect the keyboard, and hdmi, be sure to power off before disconnecting.

If your on a Windows machine I recommend PuTTY http://www.chiark.greenend.org.uk/~sgtatham/putty/ or on a Mac, then you can use the built-in Terminal (Applications folder => click on the Utilities folder => then click on Terminal)

Now that all the prep work is done we start with adding motionEye software and configuring it.

motion needs ffmpeg which is currently not in the official stable Debian repos so we use this prebuilt package from the author of motionEye (Github site) to do this put the following command

sudo wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb

Then install with

sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb

Next we get and install the dependencies, command is 

sudo apt-get install python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 v4l-utils

Next we get motion

sudo wget https://github.com/ccrisan/motioneye/wiki/precompiled/motion-mrdave-raspbian -O /usr/local/bin/motion

Then change motion permission to an execute only with 

sudo chmod +x /usr/local/bin/motion

Now we use pip to install motionEye (which will also install any other missing dependencies with the following command 

sudo pip install motioneye 

Next we configure, first creating a config directory with the following command 

sudo mkdir -p /etc/motioneye 

Then we copy over a sample configuration file to the directory we just made 

sudo cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf 

Now we will create a media directory for motion to store capture(s) each camera connect will have it's own sub directory created when we add the cameras to web GUI 

sudo mkdir -p /var/lib/motioneye 

Finally we copy an init script to automatically start the motionEye server on boot up and activate the service 

sudo cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
sudo systemctl daemon-reload
sudo systemctl enable motioneye
sudo systemctl start motioneye 

With this done I always prefer to do a reboot to verify if all worked okay, as I mentioned earlier I use my modem/router to always assign the same IP using DHCP linked to the MAC address, as their are many different pieces of hardware available use the following keywords in your favourite search engine "fixing an ip based on mac address"

So if all install well you can now use another computer, tablet or smartphone to access the web front end, simply open a browser and type

http://your pi's ip address:8765/

If working you will be asked to login, use admin with no password, which is the first you should set before adding any cameras.