Hardware Reference
In-Depth Information
Although the cost of the shield is expensive, it scores over the software version by being able to handle 16-bit
waveforms, and work without an amplifier circuit, as there's one built it. Also, depending on the amount of audio you
might have, the built-in SD slot gives you more space than a vanilla Arduino.
Web Access
By far the most influential of all communication methods in the 20th and 21st centuries has been the World Wide
Web. Also known as the Web, the interwebs, 11 the Internet (as a whole), and a series of tubes, the HTTP protocol
is so ubiquitous that it now appears on the most lowly of handheld and mobile devices. This in itself makes it
incredibly valuable, because you do not have to consider the technical issues around other protocols, specific code
to manipulate them, or customized applications for each handheld device on the market. Using it control our house
means that you, quite literally, have a home page.
The Web, like everything you've seen, works with both client and server components. The client is more
commonly known as the web browser , running on an arbitrary machine somewhere in the world, while the server
processes requests from the web browser and is located on the home server machine. These requests are generally for
static HTML web pages, but they can be scripts—written in virtually any language—to dynamically generate a page
or run software locally. The server runs under a user such as www-data , depending on distribution, meaning that any
local processing will be done under the jurisdiction of this user, which may require that some software will require the
appropriate permissions to access the necessary devices. This is often true of the audio device (for speech and music
playback) and the serial ports (for X10 control).
When producing a set of requirements for the web server, you must distinguish between what processing is
to be done on the client and what's on the server. As an example, if you think that it'd be a good idea to play MP3s
from a web page, it's important to know whether your intention is to listen to your music collection while at work or
to organize a playlist while at home (perhaps during a party), where you can hear the server's audio output but not
necessarily access it physically.
Building a Web Server
The web server of choice for so much of the open source community is Apache. Currently at version 2, this project
originated in 1992 and was called a “patchy” web server, because of its ad hoc development processes in the early
years. It has since flourished into one of the most-used pieces of software in the world, running about 50 percent of all
web sites on the Internet.
The power of Apache comes from its flexibility with modules. This allows an efficient and secure core able to
enlist the functionality of supplementary code that can be loaded and unloaded at will. Naturally, each module
provides another opportunity to open unintentional security holes, so we'll install only the modules you need. For
these primary purposes, you need only the basic server and a scripting language. The Debian packages are installed
with the following:
apt-get install apache2 libapache2-mod-php5
Other distributions are similarly named. Once it's installed, you can point your browser to localhost where you
should see the “congratulations” web page, stored by default in /var/www , thus proving the web server works. You can
then test the scripting module by creating a page called test.php containing the following:
<?php
echo phpInfo();
?>
&LAMESINANEMAILTO /dev/null PLEASE
Search WWH ::




Custom Search