Caleb Madrigal

Programming, Hacking, Math, and Art

 

Raspberry Pi Home Security System

3 Years ago (2013), I built my own home security/automation system with a Raspberry Pi. Here's what it looks like:

Raspberry Pi Home Security System

What it does

  • Allows controlling a couple outlets via a mobile web app
  • Alarm system enabled/disabled via mobile web app
  • If alarm enabled, magnetic door sensor would trigger siren and turn on outlets

Hardware used

  • Raspberry Pi - $35
    • Edimax EW-7811Un 150Mbps 11n Wi-Fi USB Adapter - $10
  • Off-the-shelf remote controlled outlet kit - $20
  • Off-the-shelf wireless magnetic door sensor/outlet - $25
  • Car siren - $8
  • Breadboard, transistors, photoresistor, resistors, wires, soldering iron

Total cost of parts: ~$115

Software used

I wrote the controller software in Python (with ZeroMQ, Flask, Rpi.GPIO, and jQuery Mobile): https://github.com/calebmadrigal/rpi-home-automation.

It's made of up 3 components:

DNS Tunneling with Iodine

DNS Tunneling can be useful for getting out of a very restrictive corporate firewall (since almost nobody blocks DNS).

DNS Tunneling works by encoding IP protocol inside of DNS packets. Iodine is a cross-platform implementation of DNS Tunneling. This mini-guide will walk through the process of setting up a DNS Tunnel with Iodine.

Prerequisite: You will need a server with public IP and domain name

Setup DNS Tunnel

Setup DNS Records

Add 2 DNS records to your domain's DNS system:

* `A record`: tunnelhost -> your ip (maps tunnelhost.yourdomain.com to your server's ip)
* `NS record`: tunnel -> tunnelhost.yourdomain.com

Example:

DNS Setup

So now for me:

* `tunnelhost.calebmadrigal.com` now points to `104.236.122.169`
* `tunnel.calebmadrigal.com` now points to `tunnelhost.calebmadrigal.com`
    - **This is the ...

How to SSH Tunnel

When to use an SSH Tunnel?

An SSH Tunnel is perfect for the following scenarios:

  • You want to get to a website that a corporate network is blocking.
  • You want to encrypt the network traffic for a non-encrypted protocol.

What is an SSH Tunnel?

An SSH Tunnel is where you tell your local SSH Client to forward your local computer's traffic to a specified SSH Server (over the encrypted SSH protocol). The SSH Server will then act as a proxy for all requests you make on your local computer.

SSH Tunnel

How to set up an SSH Tunnel

There are 2 steps to set up an SSH Tunnel, and they both happen on your local computer (no configuration is needed on the SSH server which will be acting as ...

Running Ubuntu on VirtualBox in Windows

I'm mostly a Mac user and I also really like Linux (especially Ubuntu), but I hate Windows. However, I'm occasionally required to use Windows at work, so I've found a way to make using Windows more enjoyable: to use Ubuntu (installed on VirtualBox inside of Windows) instead of Windows for everything except for the few tasks which require Windows.

So I have made this little How to Install Ubuntu on VirtualBox in Windows setup guide:

Contents

  • Install VirtualBox
  • Download Ubuntu 12.04 ISO file
  • Create and configure a Virtual Machine
  • Tweak Virtual Machine hardware settings
  • Install Ubuntu in the Virtual Machine
  • Make Ubuntu nicer to use in VirtualBox
  • Using your new Virtual Ubuntu system

Install VirtualBox

  • Download installer from: https://www.virtualbox.org/wiki/Downloads ...