<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TheDorkSeriously &#187; remote control</title>
	<atom:link href="http://www.thedorkseriously.com/tag/remote-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedorkseriously.com</link>
	<description></description>
	<lastBuildDate>Wed, 27 Jul 2011 01:42:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Kevin McCallister would&#8217;ve got a kick out of this: iPhone X10 Remote Control (How To Part 1)</title>
		<link>http://www.thedorkseriously.com/2010/01/03/kevin-mccallister-wouldve-got-a-kick-out-of-this-iphone-x10-remote-control-how-to-part-1/</link>
		<comments>http://www.thedorkseriously.com/2010/01/03/kevin-mccallister-wouldve-got-a-kick-out-of-this-iphone-x10-remote-control-how-to-part-1/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 22:08:13 +0000</pubDate>
		<dc:creator>Rob Lynch</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[What I'm Doing]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[cm17a]]></category>
		<category><![CDATA[hak.5]]></category>
		<category><![CDATA[lighting]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[remote control]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[x10]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://www.thedorkseriously.com/?p=476</guid>
		<description><![CDATA[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.
Get the Flash Player to see this video.
 // 
Below is simplistic approach I took to setting up a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got my hands on an <a href="http://www.x10.com/automation/ck18a_s_ps32.html" target="_blank">X10 Firecracker Kit</a> 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.</p>
<div id="v9037"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this video.</div>
<p><script src="https://media.dreamhost.com/mp4/swfobject.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
        var swf = new SWFObject("https://media.dreamhost.com/mp4/player.swf", "mpl", "540", "359", 8); swf.addParam("allowfullscreen", "true"); swf.addParam("allowscriptaccess", "always"); swf.addVariable("file", "http://www.thedorkseriously.com/wp-content/uploads/2009/12/X10_Lights_Example_conv.flv"); swf.addVariable("image", "http://www.thedorkseriously.com/wp-content/uploads/2009/12/X10_Lights_Example_conv.jpeg"); swf.write("v9037");
// ]]&gt;</script></p>
<p>Below is simplistic approach I took to setting up a basic wireless remote system that is accessible via the net. It&#8217;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 <a href="http://www.hak5.org/episodes/season1-episode1" target="_blank">(Episode Video)</a> <a href="http://wiki.hak5.org/wiki/Episode_1x01" target="_blank">(Project Wiki)</a>. 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&#8217;ll take on the automation aspect of the project.</p>
<p>What to use:</p>
<ul>
<li> A PC with Windows XP and a DB9 COM port.</li>
<li><a href="http://www.x10.com/automation/ck18a_s_ps32.html">X10 Firecracker Kit</a></li>
<li><a href="http://www.x10.com/support/support_soft1.htm" target="_blank">Firecracker Software</a> (not sure if this is a necessity, but doesn&#8217;t hurt to install)</li>
<li><a href="http://www.wampserver.com/en/" target="_blank">Wamp Server</a> (Apache w/PHP5 and MySQL)</li>
<li><a href="http://www.ubasics.com/adam/electronics/cm17.shtml">CMA17A Protocol</a></li>
</ul>
<p>What to do:</p>
<p>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.</p>
<p>2. Stop the x10 Device Network Service (x10nets) and set the service status to disabled or manual to free up the COM port.<br />
<a href="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-1.png"><img class="alignnone size-full wp-image-500" title="Picture 1" src="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-1.png" alt="" width="581" height="571" /></a></p>
<p>3. Download Adam Brigs&#8217; <a href="http://www.ubasics.com/adam/electronics/cm17a.zip">CMA17 Protocol</a> 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</p>
<p><a href="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-2.png"><img class="alignnone size-full wp-image-499" title="Picture 2" src="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-2.png" alt="" width="573" height="322" /></a></p>
<p>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.</p>
<p>5. Using phpMyAdmin in Wamp create a database called &#8220;x10&#8243; and be sure to create a user with sufficient privileges to read/write or add a password to the root account.</p>
<p>6. Insert a table called appliance_status (<a href="http://www.thedorkseriously.com/wp-content/uploads/2009/12/x10.txt" target="_blank">download sql table structure and example records</a>)</p>
<p>7. Modify or add records to appliance_status.</p>
<p>Row Definitions:<br />
uid = unique identifier<br />
appliance_id = x10 receiver id number and frequency<br />
status = If device is on of off (bool 0 = off 1 = on)<br />
last updated =  last request sent to server (self updating current timestamp)<br />
appliance_name = friendly appliance name</p>
<p><a href="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-3.png"><img class="alignnone size-full wp-image-498" title="Picture 3" src="http://www.thedorkseriously.com/wp-content/uploads/2009/12/Picture-3.png" alt="" width="572" height="386" /></a></p>
<p>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).</p>
<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;X10 iPhone Remote&lt;/title&gt;<br />
&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;&#8221; /&gt;<br />
&lt;link rel=&#8221;apple-touch-icon&#8221; href=&#8221;/iphone.png&#8221; /&gt;<br />
&lt;link media=&#8221;only screen and (max-device-width: 480px)&#8221; href=&#8221;/iphone.css&#8221; type= &#8220;text/css&#8221; rel=&#8221;stylesheet&#8221; /&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;?php<br />
$comport = &#8216;1&#8242;;<br />
$cm17a = &#8216;c:\wamp\www\cm17a&#8217;;</p>
<p>$dbhost=&#8217;localhost&#8217;;<br />
$dbuser=&#8217;root&#8217;;<br />
$dbpass=&#8217;x10&#8242;;<br />
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (&#8216;Error Connecting to mysql&#8217;);<br />
$dbname = &#8216;x10&#8242;;<br />
mysql_select_db($dbname, $conn);</p>
<p>if(isset($_GET['ChangeStatus'])) {<br />
system($cm17a . &#8216; &#8216; . $comport . &#8216; &#8216; . $_GET['App'] . $_GET['ChangeStatus']);</p>
<p>if($_GET['ChangeStatus'] == &#8216;On&#8217;)<br />
{<br />
$UpdateStatus=1;<br />
}else{<br />
$UpdateStatus=0;<br />
}</p>
<p>$updatesql = “update appliance_status set status = ” . $UpdateStatus .” where appliance_id = &#8216;” . $_GET['App'] . “&#8217;”;<br />
mysql_query($updatesql);<br />
}<br />
?&gt;</p>
<p>&lt;p align=”center”&gt;<br />
&lt;table&gt;</p>
<p>&lt;?php</p>
<p>$get_apps = mysql_query(“SELECT * FROM appliance_status”);<br />
while($row = mysql_fetch_array($get_apps))<br />
{<br />
$aID = $row['appliance_id'];<br />
$aName = $row['appliance_name'];</p>
<p>if ($row['status'] == &#8216;0&#8242;)<br />
{<br />
$aStatus=&#8217;Off&#8217;;<br />
$aChange=&#8217;On&#8217;;<br />
}else{<br />
$aStatus=&#8217;On&#8217;;<br />
$aChange=&#8217;Off&#8217;;<br />
}</p>
<p>$aDate = $row['last_updated'];<br />
echo &#8216;&lt;tr&gt;&lt;td&gt;&lt;font size=”10px” face=”geneva, arial, san serif”&gt;&#8217; . $aName . &#8216;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;a href=”?ChangeStatus=&#8217; . $aChange . &#8216;&amp;App=&#8217; . $aID . &#8216;” &gt;&lt;img src = “/&#8217; . $aChange . &#8216;.jpg” width =”75? border = “0? &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&#8217;;</p>
<p>}</p>
<p>mysql_close($conn);<br />
?&gt;</p>
<p>&lt;/table&gt;<br />
&lt;/p&gt;<br />
&lt;/body&gt;</p>
<p><!--formatted-->9. Add on and off jpegs to www directory (<a href="http://www.thedorkseriously.com/wp-content/uploads/2009/12/buttons.zip" target="_blank">download buttons.zip</a>)<br />
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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedorkseriously.com/2010/01/03/kevin-mccallister-wouldve-got-a-kick-out-of-this-iphone-x10-remote-control-how-to-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://www.thedorkseriously.com/wp-content/uploads/2009/12/X10_Lights_Example_conv.flv" length="498174" type="video/x-flv" />
		</item>
	</channel>
</rss>

