Home Surveillance with Raspberry Pi and Azure Storage

No monthly or annual cloud service cost at all, and all the photo send to Azure Storage (very cheap) immediately.

Hardwares

  1. Raspberry Pi 2 : http://www.makershed.com/products/raspberry-pi-2
  2. TF card (recommand 8GB, I use my existing one)
  3. Camera with night vision : http://www.ebay.com/itm/301282564581
  4. PIR Sensor for motion detection : http://www.ebay.com/itm/261455286898
  5. Female to Female jumper wire: http://www.ebay.com/itm/201206217951

Optional

Breadboard: http://www.ebay.com/itm/221446294579

WIFI Dongle: http://www.ebay.com/itm/200899513388

Initialize Raspberry Pi 2

http://www.raspberrypi.org/help/noobs-setup/

Wiring

Raspberry Pi connect to Camera using special cable, which is already included in the package.

Connecting to PIR Sensor take some time, here are the reference :

  1. PIR Sensor diagram: http://stak.com/image/cache/data/products/235/235914/hc-sr501-labelled-alt-800x800.png
  2. Raspberry Pi 2 GPIO diagram: http://pi.gadgetoid.com/pinout

So Pi pin 6 (GND), connect to PIR GND.

Pi pin 2 (5V), connect to PIR VCC.

Pi pin 11 (BCM 17), connect to PIR OUT.

Programming

The most convenience language code on Raspbian is Python, while in my understand it’s like Powershell on Windows.

Luckly, we got most of the modules we need:

  1. GPIO Module: http://sourceforge.net/p/raspberry-gpio-python/wiki/Home/
  2. PiCamera Module: https://github.com/waveform80/picamera
  3. Azure Module: http://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/

Then the code is really simple:

Keep pulling status from BCM 17, which is hooked to OUT from PIR, once it return true, take a photo and send to Azure Storage, which is very cheap.

https://onedrive.live.com/redir?resid=7164423b65582034!377596&authkey=!AFZ_yvt9oQUiE8w&ithint=file%2cpy