<?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>Matt Daubneys Blog &#187; arduino</title>
	<atom:link href="http://daubers.co.uk/tag/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://daubers.co.uk</link>
	<description></description>
	<lastBuildDate>Sun, 25 Mar 2012 19:34:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Reading Hackspace Door Entry System</title>
		<link>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/</link>
		<comments>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 19:34:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[mosquitto]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[rfid]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=393</guid>
		<description><![CDATA[Maybe 6 months ago I started going to Reading Hackspace. For those of you unaware, wikipedia describes a hackspace as &#8220;a location where people with common interests, often in computers,technology, science, digital or electronic art (but also in many other realms) can meet, socialise and/or collaborate.&#8221; In the past 6 months of hanging out with the Hackspace people, I&#8217;ve probably learnt more than in [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe 6 months ago I started going to <a title="Reading Hackspace" href="http://www.readinghackspace.org.uk" target="_blank">Reading Hackspace</a>. For those of you unaware, wikipedia describes a hackspace as &#8220;a location where people with common interests, often in <a title="Computer" href="http://en.wikipedia.org/wiki/Computer">computers</a>,<a title="Technology" href="http://en.wikipedia.org/wiki/Technology">technology</a>, <a title="Science" href="http://en.wikipedia.org/wiki/Science">science</a>, <a title="Digital art" href="http://en.wikipedia.org/wiki/Digital_art">digital</a> or <a title="Electronic art" href="http://en.wikipedia.org/wiki/Electronic_art">electronic art</a> (but also in many other realms) can meet, <a title="Socialization" href="http://en.wikipedia.org/wiki/Socialization">socialise</a> and/or <a title="Collaboration" href="http://en.wikipedia.org/wiki/Collaboration">collaborate</a>.&#8221; In the past 6 months of hanging out with the Hackspace people, I&#8217;ve probably learnt more than in the previous 12.</p>
<p>Reading Hackspace has recently aquired a physical space to work in, and in order to help things along I offered to build the RFID based door system. As with all systems of this manner, the spec was changed a couple of times along the way, and probably will be changed again in the future.</p>
<p>The door system is composed of three parts:</p>
<ol>
<li>An Arduino based card reader connected to an electronic lock</li>
<li>An MQTT server (namely the epic <a title="Mosquitto MQTT Server" href="http://mosquitto.org/" target="_blank">Mosquitto</a>)</li>
<li>A python script that uses a SQL database to authenticate users running on an Ubuntu server.</li>
</ol>
<p>A full write up is in progress on the <a title="Reading Hackspace WIki Door Entry System" href="http://readinghackspace.org.uk/wiki/Projects/DoorEntrySystem" target="_blank">Reading Hackspace wiki </a>. Here&#8217;s a quick pic of the reader screwed to the door.</p>
<p><a href="http://daubers.co.uk/wp-content/uploads/2012/03/20120311_125832.jpg"><img class="aligncenter size-medium wp-image-394" title="Hackspace RFID Door System" src="http://daubers.co.uk/wp-content/uploads/2012/03/20120311_125832-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>And a video of the system working!</p>
<p><iframe src="http://www.youtube.com/embed/H1JNykWHfgI" frameborder="0" width="560" height="315"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduinos, MQTT and Light levels</title>
		<link>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/</link>
		<comments>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 13:54:36 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[EasyRadio]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[homeeasy]]></category>
		<category><![CDATA[mosquitto]]></category>
		<category><![CDATA[mqtt]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=377</guid>
		<description><![CDATA[Since watching Andy Pipers talk on MQTT at Oggcamp, I&#8217;ve been trying to understand and use Mosquitto with my Arduinos. I&#8217;ve got a few sensors lying around to test this with (and have ordered some more \o/ ) and have started to have some success. Installing Mosquitto is a doddle. I added the ppa to one of [...]]]></description>
			<content:encoded><![CDATA[<p>Since watching <a href="http://blip.tv/episode/5493280" target="_blank">Andy Pipers talk on MQTT</a> at Oggcamp, I&#8217;ve been trying to understand and use <a href="http://mosquitto.org/" target="_blank">Mosquitto</a> with my Arduinos. I&#8217;ve got a few sensors lying around to test this with (and have ordered some more \o/ ) and have started to have some success.</p>
<p>Installing Mosquitto is a doddle. I added the <a href="https://launchpad.net/~mosquitto-dev/+archive/mosquitto-ppa/" target="_blank">ppa</a> to one of my household servers, then just apt-get install mosquitto. MQTT broker up and running in a matter of minutes. The first thing I setup to check if it was working was a simple python program that would just connect to the broker and send &#8220;Hello World&#8221; to the &#8220;hello&#8221; topic. I wrote a second little python script to just listen to the &#8220;hello&#8221; topic and print out the message from any updates. Most of the code was borrowed from <a href="http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/" target="_blank">this blog post</a> which was incredibly helpful <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>With that running happily, I moved on a stage. Digging out an <a href="http://daubers.co.uk/2010/11/07/arduino-powered-lights-and-heating/" target="_blank">old shield</a> for my arduino that I made to control the lights in my flat using some home easy sockets and an RF chip, I added an LDR and used the thermister that was already on the board. This simple set of components means I can now monitor both the temperature and light levels in one of the rooms of my flat. Using an ethernet shield for the arduino also means that I can then report that information to my Mosquitto broker using the arduino mqtt <a href="http://knolleary.net/arduino-client-for-mqtt/" target="_blank">library</a>.</p>
<p>What will I do with all this information? Well, initially I&#8217;m going to write an mqtt to sql bridge (might use this an excuse to learn postgres now mysql has an uncertain OSS future) and will setup some scripts to graph the information. I&#8217;ll probably change this sketch to control the lights in the flat, so I could have a machine somewhere sending a message to the mqtt broker at a set time to turn the lights on in the bedroom (a simple mqtt powered alarm clock <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). Hopefully I&#8217;ll write a small application using the app indicator framework for Ubuntu (and growl for OSX) to tell me when certain thresholds are passed, especially for the other sensors I have coming (Alcohol, Gas, Smoke and humidity). I might write another bridge to use the google cloud messaging system to add an alert on my phone as well.</p>
<p>There&#8217;s a whole world of possibilities out there, thanks to so many people building these various components and libraries that make hacking fun toys so much easier <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Many thanks to all those who have developed the frameworks, libraries and services that I&#8217;m using and for making the F/OSS to make life even easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino powered lights and heating!</title>
		<link>http://daubers.co.uk/2010/11/07/arduino-powered-lights-and-heating/</link>
		<comments>http://daubers.co.uk/2010/11/07/arduino-powered-lights-and-heating/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 10:35:39 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[homeeasy]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=305</guid>
		<description><![CDATA[Over the past few weeks as it gets colder, I&#8217;ve really started to notice the significant bite in heating costs from our flat being largely electrically heated. The main issue with this system is that none of the heaters have thermostats, they are either on, or off. As each heater is 2kW or greater, and there are [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few weeks as it gets colder, I&#8217;ve really started to notice the significant bite in heating costs from our flat being largely electrically heated. The main issue with this system is that none of the heaters have thermostats, they are either on, or off. As each heater is 2kW or greater, and there are 4 of them in the flat, that means at any one time we could be using 8kWh of electricity. Which is a lot of money during the day!</p>
<p>The solution? Build a thermostat for them (and replace 2 with a gas convection heater). The circuit for this is quite simple thanks to the fantastic <a title="Home Easy" href="http://www.homeeasy.eu/" target="_blank">home easy</a> set of sockets. I bought a pack of three sockets (with a remote) and a light bulb holder (we&#8217;ll come back to that later). On top of this I needed a temperature sensor (<a title="Oomlout" href="http://www.oomlout.co.uk/temperature-sensor-tmp36-p-210.html?zenid=d74b7684dee3517325e0519f862e905f" target="_blank">tmp36</a>), a <a title="ebay" href="http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&amp;item=220680308396&amp;ssPageName=STRK:MEWNX:IT#ht_1024wt_907" target="_blank">433MHz transmitter </a>, <a href="http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&amp;item=220680305606&amp;ssPageName=STRK:MEWNX:IT#ht_741wt_907" target="_blank">a 433MHz reciever</a> and <a title="Oomlout Arduino Uno" href="http://www.oomlout.co.uk/arduino-uno-p-252.html?zenid=d74b7684dee3517325e0519f862e905f" target="_blank">an arduino uno</a>.</p>
<p>Thanks to the lovely folks at the <a title="Home Easy Hacking Wiki" href="http://homeeasyhacking.wikia.com/wiki/Home_Easy_Hacking_Wiki" target="_blank">Home Easy Hacking Wiki</a> getting this lot to work together with an arduino is easy as anything! Here is the basic circuit:</p>
<p><a href="http://daubers.co.uk/wp-content/uploads/2010/11/HomeEasySockets.png"><img class="aligncenter size-medium wp-image-306" title="Home Easy Transmitter Diagram" src="http://daubers.co.uk/wp-content/uploads/2010/11/HomeEasySockets-300x190.png" alt="Home Easy Transmitter Diagram" width="300" height="190" /></a>This is only the transmitter/temperature sensor part. Initially you&#8217;ll need to build a receiver to get the ID of your remote. This can be found at <a title="Arduino Home Easy Playground" href="http://www.arduino.cc/playground/Code/HomeEasy">this page</a> in the arduino playground. Once you have your remotes ID, you just need a simple arduino sketch to turn the socket thats plugged into the heater on/off! Here it is&#8230;.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">HomeEasy homeEasy<span style="color: #339933;">;</span>
boolean isOn<span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> incomingByte <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// for incoming serial data</span>
<span style="color: #993333;">float</span> timeOn<span style="color: #339933;">=-</span><span style="color: #0000dd;">900000</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> myCode <span style="color: #339933;">=</span> <span style="color: #0000dd;">1595082</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
       Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       homeEasy <span style="color: #339933;">=</span> HomeEasy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       homeEasy.<span style="color: #202020;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       isOn <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 1 = On, 0 = Off</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">float</span> temp <span style="color: #339933;">=</span> getTemp<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>temp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// read the incoming byte:</span>
    incomingByte <span style="color: #339933;">=</span> Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// say what you got:</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>incomingByte <span style="color: #339933;">==</span> <span style="color: #0000dd;">111</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//turn on the group</span>
      homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>incomingByte <span style="color: #339933;">==</span> <span style="color: #0000dd;">102</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// turn off the group</span>
      homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>temp <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color:#800080;">18.0</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> isOn <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> millis<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>timeOn <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000dd;">300000</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//turn on the heaters</span>
     homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     isOn <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
     timeOn <span style="color: #339933;">=</span> millis<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>temp <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color:#800080;">18.0</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> isOn <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> millis<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>timeOn <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000dd;">300000</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    homeEasy.<span style="color: #202020;">sendAdvancedProtocolMessage</span><span style="color: #009900;">&#40;</span>myCode<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    isOn <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    timeOn <span style="color: #339933;">=</span> millis<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
* getVoltage() – returns the voltage on the analog input defined by
* pin
*/</span>
<span style="color: #993333;">float</span> getTemp<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> pin<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>analogRead<span style="color: #009900;">&#40;</span>pin<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color:#800080;">.004882814</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color:#800080;">100.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//converting from a 0 to 1023 digital range</span>
                                        <span style="color: #666666; font-style: italic;">// to 0 to 5 volts (each 1 reading equals ~ 5 millivolts</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This code ensures that there is no change in status for at least 5 minutes, basically so the socket doesn&#8217;t go continuously on/off and damage something! There is also a hook for a serial input to turn on the &#8220;group&#8221; of the remote. This is to turn on the light in my bedroom. I&#8217;m in the process of writing two simple bits of python to turn a light on/of depending which is run. This means I can set up a cron to turn on a light at a given time! Simple alarm clock <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To get this code to work you&#8217;ll need the homeeasy library from <a href="http://code.google.com/p/homeeasyhacking/source/browse/#svn/trunk/Arduino" target="_blank">here</a>. You may need to alter the pin allocation in homeeasy.cpp, but that shouldn&#8217;t be too hard to do!</p>
<p>Next thing to do on this project is to get my Revo setup as a little wireless server box to graph the temperature changes and run the alarm clock. Conveniently it&#8217;s being replaced with a mac mini this week so has become available to complete the project. This will be a simple ubuntu box, running ubuntu server and little else really. Thought it may gain an ldap database for another, slightly different project.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2010/11/07/arduino-powered-lights-and-heating/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino and Easy Radios</title>
		<link>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/</link>
		<comments>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 09:55:41 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[EasyRadio]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[easy-radio]]></category>
		<category><![CDATA[example]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=264</guid>
		<description><![CDATA[A few days ago I received a pair of Easy Radios to help with a project I&#8217;m working on. Since I&#8217;ve never used these before (having only got my first arduino a couple of weeks ago) I had a dig on the net for information on how to use them. Since this information was quite [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I received a pair of Easy Radios to help with a project I&#8217;m working on. Since I&#8217;ve never used these before (having only got my first arduino a couple of weeks ago) I had a dig on the net for information on how to use them. Since this information was quite sparse, I thought I&#8217;d put up my experimental rig to show it working. This setup requires 2 arduinos, an easy radio transmitter and an easy radio receiver.  First, the transmitter layout.</p>
<div id="attachment_276" class="wp-caption aligncenter" style="width: 222px"><a href="http://daubers.co.uk/wp-content/uploads/2010/02/transmit.png"><img class="size-medium wp-image-276" title="Transmitter Layout" src="http://daubers.co.uk/wp-content/uploads/2010/02/transmit-212x300.png" alt="Transmitter Layout" width="212" height="300" /></a><p class="wp-caption-text">Transmitter Layout</p></div>
<p style="text-align: left;">Now the receiver layout.</p>
<div id="attachment_275" class="wp-caption aligncenter" style="width: 222px"><a href="http://daubers.co.uk/wp-content/uploads/2010/02/recieve.png"><img class="size-medium wp-image-275" title="Receiver Layout" src="http://daubers.co.uk/wp-content/uploads/2010/02/recieve-212x300.png" alt="Receiver Layout" width="212" height="300" /></a><p class="wp-caption-text">Receiver Layout</p></div>
<p style="text-align: center;">
<p style="text-align: left;">and finally the code.</p>
<p style="text-align: left;"><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">#reciever code</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">19200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> BYTE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#transmitter code</span>
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">19200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">write</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Hello<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This should result in the receiver outputting &#8220;Hello&#8221; over and over across the USB serial in the arduino environments serial monitor. If you have any problems, feel free to give me a shout! Oh, make sure you unplug the easy radio receiver from the arduino before flashing it, it&#8217;ll throw nasty errors otherwise. (Simply unplug digital 0 pin on the arduino board)</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

