Monday, December 23, 2013

Raspberry Pi Home Security + Automation - Phase 2

Update: I was able to get the RF outlets to work using a cheap transmitter from Ebay. So the below method is just here for documentation purposes.Check out my post here

I added more functionality to my system described in my earlier post here. As part of phase 2, I added internet controlled outlet/switch control via the Pi. This is an easy way to convert an RF outlet switch to a web controlled one.

I picked up a remote + 3 RF outlet switches  (433Mhz) from Ebay which are manufactured by DB-Tech.

Remote control outlet switch socket









There is a single button to toggle the outlet on/off. My initial intent was to use a RF receiver to decode the code sent by the remote and replicate it. I tried several methods including the ones outlined here to use your PC soundcard + Audacity to decode your waveforms, but my attempts were unsuccessful.

So I opened up the remote and it looks like this: (ignore the wires - that is something I added, as you will see later in the post)



It uses 3 simple buttons and a PT2262 Encoder. It comes with 12V battery to power it. The datasheet of the encoder can be found here. I noticed that the supply voltage is rated at 4-15V and I tried to power the circuit via the Raspberry Pi GPIO. I was pleased to discover that it works for voltages slightly below 4 as well!

So I soldered  3 wires to the switches by tracing the pins that would be normally be connected to the +ve of the 12 V supply.  The other end of the wires are driven by 3 Pi GPIO. I used a crocodile clip to connect the Pi GND line to the -ve supply of the circuit (normally connected to the battery -ve).




This solution does not scale too well with the number of outlets, so I have to find something better eventually.

The next steps are pretty straightforward and involve adding new macros to the existing webiopi interface (from phase 1) to control those GPIO. I found that a delay of 0.5 sec between driving a high and low provides enough time for an outlet to be switched on/off.

I also have cron jobs that run python scripts to power these outlets on/off at different times automatically. This can be really useful for repetitive tasks like switching on/off a light every night or turning on an electric kettle every morning.

The end result is an internet controlled home automation system that lets you power on/off different electrical devices.

Here is the updated web server interface:


Just in time for Christmas, here is a short video showing how I turn on my Christmas Tree lights using the interface on a phone.

video







7 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. That post sounded more like a marketing message for ADT and had no relevance to this post.

      Delete
  2. I saw this blog and I have benefited a lot. From this site I hope you can stomach the price of good quality and dighasthayi batteries. With the Li ion 12 Volt battery, 12v LED Products, cctv Camera and Baby Monitor, DC Connector and 12V Charger is lso available in all types of batteries.
    For more information about their services, feel free to visit their site http://www.amazon.com/dp/B00E8CDOFY/.

    ReplyDelete
  3. Hey this is cool stuff. I have installed DCS home scurity alarm system. It did not have email or sms facility. So did a small RPI project to send an email, SMS and recently integrated GTalk message when Alarm is ON.

    Your project is much great ...congrats.. ..

    ReplyDelete
  4. Its necessary to put any valuable items in a good Fireproof Safe. Thus, if anyone planning to keep there important documents at there own home, than Safes in NYC is wonderful option.
    burglary safe

    ReplyDelete
  5. It is nice to read your post and you share some good points online fashion. Please keep posting such kind of stuff.

    ReplyDelete
  6. I can't confirm for certain that the burglary aspect is true. What I can confirm is that there is a company named "Home Protection" out there,  Alarmtech CCTV

    ReplyDelete