How to Make a £59 Fully Featured Raspberry Pi Home Security Camera – Newbie Guide

This tutorial will explain how to create your own CCTV IP Webcam using a Raspberry Pi Zero Wireless £9 computer!

It uses the excellent RPi Web Cam Interface open source software, which offers a near real-time live video stream via a web interface for the Raspberry Pi camera module, as well as motion detection video recording.

It can be used for a wide variety of applications including surveillance, dvr recording and time lapse photography. It is highly configurable and can be extended with the use of macro scripts. It can be opened on any browser (smartphones included) and contains the following features:

  • View, stop and restart a live-preview with low latency and high framerate. Full sensor area available.
  • Control camera settings like brightness, contrast, … live
  • Record full-hd videos and save them on the sd-card packed into mp4 container while the live-preview continues
  • Do timed or continuous video recording with splitting into fixed length segments
  • Take single or multiple (timelapse) full-res pictures and save them on the sd-card (live-preview holds on for a short moment)
  • Preview, download and delete the saved videos and pictures, zip-download for multiple files
  • Trigger captures by motion detection using internal or external detection processes.
  • Trigger captures by many scheduling-possibilities
  • Circular buffer to capture actions leading up to motion detection
  • Control Pan-Tilt or Pi-Light
  • Shutdown/Reboot your Pi from the web interface
  • Show annotations (eg timestamp) on live-preview and taken images/videos
  • Supports selection from 2 cameras when used with a compute module

The software is fully functional with a Pi Zero Wireless, offering a small footprint that operates over wifi and only requires a power source.

The example here uses a 160 degree fisheye camera module that gives a much better field of view than the standard official camera (and is fully compatible). If you don’t need a better viewing angle, the official Pi Zero case fully integrates the official camera into a very neat little package!

You can also buy a 160 degree fisheye IR (infrared) camera that comes with IR LED lights which are powered and attached to the camera board. There are also many more camera options at Modmypi, such as a 222 degree fisheye, and an IR on/off camera.


Total: £59.54


Write an Image onto the SD Card
We will be using the lite version of Raspberry Pi’s official operating system as the base for our security camera.

  1. Download RASPBIAN JESSIE LITE from

    Screen Shot 2017-07-01 at 17.17.55 v2

  2. Download Etcher which we will use to burn the image to an SD card (this supports Windows, OSX, and Linux, and is really easy to use):

    Screen Shot 2017-07-01 at 17.18.41

  3. Insert your microSDXC card into your computer
  4. Run Etcher and press the Select Image button
    Screen Shot 2017-07-01 at 17.19.42

  5. Find your previously saved file from step 1 (or whichever version is the latest)
    Screen Shot 2017-07-01 at 17.21.26

  6. Your SD card may already be automatically detected, but if not press the Change link to select the card.
  7. Press the Flash button
    Screen Shot 2017-07-01 at 17.29.06

  8. Once finished, Etcher will automatically unmount the SD card. However, remove and plug the card back in so that we can copy some files to the SD card.
  9. Given that the Pi Zero W has limited ports, performing an initial configuration such as connecting to wifi or enabling SSH would require a keyboard and monitor. This can be avoided by putting two text files in the top-level directory of the SD card, one to enable SSH and the other to set up wifi by including details within the text file.
    1. The inserted SD card should be labelled boot and contain files called bootcode.bin, config.txt, etc.
    2. Create a new text file in the same location as the previously mentioned files called “ssh”. Note that it’s not called ssh.txt, and obviously don’t include the quotes (“”). This text file can be empty as it’s just the file name which enables ssh.
    3. Create another new text file called “wpa_supplicant.conf”. This file does need some information contained within, so open the file with a text editor such as notepad. Paste in the following lines of text and update the ssid and psk lines with your local wifi details.
      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    4. Your SD card should now have the above two mentioned files as seen below. Once you’ve finished, properly eject the SD card from your computer.
      Screen Shot 2017-07-01 at 18.25.25
  10. Put your SD card into the Pi Zero and then assemble the ribbon cable, case, and camera. Don’t power the Pi on just yet though…

    Determine the IP address

  11. When the Pi powers up, it will obtain an IP address automatically from your router. You will want to know what this IP is, but unless you plug in your Pi to a monitor (which is an option via the HDMI port), you need to determine the IP another way. This is where a very useful local network scanning utility called Fing comes in. Fing is an iOS or Android app that will show you all devices on your network and their IP address.
    1. Download Fing from the Appstore (or find more details from their website
    2. Run Fing and let it scan your network. If you already have any Raspberry Pi devices, make a note of their IP so you can discount them when you turn the Pi on.
    3. Turn on your Raspberry Pi Zero and give it 3 or so mins to boot.
    4. Scan your network using Fing again, and all being well you should hopefully see a new Raspberry Pi entry with it’s IP address! The hostname will be called “raspberrypi”
    5. If a new IP doesn’t appear, double check your wifi settings by inserting the SD card back into your computer and looking at or editing wpa_supplicant.conf. If that method still doesn’t work, plug the Pi into your monitor or TV via the HDMI port (you may need a mini to normal HDMI converter).
  12. If you’re using Windows, you will need a way to SSH to your Pi for remote access to install the software. Download Putty (putty-64bit-0.69-installer.msi) from and install. If you’re using macOS, just open Terminal (press cmd+space and type in Terminal to find it).
    1. For Putty instructions, please follow this guide:
    2. For macOS, at the terminal simply type (replacing with your Pi’s IP address).
      ssh pi@
    3. The default password is raspberry
  13. You should now be at your Pi’s command prompt:
    pi@raspberrypi:~ $

    Update the Pi and Enable the Camera

  14. Let’s update the software by running the following lines one at a time:
    sudo apt-get update
    sudo apt-get upgrade
  15. Let’s change the password:
  16. It’s a good idea to give the Pi a static IP address. This excellent tutorial covers how to do this:
  17. We now need to enable the camera and set the timezone. This can be done by running:
    sudo raspi-config
    1. Select Interfacing Options from the menu
      Screen Shot 2017-07-02 at 17.42.49

    2. Select Camera and then Yes and then Ok
    3. Back at the main menu, select Localisation Options and then Change Timezone
    4. As an example for the UK, select the following:
      Europe -> London
  18. Now close the window by selecting Finish, and press Yes to reboot
  19. SSH back into the Pi using Putty or terminal.

    Install RPi Web Cam Interface

  20. If you aren’t there already, cd into your home directory
    cd ~
  21. Install git (because this isn’t included with Jessie Lite by default)
    sudo apt-get install git vim
  22. Run the following (either a line at a time or all at once is ok)
    git clone
    cd RPi_Cam_Web_Interface
    chmod u+x *.sh
  23. You should now be presented with the Configuration Options screen. To navigate this page, pressing tab will jump between the options window and the Ok/Cancel buttons. When in the options window, use the arrow keys to move up and down.
    Screen Shot 2017-07-02 at 18.36.53
    Cam subfolder – best leave this at the default html. You would only need to change this if you were hosting multiple sites on the same Pi
    Autostart – Leave it at Yes so that the software starts automatically after a reboot
    Server – Leave this at Apache. There are other options, but for ease of use Apache is the best choice.
    Webport – If you are thinking of accessing the camera from outside your home, it is best this port is changed to something between 1024 and 65535. Make a note of the number if it’s something other than 80.
    User – Set a username. You could leave this empty if you’re only ever going to access the camera from within your network, but it’s advised to set a user and pass for extra security.
    Password – Set a password
    jpglink – Leave this set to no, it’s for backwards compatibility

  24. Press Ok when you have set your desired options
  25. Press Yes to Start Now.

    Accessing the Web Interface

  26. All being well, you should now be able to enter your Pi’s IP address into a web browser. e.g

    If you used a different port, enter this as follows:
  27. Hopefully you can now see a live stream from your camera
    Screen Shot 2017-07-02 at 19.01.25

  28. Let’s change a few key options at this point. Notice how the camera is upside down? This can be rotated in 90 degree intervals from the “Rotation, default 0:” option within Camera Settings. In this case we will choose Rotate_180:
    Screen Shot 2017-07-02 at 19.04.01

  29. The default resolution is 1080p, but you loose a lot of the sensor with this, so within Camera Settings -> Resolution, from the Load Preset drop-down menu, choose Max View 972p 4:3
    Screen Shot 2017-07-02 at 19.07.04

  30. If the annotation text along the top of the video feed (showing date/time) blends too much into a white background, change Camera Settings -> Annotation -> Background (drop-down menu) to On.
    Screen Shot 2017-07-02 at 19.12.23

    Enabling Motion Detection

  31. Change Motion Detect Mode (within Camera Settings) to Internal
    Screen Shot 2017-07-03 at 16.54.51

  32. Adjust the parameters such as Noise Level, Threshold, etc within motion Settings. Full details on what these do can be found here:

That is it! Feel free to explore the Wiki, and if you have any questions there’s an active support forum here:

Advanced Guides

If you would like to see what else is possible with these cameras, please have a look at some of my other guides: