Apress - Smart Home Automation with Linux (2010)- P4 pdf

5 299 0
Apress - Smart Home Automation with Linux (2010)- P4 pdf

Đang tải... (xem toàn văn)

Thông tin tài liệu

xiv Acknowledgments For every word I’ve written, five have been discarded. Such is the nature of writing. For every ten programs I’ve downloaded, tried, and tested, nine have been discarded. Such is the nature of software. Finding a perspicuous overlap has been a long and arduous tasks, and one that I’d wish for no one to suffer in solitude. Fortunately, I didn’t To those enduring the role of first-line support to my restless questions and curiosity, I thank you. Phil Downer, Mal Lansell, and Frank Scott will be collecting their magniloquent medals in due course! The greatest of thanks go to those developers, reviewers, evangelists, and forum posters over whose shoulders we’ve all peered to learn and discover, with those active on UKHA_D, GLLUG, Lonix, FAB, and TULS having all played their part. Thanks also to those manufacturers that have supplied me with test hardware to verify my assumptions about their wares. They include Dr. Chris Dodge, technical director at RedRat Ltd.; Alan Quinby of Keene Electronics Ltd.; Benjamin Gilbert at Anders Electronics; and Melanie Jeuken at Marmitek for the crystal-clear images of the X10 kit. Also thanks to Chris Vine at IntelliSoftware Ltd. and Darren Daws at Txtlocal Ltd. for allowing me send junk text messages through their systems until I got it right! My thanks also to Duncan Parkes, Anne Collett, Matt Wade, and their respective editorial and production teams at Apress for fixing my mistakes before my readers realize I’ve made them! To my network of friends, colleagues, and associates: Dean Butcher, David Eade, Ed and Margaret Grabowski, Lucas Grange, Justine Griffith, Phillip Hart, Mike Knight, Andy Leigh, Phil Lunt, Colin Murphy, Shane O’Neill, Cveta Rahneva, Steve Shipton, Michał Skorupka, John Southern, Fiona Stewart, Josiane Valverde, and Dave Wall. And, as always, to my family: Grandma, Shirley and Ken, Juliette and Dean, Melanie and Dan and Grace, Mum and Dad, Angela and Colin, and Holly (who’s probably still not old enough to understand it!). Steven Goodwin xv Introduction Home automation (HA) is anything that your home does for you automatically to make living there more enjoyable or productive. A smart home is one that appears to apply intelligence to make that happen. To my friends, family, and visitors, my home is both smart and automated; I can e-mail my light switches, I can receive tweets from my CD player, and I have a personalized TV guide e-mailed to me every day. To me, my home is a collection of existing open source software, some consumer-level hardware, and small pieces of glue code that make them all interact. The magic happens in the way they are combined, and it’s those secrets I’ll be exposing in this book. The most cogent phrase in this field is probably “The devil is in the details.” HA requires small confirmed tools that do a single, specific job in much the same way that Unix utility software does one job and does it well. Consequently, my decision to adopt Linux as the underlying operating system is no accident. Unlike the monolithic approach of Microsoft Windows®, there are large repositories of open source software that perform these individual jobs. SMS handling, media playback, X10 control, e-mail, web servers, speech synthesis, and everything in between is freely available—and, more importantly, interoperable. Throughout the book I will reference many different technologies and languages that I consider to be the most suitable to the task at hand. In some cases, this will refer to old technology that is no longer the cutting edge, since those are the devices that have been made to work effectively with Linux through (primarily) developer support. The glue code uses Perl, PHP, C++, and Bash. Each was chosen according to the merits of the language and which modules made the task easier, not with any presupposed advocacy. The book begins by covering appliance control and the whys, wherefores, and how-tos of controlling devices such as your teakettle, CCTV, light switches, and TV from a computer. It then covers the other devices you can build, adapt, or hack yourself from existing technology. The Arduino, for example, can be employed as part of an automated doormat that reminds you to take your umbrella when the weather forecast spells rain or that today is when the garbage is collected. The book then covers media systems, discovering how to automate and replace the aging combination of the VCR and TV guide by using computer-oriented solutions. The technology can automatically suggest shows, sending their recommendations to your e-mail inbox or mobile phone, and can provide a means of recording them. Then, the book covers the technical considerations necessary when running a computer 24/7, the methods of wiring a home network, and the methods of preparing your home for the patter of tiny silicon feet! This is followed by how to use and install communication protocols, which allow anything in your home to talk to anything else and which is the first step toward true technology homogeneity. Finally, the book covers the data sources that provide the information to make your home appear intelligent and the software and processes necessary to combine everything learned into a unified whole. The specifics. The glue code. The details that make the magic work! ■ INTRODUCTION xvi I will end on a note of carefree abandon—learn to steal! Once you’ve learned the pieces of the puzzle and how to combine them, there is very little new to invent. Every new idea you discover is a mere permutation of the old ideas. And ideas are free! Every cool feature discussed on TV shows or presented in the brochures or web sites of commercial HA companies can be taken, adapted, and implemented with the information presented here using very little effort. And then you will graduate from an automated home to a smart home to a personalized smart home! C H A P T E R 1 ■ ■ ■ 1 Appliance Control Making Things Do Stuff For most people, home automation begins and ends with the principle of appliance control. When any household device such as a video or TV is controlled by something other than a button on its front panel or its original remote control, it is deemed somewhat magical and a topic of further inquiry, particularly if the control is done remotely. Lights and toasters don’t need to be controlled by a wall switch, and your TV doesn’t need to be fed signals from your video, DVD player, or satellite receiver. Each device has its own idiosyncrasies and control methods, and each has specific functionality that cannot easily be abstracted into any general-purpose form of control interface. However, it is possible to control the vast majority of them using one of two basic methods: • Mains line-powered control (lightbulbs, toasters, electric teakettles) • Infrared (IR) remote control (TV, video) Although modern set-top boxes might have a serial, USB, or network socket on the back, these are in addition to the previous two methods, not exclusive of them. Therefore, being able to control IR signals and the power lines covers the majority of devices in the modern home. Even relatively unsophisticated appliances such as teakettles, which were built without any intention of them being controlled by another means, can be controlled remotely if you know how to control their power source. After all, if you ensure the teakettle is full of water and plugged into a wall-switched socket and the teakettle itself is switched on, then the only necessary task to start the water boiling is to flick the switch on the wall socket—something that can be governed by mains control. And it is these methods of controlling the mains power that I’ll cover first. X10 X10 is one of the methods I’ll cover that allows you to remotely control the power of any device plugged into the standard ring main in your home. The lights, electric teakettle, and toaster are all examples of existing devices in this category. Additionally, I’ll cover devices that were originally invented to be controlled by X10 such as motorized curtain rails. X10 achieved its market penetration by being fairly cheap and very easy to install. CHAPTER 1 ■ APPLIANCE CONTROL 2 About X10 X10 is a control protocol that sends data packets along the mains power line with messages such as “turn device on” or “dim to 50 percent.” The data packets are applied to the power lines by a transmitter such as a computer interface or a custom-built remote control, and they’re processed by a much simpler receiver device, such as a light switch, which in turn controls the power to the local device. X10 works by encoding the data in high-frequency bursts (of 120KHz) and adding it to the existing power line. Because the mains supply in all countries is either 50Hz or 60Hz (with Japan and Tahiti using both!), these high-frequency signals are customarily lost by most devices that are looking only to consume power. On the other hand, a special device can be plugged into the power line that is interested in high-frequency bursts. It is consequently possible to recognize one binary digit of data every time the voltage goes from positive to negative, or vice versa. ■ Caution Several devices are available that are based on this principle, with most do-it-yourself (DIY) stores stocking their own variant. If they do not contain the X10 logo, however, they are not compatible with X10 because their protocols differ. They can also conflict with each other. Every device that is to be controlled by X10 must have an address. This address comprises two parts: a house code and a unit code. The house code is simply a letter, from A to P, and should be unique to your house. Obviously, with only 16 letters to choose from, the house code won’t be unique to every house in the world, but it should be unique to any property that shares your immediate mains supply. This usually comprises your neighbors, and occasionally the property two or three doors down, because all your power lines converge in larger conduits under the road. Consequently, any house that shares these lines will also share X10 messages, making it possible to control your neighbors’ appliances as well as (or instead of) your own. Currently, few enough people are involved in home automation (and specifically X10) for this to be a practical issue. You can provide yourself with some peace of mind right now by placing a filter between the electricity meter and the rest of the house mains. This is usually called a whole house filter, and several makes and models exist, such as the PZZ01, which permits 200A of current. Naturally, with the levels of current involved, many people hire a qualified electrician to install such a device. The second part of the address is the unit code, of which there are 16, and this is represented by a hexadecimal digit between 0 and F. Although this might not seem a lot, 16 devices allows you to have two appliances (one light and one other) in every room of a moderately sized four-bedroom house. Most rooms will have only one—the light—while appliances like TVs and radios are more likely to be effectively controlled through infrared or even Ethernet. In addition to an address, every X10 receiver module fits into one of two broad types, either lamp or appliance. This is a difference that exists in the X10 module itself and that governs how it will deliver power to the device plugged into it and which messages it will accept. An appliance module simply provides on/off control to whatever is plugged into it and usually has a high enough power rating to accept most household appliances (ovens excepted). In contrast, a lamp module will also respond to brightness control messages, varying the voltage applied to the lightbulb plugged into it. Consequently, plugging a toaster into a lamp module can be problematic and a potential fire risk. Adding a light to an appliance module, on the other hand, works fine and only suffers the limitation of losing the dimming functionality. . adapted, and implemented with the information presented here using very little effort. And then you will graduate from an automated home to a smart home to a personalized smart home! C H A P T E. visitors, my home is both smart and automated; I can e-mail my light switches, I can receive tweets from my CD player, and I have a personalized TV guide e-mailed to me every day. To me, my home is. Goodwin xv Introduction Home automation (HA) is anything that your home does for you automatically to make living there more enjoyable or productive. A smart home is one that appears to

Ngày đăng: 03/07/2014, 20:20

Mục lục

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewers

  • Acknowledgments

  • Introduction

  • Appliance Control

    • Making Things Do Stuff

    • X10

      • About X10

      • General Design

      • Simple Case

      • Standard Case

      • Fully Automated

      • Assigning Addresses

      • Using Multiple House Codes

      • Device Modules

      • Controlling Lights

        • Lamp Module (LM12U)

        • Bayonet Lamp Module (LM15EB)

        • Wall Switch (LW10U)

        • MicroModule with Dimmer (LWM1)

Tài liệu cùng người dùng

Tài liệu liên quan