<?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>codetorment &#187; remote</title>
	<atom:link href="http://www.codetorment.com/tag/remote/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codetorment.com</link>
	<description>code, tech, random stuff</description>
	<lastBuildDate>Tue, 04 May 2010 21:04:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=1648</generator>
		<item>
		<title>Arduino wireless motion detector : part 2</title>
		<link>http://www.codetorment.com/2009/10/25/arduino-wireless-motion-detector-part-2/</link>
		<comments>http://www.codetorment.com/2009/10/25/arduino-wireless-motion-detector-part-2/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 17:23:58 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[rf-transmitter]]></category>
		<category><![CDATA[shield]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://www.codetorment.com/?p=345</guid>
		<description><![CDATA[In this part we&#8217;ll connect to a webpage and fetch some data from a php script. When building a project it&#8217;s better to test and debug each part on its own instead of trying to debug a much larger system. So we&#8217;ll start by attaching an ethernet shield and get it to talk to a [...]]]></description>
			<content:encoded><![CDATA[<p>In this part we&#8217;ll connect to a webpage and fetch some data from a php script.</p>
<p>When building a project it&#8217;s better to test and debug each part on its own instead of trying to debug a much larger system. So we&#8217;ll start by attaching an ethernet shield and get it to talk to a webpage. Once that is up and running we&#8217;ll connect the second arduino and rf.</p>
<p><span style="color: #ffffff;">Note: For this part you&#8217;ll need a webhosting account with a company who provides access to PHP on it&#8217;s accounts. Or you&#8217;ll need to run a local webserver. Contact your webhost to verify if your account has PHP access enabled.</span></p>
<div id="attachment_350" class="wp-caption alignnone" style="width: 526px"><a href="http://www.codetorment.com/wp-content/uploads/DSCN9556.JPG"><img class="size-full wp-image-350   " title="DSCN9556" src="http://www.codetorment.com/wp-content/uploads/DSCN9556.JPG" alt="Arduino Ethernet Shield" width="516" height="425" /></a><p class="wp-caption-text">Arduino Ethernet Shield</p></div>
<p><span id="more-345"></span>First we&#8217;ll create a script named &#8216;time.php&#8217; which will print out the date and time when we visit www.yourdomain.com/time.php . Open the file and paste the following code:</p>
<pre class="brush: php;">
&lt;?php
// Prints something like: Sunday 25th of October 2009 07:12:46 PM
echo date('l jS \of F Y h:i:s A');
?&gt;
</pre>
<p>Now close, save and upload time.php to your domain. If you put the script in the www or public_html folder it will be accesible from www.yourdomain/time.php if you&#8217;ve placed it inside another folder make sure to use www.yourdomain.com/folder/time.php in the next part.</p>
<p>Before we continue, open a webbrowser and go to www.yourdomain/time.php or wherever you placed the script and make sure it shows the date and time.</p>
<p>When the script is working, start the arduino IDE , create a new sketch and copy paste the code below</p>
<pre class="brush: cpp;">
#include &lt;Ethernet.h&gt;

byte mac[] = {   0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {   xxx, xxx, xxx, xxx};
byte server[] = { yyy, yyy, yyy, yyy};

Client client(server, 80);

void setup()
{
  pinMode(switchPin, INPUT);
  Ethernet.begin(mac, ip);
  Serial.begin(9600);

  delay(1000);

  Serial.println(&quot;connecting...&quot;);

  if (client.connect()) {
    Serial.println(&quot;connected&quot;);
    client.print(&quot;GET http://www.yourdomain.com/folder/time.php HTTP/1.0\n&quot;);
    client.print(&quot;Host: www.yourdomain.com\n\n&quot;);
    client.println();
  }
  else {
    Serial.println(&quot;connection failed&quot;);
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println(&quot;disconnecting.&quot;);
    client.stop();
    for(;;)
      ;
  }
}
</pre>
<p>&nbsp;</p>
<pre class="brush: cpp;">byte ip[] = { xxx, xxx, xxx, xxx};
</pre>
<p>Make sure to change the xxx, xxx, xxx, xxx with your settings, where xxx, xxx, xxx, xxx should be an available ip in the range of your network. Check your router for the range of ip-adresses in your network.</p>
<p>in my case the above line would read :</p>
<pre class="brush: cpp;">
byte ip[] = { 192, 168, 1, 36};
</pre>
<p>Next is the ip address of the server you wish to connect to. If your webhost does not provide you with a unique ip dedicated to your domain you should try using google&#8217;s ip. To check if your domain is asigned a unique ip ( your domain is the only one hosted on that ip ) open a command prompt and ping your domain with &#8216;ping www.yourdomain.com&#8217;.  On the next line the ip adress associated with your domain should show up on windows in the form of &#8216;Ping statistics for domain xxx.xxx.xxx.xxx&#8217;. Now open a browser and type in xxx.xxx.xxx.xxx instead of www.yourdomain.com. If you are seeing your domain, you have a unique ip assigned to your domain. If not, ping www.google.com and use the ip adress returned for the yyy.yyy.yyy.yyy below.</p>
<pre class="brush: cpp;">
byte server[] = { yyy, yyy, yyy, yyy};
</pre>
<p><a href="http://www.codetorment.com/wp-content/uploads/cmd02.jpg"><img title="cmd02" src="http://www.codetorment.com/wp-content/uploads/cmd02.jpg" alt="cmd02 Arduino wireless motion detector : part 2" width="535" height="192" /></a></p>
<p>So the server ip becomes :</p>
<pre class="brush: cpp;">
byte server[] = { 74, 125, 67, 100};
</pre>
<p>These settings should get you up and running. The only thing left to do is change these lines to match your domain and the url of the time.php script :</p>
<pre class="brush: cpp;">
client.print(&quot;GET http://www.yourdomain.com/folder/time.php HTTP/1.0\n&quot;);
client.print(&quot;Host: www.yourdomain.com\n\n&quot;);
</pre>
<p>Now upload the code to the arduino and open the serial monitor.<br />
If all went well the monitor should show something similar:</p>
<div id="attachment_389" class="wp-caption alignnone" style="width: 409px"><a href="http://www.codetorment.com/wp-content/uploads/serial.JPG"><img class="size-full wp-image-389" title="serial" src="http://www.codetorment.com/wp-content/uploads/serial.JPG" alt="Serial Monitor" width="399" height="352" /></a><p class="wp-caption-text">Serial Monitor</p></div>
<p>As you can see second to last line displays the correct date and time.</p>
<p>Check <a title="Part 3" href="http://www.codetorment.com/2009/11/07/arduino-wireless-motion-detector-part-3/" target="_self">part 3</a> where I show you how to put it all together to create a weblogging wireless motion detector.</p>
<p><a title="Home" href="http://www.codetorment.com/" target="_self">Back to homepage</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.codetorment.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.codetorment.com/2009/10/25/arduino-wireless-motion-detector-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Arduino Goodness : Continued</title>
		<link>http://www.codetorment.com/2009/10/24/arduino-goodness-continued/</link>
		<comments>http://www.codetorment.com/2009/10/24/arduino-goodness-continued/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 13:17:49 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[pir]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[rf-transmitter]]></category>
		<category><![CDATA[shield]]></category>

		<guid isPermaLink="false">http://www.codetorment.com/?p=270</guid>
		<description><![CDATA[In a recent shopping spre I bought some new arduino stuff to play with. This is the rest of the parts I received: The Arduino Sensor Shield is a handy extension for attaching sensors and servo&#8217;s using standard cables The shields provides you with: 6 analog connectors ( 5 on the left and one on [...]]]></description>
			<content:encoded><![CDATA[<p><strong>In a recent shopping spre I bought some new arduino stuff to play with.</strong></p>
<p>This is the rest of the parts I received:</p>
<div id="attachment_272" class="wp-caption alignnone" style="width: 469px"><a href="http://www.codetorment.com/wp-content/uploads/000_0273.JPG"><img class="size-large wp-image-272   " title="000_0273" src="http://www.codetorment.com/wp-content/uploads/000_0273-1024x770.jpg" alt="Arduino Sensor Shield" width="459" height="345" /></a><p class="wp-caption-text">Arduino Sensor Shield</p></div>
<p>The Arduino Sensor Shield is a handy extension for attaching sensors and servo&#8217;s using standard cables<span id="more-270"></span></p>
<p>The shields provides you with:</p>
<ul>
<li> 6 analog connectors ( 5 on the left and one on the bottom )</li>
<li>13 digital IO headers (4 x 4 3-pin headers )</li>
<li>6 analog IO headers ( 6 3-pin headers )</li>
<li>Communication port ( I2C or UART, connector on the right)</li>
</ul>
<div id="attachment_279" class="wp-caption alignnone" style="width: 469px"><a href="http://www.codetorment.com/wp-content/uploads/000_0278.JPG"><img class="size-large wp-image-279    " title="000_0278" src="http://www.codetorment.com/wp-content/uploads/000_0278-1024x762.jpg" alt="Sensor Shield with PIR-sensor" width="459" height="341" /></a><p class="wp-caption-text">Sensor Shield with PIR-sensor attached</p></div>
<p><!--more-->A PIR or Passive Infrared Sensor is a device that measures infrared light radiating from any objects in its field of view. These sensors are often used in backyard or driveway motion detectors.   Bassicaly they measure the amount of IR radiated by objects around it and detect sudden fluctuations  i.e. caused by a person walking into a sensors&#8217;  field of view.</p>
<p>I love the sensor shield for prototyping purposes, it will certainly lower the number of connections to your breadboard.</p>
<p>All these parts were bought on ebay, search for &#8216;arduino sensor shield&#8217; by clicking  <a title="Ebay Search 'Arduino+sensor+shield'" href="http://shop.ebay.com/?_from=R40&amp;_trksid=p3907.m38.l1313&amp;_nkw=arduino+sensor+shield&amp;_sacat=See-All-Categories" target="_blank">here</a></p>
<div id="attachment_297" class="wp-caption alignnone" style="width: 526px"><a href="http://www.codetorment.com/wp-content/uploads/000_0284.JPG"><img class="size-large wp-image-297   " title="000_0284" src="http://www.codetorment.com/wp-content/uploads/000_0284-1024x709.jpg" alt="RF receiver-transmitter pair" width="516" height="357" /></a><p class="wp-caption-text">RF receiver-transmitter pair</p></div>
<p>A RadioFrequency receiver-transmitter pair with 4-channels, 1 connector for each channel. The one on the left is the receiver, it also came with an antenna, like the one you see on the right, but it wasn&#8217;t soldered on.</p>
<p>The green transmitter and receiverboards have male headers and plug into the female headers mounted on the red extender boards. I have played around with them and can say that they work. I still need to check the maximum range these things will go. These were tested to be working at 4 meters appart with a wooden door and a drywall in between.</p>
<p>In a next post I&#8217;ll demonstrate an arduino motion-sensor-over-rf  to a webserver running php</p>
<p>pir-sensor  &gt;&gt;  arduino &gt;&gt;  rf-transmitter   . . .  _ _ _ . . .     rf-receiver  &gt;&gt;  arduino &gt;&gt;  ethernetshield &gt;&gt;  php</p>
<p><a title="Home" href="http://www.codetorment.com/" target="_self">Back to homepage</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.codetorment.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.codetorment.com/2009/10/24/arduino-goodness-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
