<?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>Digits Domotica Blog</title>
	<atom:link href="http://blog.hekkers.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hekkers.net</link>
	<description>My Weblog about Domotica and more</description>
	<lastBuildDate>Thu, 17 May 2012 21:23:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>FEZ Panda II with HD44780 controlled LCD</title>
		<link>http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/</link>
		<comments>http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/#comments</comments>
		<pubDate>Thu, 17 May 2012 20:30:40 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[.NET MF]]></category>
		<category><![CDATA[.NET MF hardware]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=3019</guid>
		<description><![CDATA[Second test: displaying text on a 20&#215;4 LCD controlled by a HD44780 compatible driver chip. As you can see, it&#8217;s working After Eric VDB pointed me to Codeshare in a comment on a previous post, I couldn&#8217;t resist searching for something that could help me get started. And I found something … <a href="http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6802c.jpg"><img class="alignleft size-full wp-image-3020" title="Panda II with HD44780 LCD" src="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6802c.jpg" alt="Panda II with HD44780 LCD" width="450" height="338" /></a>Second test: displaying text on a 20&#215;4 LCD controlled by a HD44780 compatible driver chip. As you can see, it&#8217;s working <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>After Eric VDB pointed me to <a href="http://www.tinyclr.com/codeshare">Codeshare</a> in a comment on a previous <a href="http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/comment-page-1/#comment-13739">post</a>, I couldn&#8217;t resist searching for something that could help me get started.</p>
<p>And I found something useful <a href="http://www.tinyclr.com/codeshare/entry/369">here</a>. Although the example that came with it was targeted for a Gadgeteer Extender Module (which I don&#8217;t have), I had no problems getting it to work. I created an additional constructor that would accept pin numbers, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">SerialLCDDisplay lcd <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SerialLCDDisplay<span style="color: #008000;">&#40;</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di21</span>, <span style="color: #008080; font-style: italic;">// RS</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di23</span>, <span style="color: #008080; font-style: italic;">// ENABLE</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di25</span>, <span style="color: #008080; font-style: italic;">// DB4</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di27</span>, <span style="color: #008080; font-style: italic;">// DB5</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di29</span>, <span style="color: #008080; font-style: italic;">// DB6</span>
                     FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Di31</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// DB7</span></pre></div></div>

<p>It took me some time to figure that out, but within the hour I had the LCD running. I added an endless loop with an increasing counter and a delay of 1 second and let the <del>sketch</del> program run; at the time I took the picture it had been running for more than 4 hours.</p>
<p>One thing I noticed was that the LCD sometimes displayed garbage when the Panda was rebooted; after that everything worked OK, but startup looked a bit ugly. Maybe give the hardware connected to the Panda some more time to settle? I don&#8217;t know yet; we&#8217;ll see about that later. Another thing I need to have a look at is the fact that this SerialLCDDisplay class was apparently written for an LCD with 2 lines; cause line 0 (first line on the LCD) and 1 (second line on the LCD) were OK, but output destined for line 2 were shown on the first line of the LCD again &#8211; probably a minor issue.</p>
<p>And since I&#8217;ll have to change the class code for that anyway, I&#8217;ll also add 2 additional parameters with which I can set the number of rows and columns of the LCD &#8211; cause I have both 20&#215;4 as well as 16&#215;2 LCDs!</p>
<p>Oh, and I saw these automatically generated Debug messages appearing in the Debug output window in Visual Studio on my PC:</p>
<pre>GC: 4msec 12132 bytes used, 52248 bytes available
Type 0F (STRING              ):     96 bytes
Type 11 (CLASS               ):   1596 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):    108 bytes
Type 15 (FREEBLOCK           ):  52248 bytes
Type 17 (ASSEMBLY            ):   7560 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 19 (REFLECTION          ):     24 bytes
Type 1B (DELEGATE_HEAD       ):     72 bytes
Type 1D (OBJECT_TO_EVENT     ):    168 bytes
Type 1E (BINARY_BLOB_HEAD    ):    156 bytes
Type 1F (THREAD              ):    384 bytes
Type 20 (SUBTHREAD           ):     48 bytes
Type 21 (STACK_FRAME         ):    828 bytes
Type 27 (FINALIZER_HEAD      ):    168 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):    492 bytes</pre>
<p>This must be some diagnostic information from the <a href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)">GC</a> process kicking in. <strong>12</strong> KB used? Woow&#8230; that&#8217;s 20%. But what&#8217;s the baseline of used memory, e.g. what does a program with an &#8216;empty&#8217; main() use in terms of memory? Sounds like a good subject for another post..</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/" data-text="FEZ Panda II with HD44780 controlled LCD"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F17%2Ffez-panda-ii-with-hd44780-controlled-lcd%2F&amp;title=FEZ%20Panda%20II%20with%20HD44780%20controlled%20LCD" id="wpa2a_2">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/17/fez-panda-ii-with-hd44780-controlled-lcd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>First step: FEZ Panda II with LuxPlug</title>
		<link>http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/</link>
		<comments>http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/#comments</comments>
		<pubDate>Thu, 17 May 2012 10:24:37 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[.NET MF]]></category>
		<category><![CDATA[.NET MF hardware]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=3014</guid>
		<description><![CDATA[Last evening I created my first program for the FEZ Panda II; I attached a JeeLabs LuxPlug to it and just started trying. I found a tutorial on how to do I2C with the .Net MF and used that one as a starting point. It didn&#8217;t take long before I found … <a href="http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6800_3.jpg"><img class="alignleft size-full wp-image-3015" title="FEZ Panda II with LuxPlug" src="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6800_3.jpg" alt="FEZ Panda II with LuxPlug" width="300" height="394" /></a>Last evening I created my first program for the FEZ Panda II; I attached a JeeLabs LuxPlug to it and just started trying.</p>
<p>I found a <a href="http://wiki.tinyclr.com/index.php?title=I2C_-_EEPROM">tutorial</a> on how to do <a href="http://en.wikipedia.org/wiki/I%C2%B2C">I2C</a> with the .Net MF and used that one as a starting point. It didn&#8217;t take long before I found out that for me, in this case, it was easier to rely on the TSL2561 datasheet than to try to use someone else&#8217;s code to create my first C# class for this sensor.</p>
<p>Probably because this first try was an easy one; I guess in the future, when things become more complicated, I&#8217;ll have to take some peeks at how others do certain things. But for now, I&#8217;m pleased with how this first exercise worked out!</p>
<p>The code is not finished yet, but it&#8217;s in a stage where it works and produces the raw data coming from the data registers. Good enough for a post <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Here&#8217;s a small piece (the constructor part) of the class code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> TSL2561<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">byte</span> I2CAddress, <span style="color: #6666cc; font-weight: bold;">int</span> ClockinKHz<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  I2CConfig <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> I2CDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">Configuration</span><span style="color: #008000;">&#40;</span>I2CAddress, ClockinKHz<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  I2C <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> I2CDevice<span style="color: #008000;">&#40;</span>I2CConfig<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// read the ID register.</span>
  var Actions <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> I2CDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">I2CTransaction</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
  <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> rx <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
  Actions<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> I2CDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateWriteTransaction</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> 0x0a <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  Actions<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> I2CDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateReadTransaction</span><span style="color: #008000;">&#40;</span>rx<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>I2C<span style="color: #008000;">.</span><span style="color: #0000FF;">Execute</span><span style="color: #008000;">&#40;</span>Actions, <span style="color: #FF0000;">1000</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Print</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Read ID Register failed&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008080; font-style: italic;">// exit or something</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0600FF; font-weight: bold;">else</span>
  <span style="color: #008000;">&#123;</span>
    Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Print</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;ID value: &quot;</span> <span style="color: #008000;">+</span> rx<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #008080; font-style: italic;">// 4 msb must be 0001 for a TSL2561</span>
  <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>rx<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;</span> 0xf0<span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> 0xa0<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// exit or something</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  setGain<span style="color: #008000;">&#40;</span>0x10<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>   <span style="color: #008080; font-style: italic;">// Mandatory after each Write transaction !!!</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Not that bad if I may say so&#8230;</p>
<p>The sensor is being read every 5 seconds and this produces the following output, where it shows the decimal values of low and high bytes of both ADC channels:</p>
<pre>--------------
Result: 156 1
Result: 69 5
--------------
Result: 160 1
Result: 80 5
--------------
Result: 174 1
Result: 114 5
--------------
Result: 177 1
Result: 119 5
--------------</pre>
<p>Nice! Calculations with these numbers is something that&#8217;s on the to-do list for now, but that should not give any big problems anymore; no, but what I think will be the biggest obstacle to overcome is my knowledge of C#.</p>
<p>For example, I&#8217;m used to displaying numbers in hexadecimal format. So I added a x.ToString(&#8220;X2&#8243;) (where x is a byte) in a Debug.Print(), knowing I&#8217;ve used this before myself in VB.Net and have seen this being used in C# too &#8211; I got no build errors, but I <em>did</em> get an exception&#8230; apparently the .Net Micro Framework doesn&#8217;t support this? I have to press F1 for help too much for my taste.. <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  A matter of learning on the job I guess..</p>
<p>Now let&#8217;s see if I can find that 20&#215;4 LCD for my next &#8216;project&#8217;; and maybe a spare <a href="http://jeelabs.com/products/lcd-plug">LCD Plug</a>, to keep the number of wires acceptable.</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/" data-text="First step: FEZ Panda II with LuxPlug"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F17%2Ffirst-step-fez-panda-ii-with-luxplug%2F&amp;title=First%20step%3A%20FEZ%20Panda%20II%20with%20LuxPlug" id="wpa2a_4">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/17/first-step-fez-panda-ii-with-luxplug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Arduino on steroids and .Net Micro Framework</title>
		<link>http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/</link>
		<comments>http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/#comments</comments>
		<pubDate>Wed, 16 May 2012 09:43:03 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[.NET MF]]></category>
		<category><![CDATA[.NET MF hardware]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=3001</guid>
		<description><![CDATA[Another gadget to tinker with arrived yesterday; a  FEZ Panda II from GHI Electronics. Arduino pin compatible, compatible with most Arduino shields, 72 MHz 32-bit CPU, 512 KB flash, 62 KB RAM for application, Micro SD socket, RTC and more, much more. It&#8217;s a bit bigger though; the length is about … <a href="http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6795_3.jpg"><img class="alignleft size-full wp-image-3002" title="FEZ Panda II compared to Duemilanove" src="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6795_3.jpg" alt="FEZ Panda II compared to Duemilanove" width="300" height="317" /></a></p>
<p>Another gadget to tinker with arrived yesterday; a  <a href="https://www.ghielectronics.com/catalog/product/256/">FEZ Panda II</a> from GHI Electronics. Arduino pin compatible, compatible with most Arduino shields, 72 MHz 32-bit CPU, 512 KB flash, 62 KB RAM for application, Micro SD socket, RTC and more, much more.</p>
<p>It&#8217;s a bit bigger though; the length is about  10 mm more than the <a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove">Duemilanove</a>.</p>
<p>The FEZ Panda II runs on the <a href="http://www.microsoft.com/en-us/netmf/default.aspx">.NET Micro Framework</a> and you can program (and even debug) the Panda with Microsoft Visual C# Express (<a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express">free</a>). Deployment to the Panda is done from within the Visual Studio IDE, and setting breakpoints, stepping and adding watches all (seem to) work. I got a &#8216;blinking LED&#8217; example up and running in no-time &#8211; downloading and installing the <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=cff5a7b7-c21c-4127-ac65-5516384da3a0">.NET Micro Framework 4.1</a> and the <a href="http://www.ghielectronics.com/downloads/NETMF/GHI%20NETMF%20v4.1%20and%20.NET%20Gadgeteer%20Package.zip">GHI NETMF 4.1</a> cost me more time than getting the LED to blink; so far this looks OK.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.SPOT</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.SPOT.Hardware</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">GHIElectronics.NETMF.Hardware</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">GHIElectronics.NETMF.FEZ</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> MFConsoleApplication1
<span style="color: #008000;">&#123;</span>
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Program
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      OutputPort LED<span style="color: #008000;">;</span>
      LED <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> OutputPort<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>Cpu<span style="color: #008000;">.</span><span style="color: #0000FF;">Pin</span><span style="color: #008000;">&#41;</span>FEZ_Pin<span style="color: #008000;">.</span><span style="color: #0000FF;">Digital</span><span style="color: #008000;">.</span><span style="color: #0000FF;">LED</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
          LED<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
          Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">20</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
          LED<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
          Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">2000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Why did I buy this FEZ Panda II? Well, for the fun of it ofcourse! And second, I wanna know more about these kind of devices and check some of the statements made.</p>
<p>For instance, the statement that the Panda is compatible with most Arduino shields intrigues me; to what extent is this true? &#8220;The shield fits in the headers&#8221; is not enough ofcourse; most shields come with a library to support the hardware that&#8217;s on the shield, but those libraries are for the Arduino platform, so how easy is it to plug in a Arduino shield and get it  really <em>working</em>? Can, and if so, how hard is it to port Arduino code to this C# environment?</p>
<p>Another thing is: how does the .NET runtime influence time critical I/O, where output pins have to be switched very fast? How does this Panda perform, knowing there&#8217;s an additional layer (the <a href="http://en.wikipedia.org/wiki/Common_Language_Runtime">CLR</a>, Common Language Runtime) between the C# code and the bare hardware?</p>
<p>And how about memory usage? 62 KB user memory may sound like a lot compared to the Arduinos 2 KB. OTOH, when I compare my VB.Net touchscreen application to my Delphi Domotica system, the memory usage of the first one is <em>huge</em> compared to the 1.3 MB my Domotica system uses. So what will using a .Net environment do in this particular case? Will adding a few hardware drivers to a C# program quickly make the available memory vanish, or what?</p>
<p>And I&#8217;m also interested in how <em>I</em> will perform with C#; I hope that seeing/writing code in all kinds of programming languages from the early 80&#8242;s will help me to get started <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Questions, questions&#8230; which I hope to be able to answer in the next weeks; I was getting bored with watching that blinking LED on the Panda II, so I decided my first &#8220;Panda project&#8221; will be an I2C exercise with a <a href="http://jeelabs.com/products/lux-plug">JeeLabs Lux Plug</a> to see how hard (or easy) it is to talk I2C with this sensor. And if all goes well, next thing will be to write some text on a spare 20&#215;4 LCD I have one laying around. Those sound like some good beginner projects, right?</p>
<p>And if both succeed, the <a href="http://www.seeedstudio.com/depot/28-tft-touch-shield-p-864.html?cPath=132_134">2.8&#8243; TFT LCD Touchscreen</a> I bought recently, will be next.</p>
<p>That&#8217;s it for now; new challenges are waiting!</p>
<p>&nbsp;</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/" data-text="Arduino on steroids and .Net Micro Framework"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F16%2Farduino-on-steroids-and-net-micro-framework%2F&amp;title=Arduino%20on%20steroids%20and%20.Net%20Micro%20Framework" id="wpa2a_6">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/16/arduino-on-steroids-and-net-micro-framework/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Arduino with TFT Touch Shield</title>
		<link>http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/</link>
		<comments>http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/#comments</comments>
		<pubDate>Thu, 10 May 2012 21:22:03 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[TFT Touch]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2987</guid>
		<description><![CDATA[After the TFT Touch Shield I ordered had arrived and some playing around with the examples that were part of the library that can be found here, it was time to do some testing. For starters I made a small sketch with just a string, 3 &#8216;touchable&#8217; areas and an … <a href="http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6788s.jpg"><img class="alignleft size-full wp-image-2988" title="TFT Touch Shield" src="http://blog.hekkers.net/wp-content/uploads/2012/05/DSC_6788s.jpg" alt="TFT Touch Shield" width="300" height="357" /></a>After the TFT Touch Shield <a href="http://www.seeedstudio.com/depot/28-tft-touch-shield-p-864.html?cPath=132_134" target="_blank">I ordered</a> had arrived and some playing around with the examples that were part of the library that can be found <a href="http://seeedstudio.com/wiki/2.8''_TFT_Touch_Shield" target="_blank">here</a>, it was time to do some testing.</p>
<p>For starters I made a small sketch with just a string, 3 &#8216;touchable&#8217; areas and an icon. The first challenge was making the <em>drawLine()</em> function from the library working; somehow it had problems with drawing the left side of the roof of the &#8216;home&#8217; icon. No clue why, but it just didn&#8217;t work. Only after I changed the parameter types from <em>unsigned int</em> to <em>int</em> and replaced the algorithm with the simplified version of the <a href="http://en.wikipedia.org/wiki/Bresenham's_line_algorithm" target="_blank">Bresenham line algorithm</a> the home was correctly drawn.</p>
<p>Next thing I did was printing some touch related information to the Serial and this is what I saw:</p>
<pre>X = 611, Y = 442, P = 575
X = 609, Y = 443, P = 536
X = 606, Y = 444, P = 507
X = 599, Y = 447, P = 457
X = 599, Y = 447, P = 449
X = 600, Y = 440, P = 486
X = 601, Y = 434, P = 522
X = 642, Y = 604, P = 470
X = 634, Y = 609, P = 468</pre>
<p>Well, so far so good&#8230; on to the next phase!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/" data-text="Arduino with TFT Touch Shield"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F10%2Farduino-with-tft-touch-shield%2F&amp;title=Arduino%20with%20TFT%20Touch%20Shield" id="wpa2a_8">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/10/arduino-with-tft-touch-shield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IR trouble with the Pace DCR7111 (UPC mediabox)</title>
		<link>http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/</link>
		<comments>http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/#comments</comments>
		<pubDate>Sat, 05 May 2012 23:03:30 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[IRTrans]]></category>
		<category><![CDATA[Pronto]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2976</guid>
		<description><![CDATA[This week we got a new UPC Mediabox; the old Thomson DCI52UPC02 was replaced by a Pace DCR7111(/03). The Thomson was constantly updating itself, went into reboot-loops where only disconnecting power sometimes helped to get it going again. After I finally managed to get in touch with UPC support, 2 … <a href="http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>This week we got a new <a href="http://www.upc.nl" target="_blank">UPC</a> Mediabox; the old Thomson DCI52UPC02 was replaced by a Pace DCR7111(/03). The Thomson was constantly updating itself, went into reboot-loops where only disconnecting power sometimes helped to get it going again. After I finally managed to get in touch with UPC support, 2 days later the new box arrived.</p>
<p>My biggest concern was whether this new Pace box would still work my Pronto/IRTrans combo; would it accept the same Infrared (IR) codes as the Thomson? A quick test revealed that the old Thomson remote could be used to control the new Pace, so at that point I didn&#8217;t expect any problems.</p>
<p>Later that evening, when I used the Pronto to control the Pace mediabox, I discovered that the &#8220;CH+&#8221; and &#8220;CH-&#8221; buttons of the Pronto didn&#8217;t work anymore. To be precise: the first &#8220;CH+&#8221; did work, but the second time it didn&#8217;t&#8230;huh? The &#8220;CH-&#8221; had the same wierd behavior.. first push OK, the second was ignored; and the 3rd, 4th&#8230; So selecting a channel with a digit (0..9) <em>did</em> work as before, but zapping through all the channels didn&#8217;t? What the &#8230;.?</p>
<p>Hmm, time for some investigation. First thing I did was trying to find the Pronto CCF codes for this new model, but that didn&#8217;t help. Later I found out that this Pace uses the same IR codes as a Philips DCR-8111 but I couldn&#8217;t find any IR codes for that model either.</p>
<p>Well, back to the original symptom then &#8211; why do the CH-buttons only work once? After some time I found the cause in a post on the <a href="http://www.l5remote.com/forum/index.php" target="_blank">L5 remote forum</a>:</p>
<blockquote><p>Parity &amp; Toggle Bits<br />
A somewhat common problem is when a device (such as a cable box) will accept a learned code once but not twice in a row. For instance, you can enter the channel &#8220;1 &#8211; 2&#8243;, but not &#8220;3 &#8211; 3&#8243;. This is not a fault with your new remote, but rather a very hard to work with design employed by your equipment.<br />
What happens is your original remote tacks on a &#8220;parity bit&#8221; (sometimes called a &#8220;toggle bit&#8221;) to the end of each code. So, the first time it sends the code it follows up with a &#8220;0&#8243;. The next time it ends with &#8220;1&#8243;. The problem is that a learning remote can only learn or send the signal one way – the way it learned it. Your equipment, unfortunately, will not accept the code again unless it ends with a new parity bit or you send a different code to clear the memory buffer.</p>
<p>The most common example of equipment that uses this system is anything that employs the Philips RC5 or RC6 code format &#8211; such as Philips or Marantz products, or even Microsoft Media Center Edition remote controls. As the RC5 and RC6 implementation guidelines make parity bit checking optional, not all RC5/RC6 devices will respond the same way to non-alternating learned codes. Some may require parity bits at all times, some may only require it for certain commands (such as &#8220;power&#8221;), some may use the parity bit only for closely repeated commands (meaning you could send &#8220;3-3-3&#8243; quickly with the original remote but only slower using a learned code), while some ignore parity bits completely and show no noticable operational difference with or without.</p>
<p>The Philips Pronto is the only remote that I am aware of that can learn codes with alternating parity bits in the method required for several (not all) brands of equipment. If you have one that is not yet covered you can try tacking on a &#8220;do-nothing&#8221; code after each real one. So, your button for &#8220;3&#8243; would send the &#8220;3&#8243; code followed by another code to clear the buffer. What can that code be? Anything that the equipment senses as a real code but doesn’t affect operation. It may be next to impossible to find such a code.</p></blockquote>
<p>Great, this sounds exactly as what I&#8217;m experiencing. Parity (toggle) bits&#8230; and the new Pace doesn&#8217;t ignore them!</p>
<p>Now that I know what is causing my problem and how it works, I should be able to create a workaround; I can stop searching for the correct IR codes for the CH+/CH- buttons, because a single IR code for a CH button will never work. Instead, I will need to get hold of both IR code &#8216;versions&#8217; for a single CH button and make sure my system will automatically alternate between those 2 versions.</p>
<p>How do I get those 2 codes for a single button? Well,  PEP1 (Pronto Edit Professional v1) and a Pronto Remote (a TSU9600 in my case) enables you to learn a IR code. So that&#8217;s what I did; I learned  a couple of CH+ IR codes, copied the resulting CCF codes to a text editor and searched for differences; and found the 2 different versions for CH+:</p>
<pre>[up1][CCF]
0000 0072 0024 0000 000F 000A 0006 000A 0006 0016 0006 000A 0006 000A 0006
001C 0006 000A 0006 000A 0006 000A 0006 <span style="color: #ff0000;">0016</span> 0006 0016 0006 0010 0006 0016
0006 000A 0006 0016 0006 000A 0006 000A 0006 0CB7 000F 000A 0006 000A 0006
0016 0006 000A 0006 000A 0006 001C 0006 000A 0006 000A 0006 000A 0006 <span style="color: #ff0000;">0016</span>
0006 0016 0006 0010 0006 0016 0006 000A 0006 0016 0006 000A 0006 000A 0006
BEA1

[up2][CCF]
0000 0072 0024 0000 000F 000A 0006 000A 0006 0016 0006 000A 0006 000A 0006
001C 0006 000A 0006 000A 0006 000A 0006 000A 0006 0016 0006 0010 0006 0016
0006 000A 0006 0016 0006 000A 0006 000A 0006 0CB7 000F 000A 0006 000A 0006
0016 0006 000A 0006 000A 0006 001C 0006 000A 0006 000A 0006 000A 0006 000A
0006 0016 0006 0010 0006 0016 0006 000A 0006 0016 0006 000A 0006 000A 0006
BEA1</pre>
<p>There&#8217;s definitely a difference between those 2 codes, marked in <span style="color: #ff0000;">red</span>; so far things are looking good. Now it&#8217;s time to test these 2 codes by sending a up1, up2, up1, up2 IR sequence to the Pace mediabox. Yep; the channel increased 4 times &#8211; it worked!</p>
<p>The rest is simple. My system uses the <a href="http://www.irtrans.de/download/Docs/IRTrans%20TCP%20ASCII%20Interface_EN.pdf" target="_blank">IRTRans ASCII interface protocol</a> for sending IR with the IRTrans LAN module. The IR commands that can be used are not predefined in my Domotica system however; they are retrieved from the <a href="http://www.irtrans.de/en/" target="_blank">IRTrans</a> by using the <em>Agetremotes</em> and<em> Agetcommands</em> commands. So all I have to do is &#8216;tag&#8217; the 2 &#8216;up&#8217; commands in a way that my system can figure out that there are 2 commands for &#8216;up&#8217;. For example, I could name them [up#1] and [up#2] and let the system pick the right &#8216;up&#8217; version and send the right &#8216;up&#8217; command (up#1, up#2) to the IRTrans with the <em>Asnd</em> command whenever a UI sends a &#8216;up&#8217; request..</p>
<p>No need to change anything at UI level and 10 lines of code should suffice. Problem solved!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/" data-text="IR trouble with the Pace DCR7111 (UPC mediabox)"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F06%2Fir-trouble-with-the-pace-dcr7111-upc-mediabox%2F&amp;title=IR%20trouble%20with%20the%20Pace%20DCR7111%20%28UPC%20mediabox%29" id="wpa2a_10">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/06/ir-trouble-with-the-pace-dcr7111-upc-mediabox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extra user interfaces</title>
		<link>http://blog.hekkers.net/2012/05/04/extra-user-interfaces/</link>
		<comments>http://blog.hekkers.net/2012/05/04/extra-user-interfaces/#comments</comments>
		<pubDate>Fri, 04 May 2012 21:18:21 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[GUI]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2959</guid>
		<description><![CDATA[I&#8217;ve been looking for an easy way to add some extra user interfaces to my Domotica system, particularly for upstairs. Now that we have a bunch of Radiator Thermostats and Roller shutters both up- and downstairs, the wish for some extra User Interfaces (bedrooms, office etcetera) increased the last couple … <a href="http://blog.hekkers.net/2012/05/04/extra-user-interfaces/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for an easy way to add some extra user interfaces to my Domotica system, particularly for upstairs. Now that we have a bunch of <a href="http://blog.hekkers.net/2011/09/01/elv-max-first-impression/">Radiator Thermostats</a> and <a href="http://blog.hekkers.net/tag/somfy/">Roller shutters</a> both up- and downstairs, the wish for some extra User Interfaces (bedrooms, office etcetera) increased the last couple of weeks. Yes, the Radiator Thermostats can also be operated manually, but that&#8217;s not always that convenient; I want something more flexible and versatile.</p>
<p>Should I buy a tablet and put it on the wall? Neh, too pricy and therefore not expandable enough &#8211; we would be bankrupt before I could finish this project <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>Or is it better to create a User Interface for the smartphones? Useless for this particular &#8216;problem&#8217;, cause we all have the habit of leaving our smartphones downstairs &#8211; no one has the urge to Tweet or call while in bed (yet&#8230;). Besides that, guests in our house should also be able to lower a roller shutter without too much hassle.</p>
<p>What I&#8217;d like to have is something small &amp; simple, touch-driven, communicating wirelessly, with an easily adjustable User Interface without having to change the code too often and, if possible, suitable to take in your hands.</p>
<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/05/TFT_Touch.png"><img class="alignleft size-full wp-image-2963" title="TFT_Touch" src="http://blog.hekkers.net/wp-content/uploads/2012/05/TFT_Touch.png" alt="" width="300" height="200" /></a>For that I bought this <a href="http://www.seeedstudio.com/depot/28-tft-touch-shield-p-864.html?cPath=132_134" target="_blank">Touch Shield</a> to tinker with during the next weeks. There are some nice <a href="http://www.youtube.com/watch?v=7yzwKZgNqBg" target="_blank">videos</a> that demonstrate what you can do with these Touch shields and they look well enough to give it a try. This particular shield can be used with the <a href="https://github.com/adafruit/Touch-Screen-Library" target="_blank">Adafruit library</a>, which takes care of the low level stuff and provides functions for stuff like drawing lines, circles, rectangles and text on the screen &#8211; with an SD card it should even be possible to draw 24-bit <a href="http://en.wikipedia.org/wiki/BMP_file_format" target="_blank">BMP</a> files &#8211; well, let that be be step 2 for now.</p>
<p>While this Touch Shield is on its way, I started thinking of how to make this Touch Shield cooperate with my Domotica system. As I said, I don&#8217;t want to change the sketch when I want to add another menu option or button or anything else that comes to my mind; the &#8216;definition&#8217; of the screens, menus, buttons should not be defined in the sketch, but somewhere else. Preferably somewhere on the network in a file; another good option could be stored on a SD card.</p>
<p>This file should contain <em>everything</em> that can be regarded as being subject to change when multiple Touch Shields are going to be used throughout the house: menu options, shapes, buttons, colors, text, actions; so the basic idea is: 1 sketch which can handle multiple User Interface definitions, designed for a specific location/room. So I definitely need some sort of <a href="http://en.wikipedia.org/wiki/User_interface_markup_language" target="_blank">User Interface Markup</a> language for that, like <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language" target="_blank">XAML</a> is.  But the markup language to be used should also be really ultra-light-weight, cause we&#8217;re still dealing with an Arduino here, where RAM is limited and every bit of overhead leads to problems, very quickly. I mean, you could define a button like this:</p>
<pre>&lt;Button Background="Red" Foreground="Green" Content="Light on" Action="C02 ON"/&gt;</pre>
<p>but that will consume more memory than</p>
<pre>B;BRED;FGREEN;TLight On;AC02 ON</pre>
<p>So maybe I&#8217;ll create my own Markup &#8216;language&#8217;; we&#8217;ll see.</p>
<p>The way in which an action will be communicated with my Domotica system will be something comparable to how our <a href="http://blog.hekkers.net/2011/07/26/ethernet-doorbell/">Ethernet Doorbell</a> communicates with the system; for example, when the touch of a button should result in a light going on or off, I can just let the Arduino send a string (the Action property in the examples above) to my system and it will take care of the rest.</p>
<p>Big plans, which also bring a lot of new challenges &#8211; and I&#8217;m sure, a lot of fun!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/05/04/extra-user-interfaces/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/05/04/extra-user-interfaces/" data-text="Extra user interfaces"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/05/04/extra-user-interfaces/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F05%2F04%2Fextra-user-interfaces%2F&amp;title=Extra%20user%20interfaces" id="wpa2a_12">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/05/04/extra-user-interfaces/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Today the color is&#8230;</title>
		<link>http://blog.hekkers.net/2012/04/30/today-the-color-is/</link>
		<comments>http://blog.hekkers.net/2012/04/30/today-the-color-is/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 20:29:36 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[DMX]]></category>
		<category><![CDATA[LED]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2943</guid>
		<description><![CDATA[Orange!! &#160; Well, it could just as well have been any other color of the 256*256*256 colors these RGB LEDs can produce, but since today is Koninginnedag, Orange was the most appropriate color I could think of for today. The last 2 days I started with putting these RGB LEDs … <a href="http://blog.hekkers.net/2012/04/30/today-the-color-is/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Orange!! <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6779_6.jpg"><img class="aligncenter size-full wp-image-2952" title="Queen's day color" src="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6779_6.jpg" alt="" width="600" height="399" /></a></p>
<p>&nbsp;</p>
<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6767.jpg"><img class="alignleft size-full wp-image-2945" title="DSC_6767" src="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6767.jpg" alt="" width="300" height="381" /></a></p>
<p>Well, it could just as well have been any other color of the 256*256*256 colors these RGB LEDs can produce, but since today is <a href="http://en.wikipedia.org/wiki/Koninginnedag" target="_blank">Koninginnedag</a>, Orange was the most appropriate color I could think of for today.</p>
<p>The last 2 days I started with putting these RGB LEDs in the ground, under the gazebo.</p>
<p>Removing the stones to get the 20 meters of cable under the terrace, grit around the poles and putting everything back in place took me 2 days and I&#8217;m still not completely done yet; I think I need another afternoon for the &#8216;finishing touch&#8217;.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Just for fun I made a small beginning with controlling these LEDs from my system by using scenarios or lighting sequences; here&#8217;s what the &#8220;random&#8221; color scenario looks like:</p>
<p><iframe width="750" height="422" src="http://www.youtube.com/embed/f_H0MGOJHsM?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>&nbsp;</p>
<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/04/ab600r.jpg"><img class="alignright size-full wp-image-2944" title="ab600r" src="http://blog.hekkers.net/wp-content/uploads/2012/04/ab600r.jpg" alt="" width="140" height="180" /></a></p>
<p>I&#8217;m also going to use a remote for these RGB LEDs; I still have an old 433 MHz remote with 8 buttons that can be re-used to select the different scenarios. This remote will be attached to one of the poles of the gazebo so we won&#8217;t need to go inside to change the lighting.</p>
<p>With the Arduino acting as web-interface to the hardware, my domotica system and this remote I think we can really enjoy these RGB LEDs during those many upcoming long, hot summer nights!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/04/30/today-the-color-is/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/04/30/today-the-color-is/" data-text="Today the color is&#8230;"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/04/30/today-the-color-is/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F04%2F30%2Ftoday-the-color-is%2F&amp;title=Today%20the%20color%20is%E2%80%A6" id="wpa2a_14">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/04/30/today-the-color-is/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Broken cables and Ethernet Shield trouble</title>
		<link>http://blog.hekkers.net/2012/04/23/2933/</link>
		<comments>http://blog.hekkers.net/2012/04/23/2933/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 21:10:13 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[DMX]]></category>
		<category><![CDATA[LED]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2933</guid>
		<description><![CDATA[It&#8217;s time for some work outside.. Last summer the play set  in our garden with slide and swings was hardly used, so I guess the kids won&#8217;t miss it. The swimming pool has to be filled with water again, the pump has to be put back in its place, the … <a href="http://blog.hekkers.net/2012/04/23/2933/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s time for some work outside.. Last summer the play set  in our garden with slide and swings was hardly used, so I guess the kids won&#8217;t miss it. The swimming pool has to be filled with water again, the pump has to be put back in its place, the terrace needs some adjustments and of course, the <a href="http://blog.hekkers.net/2011/09/03/success-and-failure/">gazebo RGB LED project</a> needs attention cause the crate with the 6 RGB LEDs, DMX decoder &amp; Arduino has been standing in the office since the end of last summer, so it&#8217;s time to finally complete this and get those 6 RGB LEDs where they belong &#8211; in the garden. I started with the last job <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>The first thing I did was completing the indoor part of it all, e.g. putting the adapter, DMX decoder, Arduino with 2 shields (DMX &amp; Ethernet) in a enclosure. This whole setup has already been tested with something I developed <a href="http://blog.hekkers.net/2011/08/20/arduino-dmx-encoder-on-the-test-bench/">last summer</a>. It had a Colorwheel control with which it was very easy to pick a color and control the RBG LEDs. But this is not enough; I still needed to integrate those RGB LEDs into my Domotica system. By doing that, my system is now in full control over the RGB LEDs and they can be controlled based on events, from the GUI (touchscreen) in the living room etcetera. This integration involved creating a Device Class for the RGB LEDs and a suitable interface to &#8216;talk&#8217; to the hardware.</p>
<p>But not all things went as smooth as I had hoped. First, a power adapter cable was broken, which made the whole setup stop working every few minutes or so. It cost me half the afternoon to find out it was just a piece of cable that was bugging me&#8230;</p>
<p>I also applied the &#8216;Ethernet-shield-powered-from-the-adapter-plug&#8217; fix I wrote about <a href="http://blog.hekkers.net/2011/09/03/success-and-failure/">before</a>, but it didn&#8217;t help enough. Sure, 4 out of 5 times it worked, but not always. And that&#8217;s not good enough, so I searched for another solution and I found one <a href="http://arduino.cc/forum/index.php/topic,28175.msg208423.html#msg208423" target="_blank">here</a>, and this one worked <em>always</em> &#8211; well, successfully powering up 30 times in a row convinced me that this works well enough. So now there&#8217;s a wire going from the RESET pin to pin 4 (the Ethernet shield is underneath the DMX shield).</p>
<p><a href="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6733_6.jpg"><img class="aligncenter size-full wp-image-2934" title="Ethernet Shield fix" src="http://blog.hekkers.net/wp-content/uploads/2012/04/DSC_6733_6.jpg" alt="Ethernet Shield fix" width="600" height="399" /></a></p>
<p>The code that comes with it is simple but very effective:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span> init_ethernet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 pinMode<span style="color: #009900;">&#40;</span>DO_RESET_ETH_SHIELD<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// sets the digital pin as output</span>
 digitalWrite<span style="color: #009900;">&#40;</span>DO_RESET_ETH_SHIELD<span style="color: #339933;">,</span> LOW<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: #666666; font-style: italic;">//for ethernet chip to reset</span>
 digitalWrite<span style="color: #009900;">&#40;</span>DO_RESET_ETH_SHIELD<span style="color: #339933;">,</span> HIGH<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: #666666; font-style: italic;">//for ethernet chip to reset</span>
 pinMode<span style="color: #009900;">&#40;</span>DO_RESET_ETH_SHIELD<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// sets the digital pin input</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: #666666; font-style: italic;">//for ethernet chip to reset</span>
 Ethernet.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span>mac<span style="color: #339933;">,</span>ip<span style="color: #339933;">,</span>gateway<span style="color: #339933;">,</span>subnet<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: #666666; font-style: italic;">//for ethernet chip to reset</span>
 Ethernet.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span>mac<span style="color: #339933;">,</span>ip<span style="color: #339933;">,</span>gateway<span style="color: #339933;">,</span>subnet<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: #666666; font-style: italic;">//for ethernet chip to reset</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Calling the init_ethernet() function from the setup() is all that&#8217;s needed to get a fully functional Ethernet Shield. Finally this RGB LED project is finished; well, I still have to dig 6 holes and get the RGB cable under the terrace &#8211; after that, summer can begin!</p>
<p>&nbsp;</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/04/23/2933/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/04/23/2933/" data-text="Broken cables and Ethernet Shield trouble"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/04/23/2933/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F04%2F23%2F2933%2F&amp;title=Broken%20cables%20and%20Ethernet%20Shield%20trouble" id="wpa2a_16">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/04/23/2933/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Killing adapters does save energy?</title>
		<link>http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/</link>
		<comments>http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 22:14:30 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2927</guid>
		<description><![CDATA[Although I still had to remove 2 DC adapters (of 11), today I saw that the power usage between 04:00 and 05:00 was 258W. I hadn&#8217;t seen such a low usage for quite some time, so I did some research by querying the hourly power usage data I have been … <a href="http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Although I still had to remove 2 DC adapters (of 11), today I saw that the power usage between 04:00 and 05:00 was 258W. I hadn&#8217;t seen such a low usage for quite some time, so I did some research by querying the hourly power usage data I have been collecting since 2008. How many times did I have a power usage &lt;= 258W during all those years? Here&#8217;s the result:</p>
<pre>Year    Number of times &lt;= 258W</pre>
<pre>2008    15
2009    75
2010    60
2011    0
2012    1</pre>
<p>I expected this trend, cause 2008 has been the year where I ditched 3 (or was it 4) older PC&#8217;s which were on 24/7 by virtualization and also took some other measures to reduce power consumption. 2009 was the year in which we benefited the most from this power reduction but since then, I guess it&#8217;s the ever increasing amount of power consuming hardware that made the base power usage (as in during the night, where as much hardware as possible is turned off) increase through the years. The power usage <a href="http://www.hekkers.net/domotica/PowerUsageCharts2.aspx">drill-down charts</a> I made in the past confirm all this.</p>
<p>I checked when the last time was when we had a nightly power usage below 258W and it was <strong>16-03-2010!</strong> More than 2 years ago&#8230; this is no coincidence, and I can think of only 1 thing that can be responsible for matching those 258W last night, after a very long time: <a href="http://blog.hekkers.net/2012/04/02/adapter-reduction/">reducing the number of adapters</a>.</p>
<p>What else could it be?</p>
<pre></pre>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/" data-text="Killing adapters does save energy?"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F04%2F09%2Fkilling-adapters-does-save-energy%2F&amp;title=Killing%20adapters%20does%20save%20energy%3F" id="wpa2a_18">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/04/09/killing-adapters-does-save-energy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Kinect: skeletons and thoughts</title>
		<link>http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/</link>
		<comments>http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 20:09:46 +0000</pubDate>
		<dc:creator>Robert Hekkers</dc:creator>
				<category><![CDATA[Domotica]]></category>
		<category><![CDATA[Kinect]]></category>
		<category><![CDATA[Kinect SDK]]></category>

		<guid isPermaLink="false">http://blog.hekkers.net/?p=2910</guid>
		<description><![CDATA[This is fun! Today I created a C# application to view skeletons on my PC monitor. Below is the result (available in HD res): I&#8217;m just doing some silly moves in front of the camera like lifting my arms etcetera, so nothing spectacular there; it&#8217;s the skeleton being displayed on … <a href="http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>This is fun! Today I created a C# application to view <a href="http://msdn.microsoft.com/en-us/library/microsoft.kinect.skeleton.aspx" target="_blank">skeletons</a> on my PC monitor. Below is the result (available in HD res):</p>
<p><iframe width="750" height="422" src="http://www.youtube.com/embed/YmHl7ZcBlyU?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>I&#8217;m just doing some silly moves in front of the camera like lifting my arms etcetera, so nothing spectacular there; it&#8217;s the skeleton being displayed on the monitor what&#8217;s spectacular, and fun!</p>
<p>Every time I did some tests, the kids came running from the livingroom and started jumping, waving their arms and doing all kinds of crazy stuff <img src='http://blog.hekkers.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>At the end of the video, where I walk back towards my keyboard and the distance to the Kinect reduces to 50 cm or so, you can see that the Kinect is getting a hard time tracking all the joints; it becomes a big mess. But that&#8217;s okay.</p>
<p>After tinkering with the Kinect and the <a href="http://www.microsoft.com/en-us/kinectforwindows/develop/" target="_blank">Kinect SDK</a> for 8 hours or so, my first impression is better than I expected, acually. The way speech is being recognized, how well a skeleton is being tracked is better then I had expected. Ready for use! Is it, or&#8230;?</p>
<p>My goal is to use the Kinect for speech and gesture recognition; for that I want to develop a small, <em>lean and mean</em> app that does just that and that can interface with my Domotica system in some way. Either by adding a TCP server to the app, or by uploading information with XMLRPC, or whatever &#8211; haven&#8217;t really thought about that yet. But I also need an application to &#8216;record&#8217; gestures and an easy way to define new speech commands this app should recognize; and not just &#8220;light on&#8221;, but also commands with variables in them, like &#8220;we will be back at 16:00&#8243;. My system can handle this kind of &#8216;dynamic events&#8217;, so the Kinect should too, right?</p>
<p>But some other things give me second thoughts about the usability of the Kinect.</p>
<p>First, while I was capturing this video, the CPU usage on my Intel E8200 Core 2 Duo (2.66 GHz) Windows 7 Ultimate PC with 8GB RAM was around 50-60%; that&#8217;s rather high. Well, I guess most of the CPU cycles were consumed by displaying the skeleton on the screen (which is something I won&#8217;t need in the end), but I really need to know what the remainder of the current 50-70% will be when I strip this app to what it is supposed to do: simply recognizing gestures and speech without UI. Cause I&#8217;m not that fond of spending that much processing power (and the power consumption that comes with it) on this.</p>
<p>Second, the SDK is limited to Windows 7 (and above, I guess). That&#8217;s too bad; now that I think of it; wouldn&#8217;t I be better off with something more versatile, platform independent? Wouldn&#8217;t it be ideal to connect a Kinect to some local, low-power processor unit (Raspberry Pi, xyz Plug, etc) and let that device take care of the processing and only communicate &#8220;the stuff that matters&#8221; to the central system? Hmm, maybe I should have a look at some alternatives as well.</p>
<p>Third, the Kinect uses USB to connect to the PC. What if I want to use more than 1 Kinect, say 2 or 3, throughout the house? How do I fix that, USB and max 5 meters of cable length?</p>
<p>So although I&#8217;m impressed by the Kinect, there&#8217;s still a huge pile of things to do, discover, explore and.. decide!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="none" data-url="http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/" data-text="More Kinect: skeletons and thoughts"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hekkers.net%2F2012%2F04%2F08%2Fmore-kinect-skeletons-and-thoughts%2F&amp;title=More%20Kinect%3A%20skeletons%20and%20thoughts" id="wpa2a_20">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hekkers.net/2012/04/08/more-kinect-skeletons-and-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

