That is all.
That is all.
I recently got my hands on an X10 Firecracker Kit to control my appliances and lighting remotely in conjunction with automating certain daily routines such as turning on an air purifier, air conditioner or a space heater.
Below is simplistic approach I took to setting up a basic wireless remote system that is accessible via the net. It’s a result of a few hours work and is fully functional, but is far from complete Anyone looking to do this should have an intermediate understanding of how Windows, Apache, PHP and SQL work. I based the foundation of this system off of a project featured 4 years ago on Hak.5: How to control your lights from an internet enabled cell phone (Episode Video) (Project Wiki). I augmented the project by incorporating a mysql database for keeping track of appliance status and swapped out the undocumented, executable that talked to the firecracker with one that actually explained the syntax. In part two I’ll take on the automation aspect of the project.
What to use:
What to do:
1. Setup and configure the Firecracker as recommended by X10. Hook up the COM port module, install, configure and test with X10 software to confirm everything is working out of the box.
3. Download Adam Brigs’ CMA17 Protocol and attempt to turn on/off devices with it from the command line. The syntax is very simple and allows for multiple devices to react within one call. For example to turn on appliance 1 on channel A using COM 1 you would type: cm17a 1 a1on
4. Install and configure Wamp server adjusting the httpd.conf to your liking to allow access to the server from other IPs. If allowing access via the web as a minimum set up basic authentication with .htaccess.
5. Using phpMyAdmin in Wamp create a database called “x10″ and be sure to create a user with sufficient privileges to read/write or add a password to the root account.
6. Insert a table called appliance_status (download sql table structure and example records)
7. Modify or add records to appliance_status.
uid = unique identifier
appliance_id = x10 receiver id number and frequency
status = If device is on of off (bool 0 = off 1 = on)
last updated = last request sent to server (self updating current timestamp)
appliance_name = friendly appliance name
8. Copy code to x10.php and place in www directory. Be sure to adjust the first set of variables values as necessary ($cm17a, $comport,$ dbhost,$dbuser,$dbpass).
<title>X10 iPhone Remote</title>
<meta name=”viewport” content=”width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;” />
<link rel=”apple-touch-icon” href=”/iphone.png” />
<link media=”only screen and (max-device-width: 480px)” href=”/iphone.css” type= “text/css” rel=”stylesheet” />
$comport = ’1′;
$cm17a = ‘c:\wamp\www\cm17a’;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error Connecting to mysql’);
$dbname = ‘x10′;
system($cm17a . ‘ ‘ . $comport . ‘ ‘ . $_GET['App'] . $_GET['ChangeStatus']);
if($_GET['ChangeStatus'] == ‘On’)
$updatesql = “update appliance_status set status = ” . $UpdateStatus .” where appliance_id = ‘” . $_GET['App'] . “’”;
$get_apps = mysql_query(“SELECT * FROM appliance_status”);
while($row = mysql_fetch_array($get_apps))
$aID = $row['appliance_id'];
$aName = $row['appliance_name'];
if ($row['status'] == ’0′)
$aDate = $row['last_updated'];
echo ‘<tr><td><font size=”10px” face=”geneva, arial, san serif”>’ . $aName . ‘</font></td><td><a href=”?ChangeStatus=’ . $aChange . ‘&App=’ . $aID . ‘” ><img src = “/’ . $aChange . ‘.jpg” width =”75? border = “0? </a></td></tr>’;
9. Add on and off jpegs to www directory (download buttons.zip)
10. If all is well you should be able to navigate to the x10.php and turn on and off your appliances till the cows come home. Enjoy.
Basketball just ain’t what it used to be.
Video games are a different story: http://www.retronintendogames.com/j/jordbird/
While home for Thanksgiving my mom dug out ton of Legos from under the eves for me. I took a container of them back to Boston in hopes of putting them to good use.
My first of hopefully many Lego doodads: The iPhone Dock