Skip to content

Instantly share code, notes, and snippets.

@nicinabox
Created March 9, 2016 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicinabox/b3802487ad1baaf00375 to your computer and use it in GitHub Desktop.
Save nicinabox/b3802487ad1baaf00375 to your computer and use it in GitHub Desktop.

Building and tuning a Raspberry Pi security camera

Parts

  • Raspberry Pi (I picked up a new 2B)
  • Camera module
  • Wifi adapter
  • Power adapter (5.1V 2.1A)
  • Micro USB
  • Micro SD card
  • Enclosure
  • Mounting hardware

Assembly

Pretty straightforward here. Pi goes in the enclosure. Install the SD card. Plug in the wifi adapter. Plug it in to your tv and plug in the power.

Mounting

You’ll have to think creatively about this one depending on where you want to mount it. I was able to mount mine with a clamp-based GoPro mount directly over an outlet. Since mine is inside pointed through a window I didn’t have to worry about waterproofing and running power outside. I do get a reflection at night if the inside lights are brighter than the outside lights, however.

OS

First I tried Raspian with motion, then motion-mmal. I kept having issues with wifi dropping no matter what power management settings I specified. After about week not being able to get it working in a way I wanted, I tried motionPie.

MotionPie is a BuildRoot based Linux distro. It doesn’t have a package manager and it’s not meant for other purposes other than to be a surveillance OS. The performance of motionPie is significantly better. I’m able to get a solid 15fps at 1440x1024. That’s both streaming and saved videos.

For whatever reason wifi also stopped dropping on motionPie and I’m pretty happy with this setup.

If you decide to go the motionPie route, the wiki is very helpful: https://github.com/ccrisan/motionPie/wiki

Tuning

Here are some basic things I did to tweak my setup from the defaults:

  • Use wifi instead of ethernet
  • Write video to a network share (a server in my house)
  • Keep video for a week
  • Enable automatic brightness (doesn’t work as well at night though)
  • Change frame rate to 15fps
  • Change video resolution to 1440x1024
  • Change video streaming to 15fps
  • Change video streaming quality to 75%
  • Change motion gap to 30 seconds
  • Preserve movies for 1 week

Your mileage may vary, so don’t be afraid to tweak settings for your own application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment