1. Trang chủ
  2. » Công Nghệ Thông Tin

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

5 168 0

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

THÔNG TIN TÀI LIỆU

CHAPTER 3 ■ MEDIA SYSTEMS 113 Adventurous developers can utilize a cheap all-in-one remote control and incorporate its workings, along with an IR relay and replacement switches, into their own wall unit. Relay Control Although few consumer products come with anything other than IR, this doesn’t mean that you have to control it with IR, provided there is something in between that understands both protocols. Bluetooth, for example, is found on all current mobile phones, and although it is slightly power hungry, there are many free or nearly free applications that interface with a suitably equipped PC. And since many people carry their phone on them at all times, this provides a very accessible way of providing control. All Bluetooth communication requires a Bluetooth address. This looks like a MAC address from traditional network scenarios and can be discovered with the following: hcitool scan Note that there is a slight delay in scanning the area for devices, and a further delay is realizing when it has disappeared! So although this program can be used to determine when the Bluetooth signal is coming back into range (and therefore you are returning home), it is best to perform a directed scan for a single phone using bluemon. Bluetooth control apps come in two halves, one for the PC and one for the mobile. The mobile side is usually Java-based but despite its “write once-run anywhere” mantra usually needs a version specific to your phone because of the vagaries of mobile development. The messages sent are usually in a protocol that the receiving PC app can process. This is then configured to send a suitable IR signal to the device in question that might be to control the media player currently running on the PC or lock the desktop screen should the Bluetooth signal fall out of range. 9 Vectir provides such functionality for Windows users, while those in the Linux community can choose packages 10 like Remuco, Amarok, or RemoteJ. There are other packages to permit file transfers between phones and PCs, such as obexftp, but these are suited to syncing applications and therefore outside our scope. X10 provides a similar mechanism for relayed control as Bluetooth. Utilizing a handheld transmitter module (such as the HR10U), you can send an X10 message (such as lamp E10 on) to the RF-to-X10 gateway, which places the data on the power lines. Your PC can then listen for this particular message and control the media player, either by retransmitting an IR signal or by affecting the PC-based software. I’ll cover the specific mechanics of this when looking at Cosmic in Chapter 7, which supports a full range of additional functionality. 9 This is one of the prestated aims of the bluemon package. 10 A complete list would be impossible here, but alternatives include http://tuxmobil.org/bluetooth_cell_apps.html. CHAPTER 3 ■ MEDIA SYSTEMS 114 Server Control All the relay methods covered can also be used to control a server running software, such as a media player. Indeed, this is usually preferably, because it limits the number of places where a problem can occur and is often employed where most media is stored digitally on a hard disk. When the server is providing the media to external locations, everything should be configured as a client/server. This provides a more distinct separation than before, where the music being played was controlled by the remote amplifier but the speaker volume was controlled locally. Adopting a full client/server approach has many benefits, not least because it unifies the system. Here, every message (such as “pause track” or “increase volume”) is sent by the client using whatever protocol (X10 or Bluetooth) is suitable to it. The server then listens to all of these messages and translates them into suitable Linux commands. The effect of these commands can then be heard wherever its outputs are connected. Furthermore, when a full-scale PC is available for server processing, more complex protocols can be used. A Web Interface A traditional LAMP (Linux, Apache, MySQL, PHP/Perl) installation provides a good means of controlling your house by the most ubiquitous interface of modern times—the web browser. Almost every device, including game consoles, mobile phones, and in-wall touchscreens, have a web browser of some description built in. Building or hacking your own touchscreen is no longer a problem either. You can start with the current range of notebooks and subnotebooks that include a touchscreen (like the Eee PC T91) or retrofit one to an old laptop (such as the Acer Aspire or Dell Inspiron Mini). These kits comprise a touchscreen membrane that is attached externally to the monitor screen and a USB plug that causes the screen to act like an external mouse. These machines are small and powerful enough to fit anywhere, including on your fridge, but you can reduce the footprint further by using an old phone (such as the Nokia 7710) and mounting it yourself. The software is, naturally, Linux. Several slimmed-down distributions provide a browser as its only software, such as Webconverger. These are live systems that can form a compact flash and are known as kiosk systems. With zero installation and very short boot times, these are very good for occasional house terminals. SMS SMS is the short-message system available to all mobile phones as part of the standard infrastructure. It can be utilized by the smart home in two ways. The first is to connect a mobile phone to the Linux machine and interface to it using Gnokii, SMS Server Tools, or some similar software. This software now provides support for many phones, although originally it was only for Nokia phones. Gnokii provides two-way communication for SMS messages, allowing your PC to read and interpret them or send out reminders or status updates. CHAPTER 3 ■ MEDIA SYSTEMS 115 ■ Note Use a prepaid phone if possible when the majority of the communication is outbound, lest a software bug or cracker cause a lot of sent messages and a very large phone bill. This isn’t always the best choice for inbound communication, however, since some operators (in Northern American, notably) charge for inbound SMS on prepaid phones as well! A second method is to subscribe to an SMS service provider, such as mBlox, which will provide you with a phone number, login credentials, and an API; this allows two-way communication with any machine as if it were a mobile phone. You should check with the service provider whether it’s possible to limit the amount spent on the account, in case of problems. The SMS solution has fallen out of favor in recent times with the cost of G3 web access coming down, but it still provides a fairly cheap means of control for families where older phones are passed down to the kids. Conclusion Although a home automation system has a lot of components, you’ve seen that none of them are particularly complex or outside the realm of a standard Linux machine. It is only your geeklust that requires (nay, demands!) more equipment. But even then, a solid server is a bedrock, although as a home automation system grows, the inclusion of more custom hardware becomes less suitable. Even though the cost of DVD players and PVRs is coming down, the bulk/expense of replacing each piece of kit, in each room, is troublesome. Plus, you have no benefit of being able to share media around the house and will be continually asking “Who had the Star Wars DVD last?” The target goal for most systems is to have a very powerful computer hidden away somewhere and a lot of smaller (low-power, low-cost) head units in the various rooms, able to play all types of media. The area containing this powerful computer is called Node Zero, and I’ll cover that next. C H A P T E R 4 ■ ■ ■ 117 Home Is Home The Physical Practicalities Running your own home is a great feeling. Having it run from your own Linux server is even better. Just being able to tell people that your home page is quite literally your home page lifts your geek credentials one notch higher. But having a machine running 24/7 introduces a permanent noise from the fans and hard drives, blinking lights, and extra heat. Being able to control one machine from another requires cabling. In this chapter, I’ll cover some of the basics about the physical practicalities of a home automation setup. Node0 Node0 is the place in the house where all the cables end up, or are “home run.” This means Cat5 Ethernet, AV cables, IR relays, and even X10 wireless transceivers might all live within a single location. It is also the entry point for the outside world, so modems and routers will also live here. Function and Purpose The idea of using a single Node0 is to keep everything out of the way of day-to-day living. This means the server, no matter how big and noisy it might be, can be positioned where it least impacts those trying to sleep or study. It also allows the mass of cables and expensive hardware to be placed somewhere, perhaps locked up with a single key, to minimize careless accidents involving spilled drinks and young children. Although this introduces a single point of failure (a big no-no in general systems administration), the risks involved at home are much fewer, and it doesn’t impact the already present single point of failure, namely, the sole modem cable entering and leaving the house. The server machine itself also exists to provide a central repository of all the house-related data and information, including the main web site and e-mail services, and an abstraction to the various media repositories that might exist on other machines. In this way, every nontechnical house dweller can connect to //server/media and be transparently connected to whatever hard disk (on whatever machine) happens to include it. This makes it possible to upgrade and move disks around as they become full, without fielding support calls from your family! . Home Is Home The Physical Practicalities Running your own home is a great feeling. Having it run from your own Linux server is even better. Just being able to tell people that your home. which will provide you with a phone number, login credentials, and an API; this allows two-way communication with any machine as if it were a mobile phone. You should check with the service provider. cheap all-in-one remote control and incorporate its workings, along with an IR relay and replacement switches, into their own wall unit. Relay Control Although few consumer products come with

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

Xem thêm: Apress - Smart Home Automation with Linux (2010)- P28 pdf

Mục lục

    Contents at a Glance

    About the Technical Reviewers

    Making Things Do Stuff

    Using Multiple House Codes

    Lamp Module (LM12U)

    Bayonet Lamp Module (LM15EB)

    Wall Switch (LW10U)

    MicroModule with Dimmer (LWM1)

    DIN Rail Dimmer (LD11)

    Appliance Module (AM12U)

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN