Skip to content

Guide: Motion Sensor Surveillance Box

Amanda Hickman edited this page May 11, 2017 · 7 revisions

Overview

Motion Sensor Surveillance Box is a cost efficient way to tell a story with video snippets that have been triggered by sensors. The snippets can be captured in one sitting or over the course of several days. Later, the footage can be edited together and set to music to share the story of a family or friendly gathering. The prototype here is housed in holiday packaging and can be placed near a Christmas tree.

Complete instructions (including set-by-step photos) to build your own Motion-Sensor Surveillance Box will be linked in coming days.

Project Goals

This project was created with the following questions in mind:

  • What kind of storytelling can happen when sensors, and not humans, trigger video recording?
  • With sensor-triggered video, what is the quality and consistency? How does it compare to other footage?
  • What is the human-user experience of sensor-triggered video? Does the user feel empowered or helpless? What is it like interfacing and interacting with the prototype?

How It Works

Motion Sensor Surveillance Box is a tier of gift boxes housing a microcomputer which powers and controls an infrared camera. The coin-sized camera module is taped to the side of the middle box and rests against a pin-hole cut out. The computer runs a Python script that uses computer vision to detect motion above a specified threshold. To determine motion, the camera continuously compares two consecutive images to detect a change between the former and latter. The camera compares the delta of the images to the threshold. At the threshold, it considers this a detection of motion, launches into preview mode and records that preview for one minute. Otherwise, it continues comparing images.

How It Connects

The microcomputer can run without a display, keyboard and mouse following initial configuration in a new location. This is often referred to as operating “headless”. The accessories are initially required to connect to a new location’s WiFi network and establish remote access. Once remote access has been established all functions of the microcomputer will be executable from a designated desktop or notebook on the same network. Remotely sharing a computer’s desktop is achieved through a process called virtual network computing (VNC).

VNC requires a client, host and viewer. The client is usually a web application or a piece of software while the host and viewer refer to the connecting computer and destination computer, respectively. VNC allows full operation of the hosting machine as if it were another window your own computer. With VNC you'll have very few concerns over digital storage on the host machine because files can seamlessly be transferred between host and viewer.

Project Specifications

  • Raspberry Pi 3 Model B + power supply ($40)
  • Raspberry Pi NoIR Camera V2 ($20)
  • 32 Gb Micro SD card + Adapter ($20)
  • Bluetooth Keyboard & Mouse ($20)
  • LCD Color Monitor (HDMI)
  • "Rainbow Pibow" Raspberry Pi Enclosure ($20, optional)
  • Cardboard boxes and wrapping paper or other housing ($10)

Prototype User Guide

Establishing VNC Connection Over WiFi (Viewer & Host Connection)

  1. Download & install RealVNC Viewer (client) on the viewing machine.
  2. Identify camera pinhole in middle box. Place gift set under the tree with a good view and near an outlet.
  3. Plug in the gift set, monitor and accessories.
  4. On RPi desktop, navigate to the upper right corner and connect to your WiFi network.
  5. Launch VNC Server from upper right corner (look for VNC logo).
  6. Launch terminal and enter vncserver to start VNC server and determine RPi’s IP address.
  7. On the viewing machine launch VNC Viewer. Begin a new session (CTRL + N).
  8. Enter the RPi’s IP address then press enter. Double-click the icon containing the IP you just entered.
  9. Bypass/accept security warning.
  10. Prototype connection credentials: there is no username, password: 'buzzfeed'

Launching the motion detection script

  1. With RPi accessories removed, use the viewing computer to establish VNC connection to the RPi desktop.
  2. Navigate to folders through a series of double-clicks - PATH:pi/santa_cam/raspxmas.py
  3. Double click the Python script to open (raspxmas.py).
  4. From the Run menu, select 'Run Module'. You will see a spew of numbers! This is good, very good.
  5. The script will initially detect a false positive and launch into record and preview mode for 1 minute. (Preview mode only happens when launching the script directly from the Raspberry Pi.)
  6. Next, the program will record for one minute following the actual detection of motion. Video files will save to that same folder. PATH:pi/santa_cam

Deleting Files

  1. With VNC Viewer you are able to select any file on the host and use the drop menu to move them to the wastebasket. You can also empty the wastebasket afterwards.

Moving Files

  1. Use the VNC Viewer to select "Transfer Files" from the drop-menu (bottom, right drop menu).
  2. Select the files you'd like to send to your viewing machine and transfer.
  3. You may follow above directions to delete the video files after successfully transferring.

Viewing Files

  1. Project files will output in a .h264 format. You may need a special media player to view them.
  2. If so, download & install VLC (http://www.videolan.org/vlc/download-macosx.html)
  3. Launch VLC and drag & drop the .h264 videos to watch.

Suggested Software for converting .h264 files

  • Adobe Premiere (adobe.com)
  • MPEG Streamclip (squared5.com)
  • FFMpeg (ffmpegx.com)

Troubleshooting

A list of common issues (read: things that drove me crazy during this project) will be added in coming days.