Smart Home Automation Part III - Media Extenders
Once you have a file server providing access to your media, you then need some way of rendering the media, aurally or visually, to the world. This can involve stand-alone hardware, a Linux-based machine, or a combination of the two.
Stand-Alone Hardware
To fit into this category, the hardware must connect the network, use DHCP to determine its IP address, and then stream the data from a file server to a physically connected TV or speakers. These devices invariably use Samba as a file server, since the installation of specific drivers (such as ZFS) is not a realworld possibility.
Hauppauge MediaMVP
This device, despite dating from 2002, can stream music, standard-definition video, and pictures across the network and display them on a TV. The retail unit is fairly cheap, small, and silent, making it an ideal head unit. It comes with just three sockets: power, RJ-45 Ethernet, and SCART. (The U.S. version expands this last socket to S-Video, composite video, and stereo audio.) To work, the MediaMVP needs three separate services:6 DHCP, TFTP for the bootup procedure, and Samba for data since it has no storage facilities of its own. Out of the box, these services are provided by a piece of Windows software, which has a number of limitations such as a slow menu system. The machine also prevents you from viewing any video that isn’t MPEG1 or MPEG2 encoded. This is because the video signal is decoded by a custom chip inside the MediaMVP that only supports these earlier codecs. Fortunately, the protocols used by the MediaMVP to boot up are standard, enabling you to use Linux as a server. You can then take this a stage further by replacing the firmware that runs on the actual device, allowing it to connect to VLC to transcode your files to MPEG2 in real time.
Creating a Server
The bootup procedure of the MediaMVP is twofold. First, it sends a DHCP request asking for an IP address of its own and the address of a TFTP server. Second, it uses this TFTP server to download the firmware, which is what ultimately runs on the MediaMVP to become a media device.
You begin by adding the configuration to /etc/dhcpd.conf:
- group {
- next-server 192.168.1.2; # IP address of your TFTP server
- host mvp {
- hardware ethernet 00:0d:fe:00:15:8D; # of the MediaMVP
- fixed-address 192.168.1.98;
- filename "dongle.bin";
- }
- }
The address need not be fixed; however, I’ve adopted a convention on my network indicating that any machine on my subnet with an address under 100 is a “house device,” such as a server or embedded hardware, and is not liable to change or move and therefore is always available. Everything 100 or greater is a computer that might be removed from the network or switched off at any time.
From here, control is passed to the TFTP server, so the MediaMVP can request the firmware, given by the filename dongle.bin.
TFTP stands for Trivial File Transfer Protocol, which is a very much simplified version of the usual FTP often used to copy files between machines. It’s installed as normal:
This will add the appropriate lines to /etc/inetd.conf and /etc/default/atftp, indicating the directory for file transfers (usually /var/lib/tftpboot). The primary distinction with TFTP from my point of view is that no username and passwords can be employed with TFTP. Although this might have made the programmer’s original job very much simpler, it was at the expense of security, meaning you should not open the TFTP port (UDP 69) to the world.
You can then copy the dongle.bin file to the /tftpboot folder and switch on the MediaMVP. From here, it is a simple matter to replace dongle.bin with one of the other firmwares available to the MediaMVP, such as MVPMC, to provide improved functionality, such as real-time video transcoding or connecting with MythTV.
MediaMVP Media Center
This is probably the most fully featured alternate firmware currently available; it’s downloadable from http://www.mvpmc.org. It comprises a replacement dongle.bin and a configuration file. Since MediaMVP itself is running a small version of Linux, this configuration file is, conveniently, simply a script containing shell commands, which makes it very simple to make amendments to the firmware image without rebuilding it. At a bare minimum, it should contain commands to mount directories into the filesystem and invoke the main mvpmc program:
mount.cifs "//192.168.1.110/media" /media -o user=mvp,pass=mvppass,rsize=34000;
mvpmc &
You can then add arguments to this command according to the extra functionality you want to introduce. I’ll now cover some of them.
Note
It is not also possible to use anonymous logins from the mount.cifs command within MediaMVP, so create a separate Linux account on the computer running the file server (192.168.1.110 in this example). Since this username/password is visible in the configuration file and this configuration file is visible to anyone with TFTP access, you should make doubly sure it’s not visible outside your network.
Weather Reports
This data is downloaded from the Yahoo! weather service and is rendered, with graphics, from one of the menu options on-screen. It needs to know where in the world you are located and that you have access to the Internet. For me, in London, this requires the following alternative line:
mvpmc --weather-location UKXX0085 &
You can determine this code by visiting http://weather.yahoo.com, searching for your town or city, and grabbing the RSS feed. This will direct you to a URL such as the following:
http://weather.yahooapis.com/forecastrss?p=UKXX0085&u=c
where you will notice the city code (p=UKXX0085) and the units (u=c), allowing you to present the data in either Celsius or Fahrenheit.
Video Transcoding
The biggest problem with hardware solutions is their lack of upgrade path. Although MediaMVP provided a means of changing the firmware, the MVP hardware didn’t use a powerful enough processor to allow firmware that could decompress video in real time. Instead of converting all your past DVD rips into a suitable format, it is instead possible to convert the format on the fly (known as transcoding) while you’re watching them. This requires configuration of the MediaMVPMC and a transcoding server running VLC.
In the first instance, you need to add the appropriate arguments that tell MVPMC the address of the transcoding server.
mvpmc --vlc 192.168.1.110 --vlc-vopts dvd &
Naturally, like every other server we’ve seen, the server involves only software and can exist on the same physical machine as the DHCP or TFTP server. However, because of the increased processing power necessary, you might want to run the transcoding software on a separate machine or your desktop. This allows you to have a small, low-power server running the main systems in your house, with the “big iron” being used only when necessary.
Tip
The transcoding server only needs a CPU with reasonable specs, meaning an old stripped-down P3 or P4 can be fast enough. Making use of your desktop is often a good idea, because the transcoding won’t slow your work down since you’ll be watching a film at that time!
Depending on the speed of your transcoding server, you might not be able to manage the highestquality images. By amending the –vlc-vopts to either SVCD or VCD, you can reduce the resultant quality to that of the Super Video CD format, or standard Video CD format, respectively.
Note
The MediaMVP device itself only has hardware to output a standard-definition image. If you’ve been ripping your Blu-ray discs as HD files, then you will need to use VLC to transcode them into SD.
It is also recommended that you use the --use-mplayer command-line switch, which will switch to mplayer transcoding if VLC doesn’t understand the file format properly.
The biggest caveat about using a transcoding server is that the filename being played by the MVPMC client software must be exactly the same as it appears to VLC running on the server. This can be arranged by the careful use of symlinks, since my media is mounted elsewhere on the disk and I have no desire to change it. I have therefore created a special folder in the root of my server with suitable links:
- mkdir /mvpmc_media
- ln -s /media/mp3 /mvpmc_media/mp3
- ln -s /media/movies /mvpmc_media/movies
- ln -s /media/videos /mvpmc_media/videos
I then replicated these on the MediaMVPMC by creating its own mvpmc_media directory and mounting the folders across the network:
- mkdir /mediamount
- mkdir /mvpmc_media
- mount.cifs "//192.168.1.110/media" /mediamount -o user=mvp,pass=mvppass,rsize=34000;
- ln -s /mediamount/videos /mvpmc_media/mp3
- ln -s /mediamount/videos /mvpmc_media/movies
- ln -s /mediamount/videos /mvpmc_media/videos
If you like, you can test your mount instructions by applying them dynamically while the MVPMC is running, since you can telnet into the MediaMVP hardware (username: root, no password) and issue commands directly.
This process has another benefit since the filesystem browser on the MVPMC is very literal; whereas a directory entitled vids might be good enough for the geek who created it, a more descriptive title like Music Videos, replete with capitalization and spaces, would be appreciated by other home dwellers. Consequently, you can repeat the previous process using full names to achieve that goal without offending the sensibilities of your Linux naming conventions.
Note Although DVD VOB files can be played on this system, the DVD menus are not supported
Other Functionality
Other features available in MVPMC include the following:
- Access of data from MythTV or ReplayTV
- VNC Viewer
- Streaming live web radio
Their setup requirements are straightforward enough and covered in the online documentation and so won’t be covered here.
The Xtremer
This is one of several devices that plays back media files through a TV or HiFi system. Its low price point and inclusion of HDMI make it a good foray into media streamers. It is a good test unit since it supports media playback from its internal disk, an external drive, or the network—both wired and wireless. This makes it suitable for trying different configurations, without buying additional boxes. In addition to music and movies, it also supports image previews, weather reports, and live streaming from YouTube, Picasa, and Flickr.
Squeezebox
This device was launched in 2003 and is one of several that acts like an audio-only version of the MediaMVP with a similar scope for “hackability.” It also works on a client/server arrangement. The server in this case is a set of open source Perl scripts called SqueezeCenter (formerly SlimServer) running on Linux, Mac OS X, and Windows. This provides the clients with the audio data for your locally stored music and a way of connecting to external sources such as Internet radio or your MP3tunes music locker. It is also able to control the client machines by sending them commands. The server itself doesn’t play audio, although you could run a software client on the same physical machine to transparently achieve the same result.
You then need one or more client machines (that is, head units) to play the music in a remote room, connected by either a wired or wireless network. This head unit can be as follows:
- Squeezebox Classic, with display and outputs to a HiFi amplifier
- Squeezebox Receiver, without display, controlled remotely
- Squeezebox Boom, with display, built-in amplifier, and speakers
- Transporter, reportedly a higher-quality playback engine
- A software client
With an appropriate remote control, you can link the Squeezebox instances together so that they all play the same music, providing a full, whole-house audio system.
Server Software
Installation under Linux is straightforward, and by using the software client, you can test the environment without purchasing any hardware. First, go to /etc/apt/sources.list, and add the following anywhere in the file:
deb http://debian.slimdevices.com stable main
Next, do this:
apt-get remove --purge slimserver # in case of an old install
apt-get install squeezeboxserver
And, after ensuring your music collection has the appropriate read and execute permissions set for the (new) SqueezeCenter user, you can connect to its web server (on port 9000) and configure the server.
Other Software
SoftSqueeze is a software emulation of the Squeezebox hardware and available from http://softsqueeze.sourceforge.net; it supports Linux, Mac OS X, Windows, and most platforms with a good Java implementation. This is good for testing a new server and for using as a standard media player; however, because of its overzealousness at emulating the two-line LCD emulation, navigation is a little tiresome. However, you can use the SqueezeCenter software—through its web interface—to control the playlist if you like. Naturally, by opening the appropriate ports, you can do this remotely.
Videobox (http://videobox.sf.net) is a means of using a (hardware) Squeezebox to pass its IR signals back to the server so it can trigger external scripts and code. One example given is that of starting movie playback on the server so it can be viewed on-screen.
Emprex ME1
This modern device hails from 2007 and is one of several media playback devices now available. It claims to support HD output but lacks an HDMI port; therefore, it provides its highest quality through upscale via YPbPr in 720p or 1080i. It can also function as an AV recorder, but only through composite inputs.
Where this unit benefits most users is in its low cost and local storage support. This can be with either IDE hard disks (or SATA disks, with more recent versions, which also increases the storage space from 500GB to 750GB) or through USB, be they memory sticks or USB hard drives.
As with much technology, utilizing the latest firmware is recommended; it now supports NTFS (the default filesystem was the ill-chosen FAT32, which limits the maximum file size), and there have been stability issues with the internal hard disk. Fortunately, an internal disk is optional on later firmwares, allowing you to use one attached to USB.
Naturally, the device can also read movie files from the network, and you can also use it to remove movies recorded on the ME1’s local storage for archive elsewhere. This method is detailed on the (very) low-traffic web page http://emprex-me1.blogspot.com along with their Google Groups lists.
Just Linux
The GNU/Linux operating system has appeared in so many distributions (aka distros) over the years that it’s difficult to keep up with them. Many people adopt one early in their careers and never change. When using a Linux machine as the basis for a media player, these rules need to be reconsidered because what’s good for the desktop isn’t necessarily good for media playback. Consequently, I’ll consider the necessary benefits and features of a suitable Linux distribution and only mention specifics as examples because, as in the case of hardware, the field moves too quickly to give definitive “best” answers.
The Operating System
The OS comprises, in the truest sense, a kernel, its drivers, its modules, and its associated software. These components are packaged in distributions to make them easy to install. Consequently, there are very few variables to consider when choosing a suitable distribution.
First, and most obviously, you need to have access to a healthy supply of drivers built for the supplied kernel. Hardware, especially in high-end fields such as graphics, requires high performance and specific drivers to ensure that it is utilized effectively. Although most graphics cards don’t have accelerated onboard video decompression, they do have hardware acceleration for a lot of other features, which will show a marked improvement in performance for video.
Second, you should consider the bootup time. xPUD, for example, takes around ten seconds, making it appear like a true set-top box, rather than a small computer. XBMC, as you saw in Chapter 2, is also in this range.
And finally, the total size of the distribution needs to be determined. This is always the last consideration since it can be solved with very little effort, namely, with an extra few pence on a larger hard drive or solid-state memory card. The latter is preferable for most media streamer machines since you can boot quicker from them, they last longer (since more of the operations are memory reads, not memory writes, and have no moving parts), and they allow for a much smaller form factor. If you are building your own Linux machine specifically for media streaming, then make sure it can support booting from compact flash or a USB memory stick.
The Software
A good media player distribution depends not primarily on the operating system but on the software. It is, after all, the software with which you will be interacting. Most media streamers start life as media players. These are completely wrong for a streamer. Consider the basic scenario—you have a media player on your desktop controlled by a mouse and keyboard while sitting on a chair and watching a monitor from 2 to 3 feet away. Alas, most software is developed and tested on a desktop PC where the subtle differences might be overlooked. Remember to consider the following:
The visuals: You will be generally using the interface from a long distance away in a comfy chair. Therefore, the buttons and font need to be large and legible, placed on a screen that is uncluttered and moderately high contrast, with antialiasing.
The screen: Unless you have the latest LCD technology in your living room, your TV will generally be of a much lower quality than your monitor, so small details (especially thin horizontal lines) will get lost or be indistinguishable on-screen.
Control: Without exception, any home theater PC without a remote-control option is going to fail. No one will get out of that comfy chair to press buttons on the machine or will want a keyboard or mouse on their lap.
Navigable interface: Going hand in hand with control, there must be a clean way of moving between menu options. Entering the server IP with a keyboard is only acceptable during initialization.
All of these points have been classified together as an approach known as the “10-foot user interface.” This is not to say that these rules are golden or immutable, but spotting several contraventions to this in a single piece of software can be a clue that the project is not yet particularly mature and has been used little in the real world.
MythTV
Of all the Linux PVRs out there, the most famous is probably MythTV (http://www.mythtv.org). This consists of two parts—a back end (mythback) that allows you to record shows from a TV card into the local hard disk and a front end that plays back the media files from a mythback server. In this way, you can have a powerful single server containing many TV cards with the software coordinating the best way to record channels with them and a number of smaller front end units placed in the various rooms of the house all taking their data from the server. This also provides a way of streaming live TV around the house.
In addition to media playback, MythTV supports alternative skins and plug-in modules, allowing the front-end units to display the weather, show a photo gallery, play games, and surf the Web.
If you are looking for a PVR stand-alone form-factor, you can incorporate both mythback and mythfront into the same machine, provided it is powerful enough. A TV card with hardware encoding (such as the newer Hauppauge’s) can help reduce the size and power of this machine, allowing you to get away with a fanless system.
The software approach to PVRs will always win out over hardware, because new features can be added more efficiently and vagaries in codecs can be catered for. I’ll now briefly cover some examples.
Freevo
Freevo (http://freevo.sourceforge.net) is a play on the name of the infamous hardware PVR called TiVo.7 It consists of an all-in-one approach, with video capture, recording, and playback existing within the same piece of software. (But under the hood it has a separate TV server section.) This makes it a closer relative to the Xtreamer type of device and especially suited more controlled installations.
Like MythTV (and most software PVRs, if I’m being honest), it can also support skinned interfaces and plug-ins, although most have been folded into freevo1, the stable version of the software, so any changes will require a bigger recompile than usual. This can make it more difficult for casual developers to make changes. These plug-ins include the usual array of weather reports, X10 control (through heyu), Skype, and Flickr.
It also has images for LiveCD versions (again, like most software PVRs, if we’re honest) so you can test it without installation on your hardware.
Xbox Media Center
This is to remind those of you who skipped Chapter 2 to go back and read it! XBMC supports and runs on more non-Xbox platforms than it does on Xbox. It supports the usual array of plug-ins and has a LiveCD version.
The Video Disk Recorder Project
The project at http://www.tvdr.de is for the most hands-on developers, because it also includes a suggested hardware component. It is this hardware that is the main draw to this project because it is based on a DVB-S satellite receiver (its primary concern, because analog and digital TV are provided by plug-ins) and a custom-made remote-control unit using a PIC chip. Although this level of custom hardware is largely unnecessary in today’s world, it works well and gives the users an extra reason to feel passionate about their VDR. It also uses a lower spec than most current systems. Software-wise, it has a decent (if slightly too small) interface that looks like the Star Trek: The Next Generation LCARS system and a much wider range of plug-ins over most over PVRs, including games, e-mail, and web browsing.
Distribution
This is the third step of our data chain. Having got our media data served and decoded, we are left with an AV signal ready to be plugged into a TV or HiFi. But we still have choices.
Local Processing vs. Remote Processing
This refers to where the media data is decoded and slightly overlaps with our second step. The equipment covered earlier is all locally processed. That is, we decode the data in a location that is physically connected to the TV or HiFi. This is usual, since it gives us greater fidelity and means that controlling the unit is much easier, but there are cases where the processing is better done remotely and only the resultant AV signal is sent.
AV Distribution
The output from nearly all media playback devices is our first port of call. This usually comprises RCA phono sockets for stereo audio or composite video, S-Video, EIA interface, SCART, or something of that ilk. This carries a fairly low-power, analog signal over short distances to an amplifier—be it TV or HiFi. Since these signals always need a power amplifier, we call this active distribution.
Providing distribution in this manner requires various interconnects and many cables. There is no upper limit on the length of these cables, so extensions and distribution boxes are possible, allowing the same image to be viewed in multiple places. Naturally, being an analog signal, the audio (or picture) will become softer as you get farther away from the source. Only you can determine what quality loss is acceptable for you.
If you are wanting to distribute high-definition images around your house, then you currently have to consider the more expensive options, such as matrix switchers, because the current crop is focused around RCA sockets.
Switching
The cheapest piece of necessary equipment is an AV switch box, or AV source selector box. This provides multiple inputs for your various devices, DVD, PVR, VCR, and so on, and routes one of these to the TV output. Most equipment give you the option of using either S-Video, RCA, or SCART inputs. This naturally requires that the TV is always set to receive the input from the box, not its internal tuner. There are many switch boxes available, so the features to consider are as follows.
Infrared remote control: This is a necessity, really. Since this box is now taking the place of your TV channel changer, it must have the functionality you’d expect from the TV...which at a bare minimum is a remote control.
Active or passive devices: Active units have a small amplifier in them and therefore need power. These ensure a strong signal but at the expense of a lower quality on the cheaper models, since their internal amplifier isn’t as good as the ones on the DVD player or on a TV. Passive devices have no such amplification and are more likely to lack an IR remote.
Input connections: Although some boxes provide S-Video, RCA, and SCART, for each input they might not be interconnected. That is, the RCA input socket might only be connected to the RCA output socket, and not to the S-Video or SCART. Since you only have one output to the TV, this requires you to compensate for adapting your interconnects to the most common form factor and to convert every other input into the same type of plug (there are converters available in most electronic shops). You then use the equivalent output. This part of the specification isn’t usually well documented, so check the shops return policy first.
Number of inputs: Count the devices you have, add to this the number of devices you want to buy, and add two more for good measure! Once this limit has been exceeded, you have no real choice but to buy a bigger switch box. You can chain them, which is troublesome and lowers quality, or you can use a separate EXT input on the TV for each switch box, which is equally annoying but has fewer electronics in the signal chain.
The biggest omission on the entry-level switch boxes is the facility to switch between stereo audio and 5.1 surround. Consequently, you will need a separate set of cables from the 5.1 output of the DVD (controlling the 5.1 speakers) and the stereo output of the DVD connected to your switch box.
Splitting and Merging
Once you have the AV signal ready, you might want to split it so that the video part of the signal goes the TV, while the audio makes its way into the line-input on a HiFi. There are two main ways of achieving this. The first is the easy way and works if your TV has its own stereo-out sockets, since they can be connected from the TV to the HiFi directly without a problem. The other way is to split the signal coming out the switch box into two (or more) outputs—one for the TV and one for the HiFi. This approach means you won’t be able to use the HiFi to amplify any stations selected using the TV’s internal tuner, but this can be rectified by watching the TV solely through a receiver (such as a cable tuner or digibox) or VCR, which has been plugged into the switch box. This can be done in a variety of ways. The cheapest is the use two Y-cables (aka Y-adapters), one each for the left and right audio signals. These provide two identical outputs from one input and require no power. These work well when splitting audio signals but can be less than satisfactory when used on video signals because of impedance problems. If the quality isn’t good enough, then you need a more involved splitter box.
A splitter box acts like its Y-cable counterpart but usually has an amplifier in it to stop signal degradation. This also allows it to provide more outputs for very little extra cost, allowing you to run a separate pair of cables into the kitchen and dining room, say.
If neither of these is suitable, you can split the output after the amplifier stage by running multiple speaker cables.
Wiring Looms
Wiring looms is where cables carry a powerful signal (pun intended!) to drive various passive speakers around your house. Consequently we call this passive distribution. You should create one loom for each area of the house where the same audio content is likely to be heard, because local control here is more difficult (unless you get speakers with a volume control or want to hack one yourself). In a room layout as shown in Figure 3-1, you have little privacy between the living room and the dining area, so these would be on the same loom, as would the kitchen since you probably want to pop in and out of the kitchen without missing the music or TV output. If an extension, such as a sun room or den, were added to the rear of the house, on the other hand, it would be considered a separate area with a different lifestyle purpose and would not be on the same loom. Instead, any music in there should be provided over IP.
The first component in a wiring loom is the main power amplifier, taking its input from the switch box we covered previously. Normally, this will drive one set of speakers, although some amplifiers provide extra outputs for additional sets. It’s rare to have more than two and even rarer to have more than a couple of rooms on the same loom, so you don’t often need any more equipment.
In those cases where you need more outputs, you can add a speaker control box into the chain. This takes a single speaker output and splits it into many. These additional speaker cables can be run into the other rooms and wired directly into other speakers without the need for power. This is the main advantage of this approach; namely, the cables are easier to run (the holes are smaller because there are no bulky plugs on the end), and there’s no need for power sockets nearby, enabling you to add music to the bathroom where media players would not be practical or possible.
Note Special waterproof speakers are necessary for bathroom use, which have sealed cones and baskets so they can cope with water and humidity. Various models exist, including flush-mounting ones that can be placed in the ceiling.
Provided you use a reasonable quality of speaker cable, the signal will not dissipate over the distances involved.
Note If you have two outputs on your amplifier but want to control three sets of speakers, then connect the control box to the second of the outputs and your primary speakers (on which you’re more likely to do critical listening) on the first. There’s no point in adding a step in the chain if you don’t need to do so.
Wireless AV Distribution
Running cables is not difficult but should be done with care to avoid drilling through power cables, water, and gas pipes. With this in mind, there are a few pieces of hardware now available, such as the AV video senders you saw in Chapter 1, built to solely wirelessly distribute audio signals.
For the most part, they offer a solution of convenience, but landscape speakers, which are built to exist outside and made to look like rocks (for example), provide the only practical solution. They must also be powered from batteries.
Matrix Switchers
For most home applications, a standard switch box is enough to control your AV setup. If you have a Bluray player or other high-definition equipment, you will generally plug it straight into the TV using HDMI because this eliminates all other components from the signal chain. And, alas, none of the reasonably priced switch boxes I’ve seen support HDMI.8 Furthermore, if you want to distribute two of your input devices (such as PVR or DVD) to two different places, then you’ll find that you can’t, because the switch only provides a single output.
Both of these limitations can be overcome with matrix switchers. They have a broader range of inputs (often including VGA) and can send the input signal from any one of (say) eight inputs to any (or all) of the outputs, which often number four or more. This allows the most powerful AV control method possible, with all your hardware being located in a single place and the results carried by cable to each room in the house. Also, since this is professional-level equipment, it usually comes with a serial port, making it easy for a computer to control it directly.
Utilizing a matrix switcher in your setup is a big step, not just financially. To make full use of the device, you will need to keep your AV equipment in close proximity to the switcher. Furthermore, not only will you have the usual mess of cables entering the switcher, but you’ll have an additional mess of cables leaving it—one set to every room. And for the most part, matrix switchers are not small.
Consequently, it is impractical to have them in the living room. Instead, you need to consider a room or a hidden cabinet into which the switcher and AV equipment can be placed. With the equipment now hidden away, the purchase of an IR relay or gateway to retransmit IR signals to the devices inside the cabinet is essential. It will be needed for the matrix switcher and may come as part of the package, so buy it second!
The output connectors vary between matrix switchers. Some provide the output as an AV signal, like S-Video or other domestic formats, making it very simple to connect other receivers into your home and have it work. Others are intended for hotels and conference centers and encode each input into a proprietary protocol so the output can be transmitted over Ethernet. This case requires an additional receiver unit for each room, thus saving the effort of running specific AV cables around your house. And because the data is traveling over your existing Cat5 cables, you can usually send the IR control data back the same way, saving you on the IR relays that are so often necessary.
Note If the majority of your source media is stored on a hard drive, then you probably won’t need a matrix switcher at all, since it can be transmitted by Cat5 to small Linux-based head units using software-streaming solutions such as VLC.
For those evil geniuses living in an underground volcano, a matrix switcher provides a missioncontrol room scenario for very little extra cost! After all, you can connect one set of outputs to a row of small, cheap TV sets and watch multiple sources at the same time.
Control
Having the ability to play music in every room is one thing. Being able to control from every room is something else. This is the next step in the chain but one that is not always necessary. Imagine the house layout shown in Figure 3-1. This needs no complex control systems since the living room is controlled locally, and the kitchen audio stream is usually switched on when you start preparing dinner and switched off once you’ve finished. Consequently, being forced to control the AV from the living room is not an issue.
Nor is it an effort to wire several rooms together (for example, the master bedroom, bathroom, and den) with a speaker control box and leave them on all the time. In this case, it is likely that although two of the three rooms may be unoccupied for most of the day, when one of them is in use, it is at the exclusion of the others, making it unnecessary to apply the cost or effort in providing separate controls for each room.
Local Control
Being able to control the device (such as a speaker or stereo amplifier) from the device itself is the most logical solution, and fortunately most head units provide this automatically. A local amplifier or set of powered (active) speakers, for example, will have a volume control on its front and a means to change the source input. Therefore, any distribution system using AV or Cat5 cables will have control built in.
To affect the volume of a passive speaker (maybe one fed from a remote speaker control box), you need an attenuator placed in series with the speaker. For low-power solutions, it is possible to mount a double logarithmic potentiometer directly into the speaker mountings. (You need logarithmic because this is the way volume works, and you want double for stereo volume control.) This won’t give you particularly good fidelity, since the two tracks inside the device won’t be well matched with each other and some frequencies made be lost, but it will be cheap. For a better solution, there are custom attenuators that come in a basic wall unit and provide a better-looking control mechanism, with improved quality. If your speakers are not wall-mounted, then you will have to run an extra set of cables either inside the wall cavity or in external tracks. Consequently, the cable runs from the speaker control box to the switch and then to the speaker. It is better to consider this approach before laying other cables. Apart from the bathroom (where such attenuators need to be waterproof), this method of control is usually impractical and better served with active head units or no form of local control at all.
Remote-Control Methods
Your house will come alive with the sound of music. Until you’ve lived with music in every room, you cannot underestimate the difference it makes. Being able to change the volume is nice, but not necessary, because each album is normalized to be consistent within itself. However, if you’re randomizing the tracks, then the volume can vary wildly, necessitating a local volume control. And if you’re introducing such functionality, you’ll often want more involved local control to skip those random tracks you don’t want to hear. Such functionality requires more hardware.
Direct Control
Standard HiFi equipment is invariably supplied with an IR remote, making it possible to place an IR relay receiver in each room and line up its transmitter with the receiver eye on the device. Small receivers can be mounted in-wall alongside, or instead of, a light switch and be powered by batteries.
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 packages10 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.
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.
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.
0 Response to "Smart Home Automation Part III - Media Extenders"
Post a Comment