9.1 What You Need

I originally designed this project using a relay switch that we would have constructed part by part. This relay would have been used to turn on and off the power to the electric door latch. But after reviewing the potential safety hazards associated with improper wiring and handling of the circuit, I decided to take a safer, more conservative approach.

Instead of wrestling with the potentially jolting perils of accidental relay shocks, we will use a product specifically designed to address these concerns. Called the PowerSwitch Tail II, this simple switch houses a relay that can control standard 120V electrical devices. The relay can be energized via a 5V signal from a digital pin of a microcontroller board such as an Arduino or, in the case of this project, the PIC-based IOIO board. The PowerSwitch Tail’s prebuilt relay circuit is far easier and safer than building your own, and the cost is quite reasonable compared to the expense of procuring and assembling these parts on your own.

Rather than using an Arduino connected to a computer for data processing and control, we are going to use an Android phone connected to Sparkfun’s IOIO board. This hardware combination will serve the same function as an Arduino/PC coupling but without the size, bulk, and energy requirements that an always-on Arduino/PC combination would entail.

So what exactly is an IOIO board? It is a hardware bridge that allows Android phones to communicate with whatever sensors and motors are connected to the board. The IOIO board connects to the phone via Android’s USB debugging pathway. This pathway can be used to send and receive signals to and from the IOIO’s onboard PIC processor.

IOIO’s designer, Google software engineer Ytai Ben-Tsvi, designed the IOIO prior to Google’s official Open Accessory Protocol (ADK) initiative,[85] but he is working to make the board fully compatible with the ADK specification. The ADK is part of Google’s Android@Home home automation initiative. Investing in the board not only gives you the tools you need to make it work today, but it will also play nice with the future Android@Home APIs. And even more importantly, the IOIO works especially well today for custom projects like the one we will build.

Here is a list of all the parts we will need to construct the Android Door Lock (refer to the photo in Figure 37, Android Door Lock parts (some preassembled)):

/epubstore/R/M-Riley/Programming-your-home//images/androiddoorlockparts-labeled.jpg

Figure 37. Android Door Lock parts (some preassembled)
  1. A PowerSwitch Tail II (PN 80135)[86]

  2. A 2.1mm female barrel jack cable to safely connect the 12V power supply to the electric door strike[87]

  3. A 5VDC 1A power supply[88]

  4. A 12V 5A switching power supply to electrify the electric door strike[89]

  5. Three pieces of wire

  6. An Android OS smartphone with a built-in camera, preferably the original Android G1 phone. This phone can be purchased from sites like http://craigslist.org or http://ebay.com for under $100 US. Note that not all Android phones are compatible with the IOIO Board. Check the IOIO Board discussion group for more details.[90]

  7. A barrel jack to 2-pin JST cable that will connect to the IOIO board’s JST right angle connector[91]

  8. A Sparkfun IOIO Board with JST right angle connector[92]

  9. A Smarthome Electric 12VDC Door Strike[93]

  10. A standard A to Mini-B USB cable to connect the G1 Android phone to the USB port on the IOIO board

You will also need a second Android device (phone, tablet, etc.) that can run the Door Lock client application along with the Eclipse IDE, Android SDK 1.5 or higher, and the Android Development Tools (ADK) plugin for Eclipse. Refer to the Chapter 7, Web-Enabled Light Switch project for more details about the Android development requirements.

While this project is one of the most expensive to build in this book, it is also one of the most flexible in terms of reusing and extending the hardware investment. Once you become familiar with how to leverage the IOIO board with an Android phone, you will understand why Google is so enthusiastic about their Android@Home effort. You will also learn how you can easily create a new category of home automation applications implementing your own ideas. But before you can attain those greater heights of actualization, you have to understand the basics. That’s what we’re going to do in the next section.

Programming Your Home
cover.xhtml
f_0000.html
f_0001.html
f_0002.html
f_0003.html
f_0004.html
f_0005.html
f_0006.html
f_0007.html
f_0008.html
f_0009.html
f_0010.html
f_0011.html
f_0012.html
f_0013.html
f_0014.html
f_0015.html
f_0016.html
f_0017.html
f_0018.html
f_0019.html
f_0020.html
f_0021.html
f_0022.html
f_0023.html
f_0024.html
f_0025.html
f_0026.html
f_0027.html
f_0028.html
f_0029.html
f_0030.html
f_0031.html
f_0032.html
f_0033.html
f_0034.html
f_0035.html
f_0036.html
f_0037.html
f_0038.html
f_0039.html
f_0040.html
f_0041.html
f_0042.html
f_0043.html
f_0044.html
f_0045.html
f_0046.html
f_0047.html
f_0048.html
f_0049.html
f_0050.html
f_0051.html
f_0052.html
f_0053.html
f_0054.html
f_0055.html
f_0056.html
f_0057.html
f_0058.html
f_0059.html
f_0060.html
f_0061.html
f_0062.html
f_0063.html
f_0064.html
f_0065.html
f_0066.html
f_0067.html
f_0068.html
f_0069.html
f_0070.html
f_0071.html
f_0072.html
f_0073.html
f_0074.html
f_0075.html
f_0076.html
f_0077.html
f_0078.html
f_0079.html
f_0080.html
f_0081.html
f_0082.html
f_0083.html
f_0084.html
f_0085.html
f_0086.html
f_0087.html
f_0088.html
f_0089.html
f_0090.html
f_0091.html
f_0092.html
f_0093.html
f_0094.html
f_0095.html
f_0096.html
f_0097.html
f_0098.html
f_0099.html
f_0100.html
f_0101.html
f_0102.html
f_0103.html
f_0104.html
f_0105.html
f_0106.html
f_0107.html
f_0108.html
f_0109.html
f_0110.html
f_0111.html
f_0112.html
f_0113.html
f_0114.html
f_0115.html
f_0116.html
f_0117.html
f_0118.html
f_0119.html
f_0120.html
f_0121.html
f_0122.html
f_0123.html
f_0124.html
f_0125.html