Smart Home Automation with Linux. Apress

by Steven Goodwin

Learn how to control your home from your PC

THE EXPERT’S VOICE® IN LINUX

Publisher and President: Paul Manning
Lead Editor: Duncan Parkes
Development Editor: Matt Wade
Technical Reviewers: Steve Potts and Michael Still
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell,
Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes,
Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Matt Wade, Tom Welsh
Coordinating Editor: Anne Collett
Copy Editor: Kim Wimpsett
Production Support: Patrick Cunningham
Indexer: Julie Grady
Artist: April Milne
Cover Designer: Anna Ishenko

e-books shop
Smart Home Automation with Linux


About the Author
■Steven Goodwin (London, England) has been involved in science
and technology from an early age, building his first synthesizer while
still in his teens. Since then, his projects have been wide and varied. He
has built robots, musical instruments, and chess sets, and he has a
house that can be controlled from the Internet where he is able to email
his video and control his light switches from work.
The growth of this desire for home automation led to the creation
of the Minerva project, an open source suite of tools and protocols that
make it possible to combine many different technologies and have
them interact in new and interesting ways. It is a project for which he is
still the lead architecture and developer.
He is also an active member of the Linux, free software, and open source communities and has
spoken at many conferences, including UKUUG, FOSDEM, NotCon, and the BBC Backstage OpenTech
event. His articles have appeared in more than 50 magazines, covering topics from programming to
management (even including magic and beer!), and he is the author of two industry-standard textbooks
for the game industry.
Currently, Steven is funding his passion for technology through the development of the SGX 3D
engine and his work on games for Facebook.

About the Technical Reviewers
■Steve Potts graduated from Manchester University, England, with a bachelor’s degree in applied
computing and continued to study a master’s degree in computing for commerce and industry at the
Open University, United Kingdom.
His career has a foundation in the defense industry, squeezing an immense amount of failureresistant
software into a remarkably small footprint, which migrated into developing for handheld
devices, the mobile Internet, and the e-commerce Web.
Given his meticulous disposition (his friends have other words to describe this), he is an
accomplished technical editor having worked on Java, XHTML, PHP, wireless, and social media
publications including Building Online Communities from Apress.
Steve is the founder of the technical consultancy outfit Free Balloon, and he has the rewarding
position of CTO at Hawdale Associates, an invigorating usability and design customer experience
company operating out of Manchester, England.
He is continuously refitting his house with home automation technology.

■Michael Still is the author of The Definitive Guide to ImageMagick and Practical MythTV. He hacks on
a variety of open source projects and likes playing with embedded systems. He also spends too much
time reading science-fiction novels. He lives in Australia with his wife and two kids.

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!
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!


Screenshot

e-books shop

Purchase Now !
Just with Paypal



Product details
 Price
 File Size
 17,876 KB
 Pages
 313 p
 File Type
 PDF format
 ISBN-13 (electronic)
 ISBN-13 (pbk)
 978-1-4302-2779-3
 978-1-4302-2778-6
 Copyright
 2010 by Steven Goodwin            

Contents at a Glance
About the Author
About the Technical Reviewers
Acknowledgments
Introduction
■Chapter 1: Appliance Control
■Chapter 2: Appliance Hacking
■Chapter 3: Media Systems
■Chapter 4: Home Is Home
■Chapter 5: Communication
■Chapter 6: Data Sources                                                        
■Chapter 7: Control Hubs
Index                                                

Contents
About the Author .......................... xii
About the Technical Reviewers .................... xiii
Acknowledgments ......... xiv
Introduction ................. xv
■Chapter 1: Appliance Control ..................... 1
X10 ....................................................... 1
About X10 ................................................................... 2
General Design .......................................................... 4
Device Modules .......................................................................... 6
Stand-Alone Controllers...................................................... 15
Gateways and Other Exotic Devices ..................................... 20
Computer Control...................................................... 23
C-Bus .............................. 28
About C-Bus .......................................................... 28
Differences Between X10 and C-Bus.................................................. 28
Devices .......................................................... 29
Controllers ....................................................... 30
Gateways ...................................................................... 31
Networked Devices .................................. 31
Ethernet Devices..................................... 31
Networking Primer ....................................................... 31
CCTV Cameras .................................................. 38
Stand-Alone BitTorrent Clients ................................................................... 41
Infrared Remote Control ........................ 41
All-in-One Remotes ................................................ 42
IR Relays ........................................................... 42
IR Control .................................................... 46
Conclusion .................................. 48
■Chapter 2: Appliance Hacking ................................... 49
Software Hacks ............................... 49
Linksys NSLU2 ............................................................... 49
Developing on the Slug ...................................................... 51
Hacking Game Consoles ........................................................ 52
Hardware Hacks ............................................. 58
Linksys NSLU2 ........................................... 58
LEGO Mindstorms ................................... 60
Arduino as an I/O Device .............................................. 61
Joysticks for Input ................................................. 79
Other Input Controllers .............................................. 80
Hacking Laptops ............................................................. 80
Your Own X10 Devices.................................. 81
Conclusion .................................... 83
■Chapter 3: Media Systems .................................. 85
The Data Chain ............................................. 85
Extracting the Data ...................................... 86
Storage ................................................. 91
Stand-Alone NAS Systems...................................................... 91
NAS with Media Playback ......................................... 94
Configuring a Linux Box .................................................. 95
Media Extenders ........................................... 98
Stand-Alone Hardware ................................ 99
Just Linux ........................................................ 105
Distribution ....................................... 107
Local Processing vs. Remote Processing ................................. 107
AV Distribution ............................................. 107
Wiring Looms ................................................. 109
Wireless AV Distribution .............................................. 110
Matrix Switchers ......................................... 110
Control ......................................... 112
Local Control ....................................... 112
Remote-Control Methods.............................. 112
Conclusion ...................... 115
■Chapter 4: Home Is Home ....................... 117
Node0 ....................... 117
Function and Purpose ............................................. 117
Determining the Best Room........................... 118
Primary Options ........................................ 121
Building the Rack ....................................... 122
Servers......................................... 123
Purposes of Servers ............................ 123
Types of Server ............................................. 125
Power Consumption .................................. 128
Server Coordination ....................................... 131
UPS ................................................. 132
Backups ...................................... 136
Hiding Your Home ............................................. 140
Adding to Your Home ........................... 141
General Considerations............................. 142
Wired Network ........................ 143
Wireless Points ................................................ 145
Audio Cabling.......................................... 146
Other Access Points? .............................. 147
Conclusion ................................... 148
■Chapter 5: Communication .......................... 149
Why Comms? ....................... 149
IP Telephony ........................... 150
Skype ....................................... 150
Asterisk.............................................. 151
E-mail .............................. 151
Preparing E-mail in Linux ............................. 151
Sending E-mail .............................. 152
Autoprocessing E-mails ............................. 153
Security Issues ................................... 156
Voice .......................... 157
The Software for Voice Recognition ............................ 158
Remote Voice Control ...................................... 160
Speech Synthesis ........................................ 161
Piecemeal Samples ...................... 164
Web Access .......................... 165
Building a Web Server ......................................... 166
SMS .................... 174
Processing with a Phone .............................. 175
Custom Numbers and APIs ........................ 178
Conclusion ................... 184
■Chapter 6: Data Sources ........ 185
Why Data Is Important ...... .................. 185
Legalities ...................... ............... 185
Distribution ....................................... ........... 190
Public Data ........ ................... 190
TV Guides ...... .................... 190
Train Times .................. ......................... 191
Road Traffic ............. ............................... 193
Weather ................... .............. 193
Radio.......... .................................. 197
CD Data ..................... ...................... 199
News ........................................ ............. 201
Private Data ......... ................. 204
Calendar ....................... ............... 204
Webmail .......... ................ 206
Twitter ...................... ............ 208
Facebook ....................... .................... 210
Automation ........ ........... 210
Timed Events ................... ............... 211
Error Handling.............. ............. 213
Conclusion ...... .......... 214
■Chapter 7: Control Hubs ..... .......... 215
Integration of Technologies ... .................. 215
The Teakettle: An Example ......... ................... 216
Minerva .... .................. 218
Overview .... ................ 219
Linux Users Are Not HA Users....... ................... 220
Device Abstractions ............. ............. 222
Conduits....... ................... 226
Messaging Conduits ........ ........ 229
Message Relays........ ................ 234
Time-Based Messaging .......... ................ 234
Location-Based Messaging ............ ........ 236
Cosmic ....................... .............. 237
Web Applets.......... ................... 239
Manifest ........ ....... 256
Marple ................. .............. 257
Utility Scripts .............. .................. 261
Topology Ideas ............. .......... 262
Networking ............... .......... 262
Wiring Looms .................... ....................... 264
Conclusion ............. .. 267
Index ....... .............. 269

  ●▬▬▬▬▬❂❂❂▬▬▬▬▬●
●▬▬❂❂▬▬●
●▬❂▬●

═════ ═════

Previous Post Next Post