Wizworks

DIY, Technology, Imagination

  • 95.1FM The Mothership
  • HOME
  • PROJECTS
    • Ammo Can Hotspot
    • DLNA Network Media Player
    • Free TV
    • Home Automation
    • LED Kitchen Makeover
    • Misc Wireless
    • PBX for the home
    • Power Supply
  • RESOURCES
    • Blameless Bittorrent
    • FSK RADIOS
    • Ham Radio – D-Star
    • Single Board Computers
    • Streaming Radio Feeds
  • RADIO STATION – K1WIZ
  • Contact

Motion triggered camera

Posted by K1WIZ on December 2, 2016
Posted in: Projects.

I recently setup a wireless front door security camera to watch and notify of any visitors to our front porch.  During the holidays, there’s a lot of package stealing being reported in the news.  I am prepared!  My home made system does the following:

  • uses passive infrared (PIR) to detect motion within 30 feet
  • sends a push notification of the detection to my smartphone via pushover
  • records 2 minutes of 1080p video & converts it on the fly from H264 to .mp4
  • uploads the .mp4 file over wifi to my NAS for safe keeping and later viewing
  • sends another push notification when the .mp4 file is uploaded
  • continues to watch for the next motion event to record

The camera and PIR sensor are mounted in a weatherproof enclosure and can be powered from any DC source from 7-35v.  Here are some close up pictures.  Click for larger image:

file_000 file_001 file_002 file_003

 

 

 

 

 

 

 

 

 

 

 

 

 

The logic:

  • PIR motion event causes the sensor to send a 3v signal to GPIO pin 26 on the raspberry pi computer.
  • When pin 26 goes high, it is read by the “detect” function and stored in a variable.
  • The IF logic uses the variable for detection to either process video recording or return to the continuous loop.
  • The continuous loop runs every second

How to setup:

  • grab the latest copy of raspbian-jessie-lite image (no gui)
  • burn jessie lite image to MicroSD card
  • run raspi-config to set options (internationalisation, and turn the camera socket on if using a camera module – recommended)
  • log in using raspbian default pi user and install necessary packages, update, & reboot the pi:
    • sudo apt-get update
    • sudo apt-get dist-upgrade
    • sudo reboot
    • sudo apt-get install rsync wiringpi gpac htop exfat-fuse exfat-utils
  • insert a large capacity USB stick to cache video recording to & format it with exfat file system and mount to /video
    • fdisk /dev/sda (change partition to type exfat)
    • mkfs.exfat -n video /dev/sda1
    • create /video directory
    • edit /etc/fstab and set mount point for USB exfat key to /video (this ensures the USB is mounted on each boot) Your video files will process on the USB key before being uploaded by rsync (you need a NAS or server that can receive the incoming rsync stream).
  • setup wifi (/etc/wpa_supplicant/wpa_supplicant.conf)

wifi-setup

 

The loop is a simple bash loop called by /etc/rc.local and runs whenever the unit is turned on:

loop

 

The file containing the functions does all the heavy lifting:

pi-mocam

 

Posts navigation

← 3 Flickering Candle Holiday Light
ESP8266 WiFi module used with Domoticz →
  • What are you looking for?

  • Here’s What’s Happening

    • From CSV to JSON using PHP November 30, 2021
    • Mic McCloud – A Cloud Microphone November 22, 2021
    • Setting up Liquidsoap for AAC+ streaming November 4, 2021
    • Recycling Swap October 23, 2021
    • DIY High Power Smart Switch October 2, 2021
    • DDNS script using Cloudflare October 1, 2021
    • Create your own WiFi QR Code September 29, 2021
    • How to tell when your school is watching you at home September 24, 2021
    • Garage Door Operation June 29, 2021
    • FM / Raspberry Pi Translator May 27, 2021
    • Smart Solar Powered Landscape Lighting May 1, 2021
    • Streaming Municipal Services March 29, 2021
  • Galactic Archives

    • November 2021 (3)
    • October 2021 (3)
    • September 2021 (2)
    • June 2021 (1)
    • May 2021 (2)
    • March 2021 (1)
    • February 2021 (1)
    • December 2020 (2)
    • September 2020 (1)
    • July 2020 (1)
    • June 2020 (1)
    • October 2019 (1)
    • July 2019 (1)
    • June 2019 (1)
    • January 2019 (1)
    • December 2018 (2)
    • August 2018 (1)
    • July 2018 (1)
    • January 2018 (1)
    • November 2017 (1)
    • October 2017 (2)
    • September 2017 (1)
    • January 2017 (1)
    • December 2016 (1)
    • November 2016 (1)
    • September 2016 (1)
    • August 2016 (1)
    • July 2016 (1)
    • May 2016 (1)
    • March 2016 (3)
    • November 2015 (1)
    • October 2015 (2)
    • July 2015 (1)
    • March 2015 (6)