<?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>Maartendamen&#039;s blog</title>
	<atom:link href="http://www.maartendamen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maartendamen.com</link>
	<description>Blogging on various IT subjects</description>
	<lastBuildDate>Sat, 04 Sep 2010 20:37:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Monitor an Oracle database with a SCOM OleDB watcher</title>
		<link>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/</link>
		<comments>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 20:37:13 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCOM]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=364</guid>
		<description><![CDATA[In this blog post I will explain how to use an System Center Operations Manager OleDB watcher to monitor an Oracle database.
This can be useful to monitor a mission critical application on database availability. It&#8217;s also a cheap solution to just monitor the connection state of an Oracle database, rather then installing an (expensive) third [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog post I will explain how to use an System Center Operations Manager OleDB watcher to monitor an Oracle database.<br />
This can be useful to monitor a mission critical application on database availability. It&#8217;s also a cheap solution to just monitor the connection state of an Oracle database, rather then installing an (expensive) third party Oracle management pack. Off course these packs have a lot more monitors then the connection state, but that might not always be an requirement.<br />
To get this done, the following steps must be taken:<br />
<span id="more-364"></span></p>
<ul>
<li>Install Oracle client OleDB provider on the watcher node</li>
<li>Test the Oracle client OleDB provider, and connection to the database</li>
<li>Add OleDB monitoring in SCOM</li>
<li>Add associated runas user profiles</li>
</ul>
<p><strong>Installing the Oracle client OleDB provider on the watcher node</strong></p>
<p>The watcher node can be any machine containing the SCOM agent.<br />
It&#8217;s important to have the right Oracle client version (I used version 11), for 32bit versions use the 32bit Oracle client. For 64bit use the 64bit Oracle client version. Both are available on the Oracle website. If you don&#8217;t use the correct version (e.g. 32bit on 64bit) you might get &#8220;Class unknown&#8221; errors within SCOM.<br />
Start the Oracle installation, on the first step in the installation wizard choose &#8220;Custom&#8221; and click &#8220;Next&#8221;</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb1-300x225.png" alt="" title="oracle_oledb1" width="300" height="225" class="alignnone size-medium wp-image-365" /></a></p>
<p>On the next page select your favorite language(s), then pick a location for the Oracle client (beware it&#8217;s huge, even for one component)<br />
In the &#8220;Available Product Components&#8221; step select the following component (Oracle Provider for OLEDB: </p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb2-300x225.png" alt="" title="oracle_oledb2" width="300" height="225" class="alignnone size-medium wp-image-366" /></a></p>
<p>Finish the installation.</p>
<p><em>Note:you also need to setup Oracle&#8217;s tnsnames file, this is beyond the scope of this article. Consult your Oracle DBA.</em></p>
<p><strong>Test the Oracle client OleDB provider, and connection to the database</strong></p>
<p>To test a OleDB connection, you can use a UDL file. This is a connection file, which launches a wizard once you click it.<br />
Use the following steps to create an UDL file:</p>
<p>1. Make sure in Windows Explorer, Tools->Folder Options, View Tab, that “Hide file extensions for known file types” is not checked.<br />
2. Right click on Windows desktop, and select New->Text File.<br />
3. Name the file “Test.udl”. The icon for the file should now be the special “UDL” icon.<br />
4. Double click the file to open the Data Links dialog.<br />
5. Click on the “Provider” tab. Select “Oracle Provider for OLE DB”.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb3.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb3.png" alt="" title="oracle_oledb3" width="368" height="461" class="alignnone size-full wp-image-367" /></a></p>
<p>6. Click on the “Connection” tab. In the first dialog box (server name) type the oracle service ID (the name defined in the tnsnames file)<br />
7. Specify the credentials (username and password) in the same dialog box.<br />
8. Click &#8220;Test Connection&#8221;, you should now see this embracing message :-)</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb4.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb4.png" alt="" title="oracle_oledb4" width="232" height="144" class="alignnone size-full wp-image-369" /></a></p>
<p><strong>Add OleDB monitoring in SCOM</strong></p>
<p>The next step is to add monitoring to SCOM. Start the SCOM operations manager console and click on &#8220;Authoring&#8221;.<br />
Within this view, click on &#8220;Add Monitoring Wizard&#8221; on the left hand side.<br />
To add an OleDB watcher, use the following steps:</p>
<p>1. In the &#8220;Select Monitoring Type&#8221; step select &#8220;OLE DB Data Source&#8221;, click &#8220;Next&#8221;<br />
2. Within the general properties step specify a name for the monitor and choose a Management Pack for your custom monitoring (Microsoft recommends not to use the default management pack here, so create a new one!)<br />
3. In the Connection String dialog click on the &#8220;Build&#8230;&#8221; button. Choose any random Provider (we will change the connection string later on) enter a random computer name and database as well. Make sure you check: &#8220;Use Simple Authentication RunAs Profile created for this OLE DB data source transaction&#8221;, this is important.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb5.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb5-300x157.png" alt="" title="oracle_oledb5" width="300" height="157" class="alignnone size-medium wp-image-383" /></a></p>
<p>4. Enter Query performance thresholds, if this is required.<br />
5. Within the &#8220;Watcher Nodes&#8221; step, select the machine on which we installed the Oracle client.<br />
6. Finish the wizard.</p>
<p>You should now end up with an OleDB Data Source within SCOM.<br />
Open the data source and navigate to the &#8220;Connection String&#8221; tab.<br />
Change the connection string in to the following format:</p>
<p><code>Provider=OraOLEDB.Oracle;Data Source=TEST;User Id=$RunAs[Name="OleDbCheck_b7035c5b5d6149b684df79089e99dc07.SimpleAuthenticationAccount"]/UserName$;Password=$RunAs[Name="OleDbCheck_b7035c5b5d6149b684df79089e99dc07.SimpleAuthenticationAccount"]/Password$</code></p>
<p>Replace the RunAs variables with the ones generated by the wizard. The data source is the Oracle SID, the same you used to test before. The provider name is the short (internal) name for the Oracle Provider for OLEDB.<br />
Save the OLEDB Data Source.</p>
<p><strong>Add associated runas user profiles</strong></p>
<p>If you checked the &#8220;Use Simple Authentication RunAs Profile created for this OLE DB data source transaction&#8221; during the wizard you should end up with a preset RunAs profile for this monitor. You can find it under Administration->Run As Configuration->Profiles in the operations manager console. </p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb6.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb6.png" alt="" title="oracle_oledb6" width="307" height="149" class="alignnone size-full wp-image-390" /></a></p>
<p>Double click this &#8220;simple authentication&#8221; RunAs profile.</p>
<p>To add a &#8220;Run As Account&#8221; follow the following steps:</p>
<p>1. In the &#8220;Run As Profile Wizard&#8221; click the &#8220;Run As Accounts&#8221; tab.<br />
2. Click on the &#8220;Add&#8230;&#8221; button to add an account.<br />
3. Click on &#8220;New&#8230;&#8221;, the &#8220;Create Run As Account Wizard&#8221; should now start. Skip the introduction.<br />
4. On the general properties page, select the run as account type. Set this to Simple Authentication and specify a display name.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb7.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb7.png" alt="" title="oracle_oledb7" width="679" height="605" class="alignnone size-full wp-image-391" /></a></p>
<p>5. On the credentials tab specify the account name and password.<br />
6. Select a distribution security option, based on your preference. I used the More Secure option (you need to reopen the account under the accounts pane to distribute it to your watcher node)<br />
7. Finish the &#8220;Create Run As Account Wizard&#8221;<br />
8. Click &#8220;OK&#8221; and finish the &#8220;Run As Profile Wizard&#8221;</p>
<p>You have now configured the Run As profile.<br />
To see the result of all this work, open the &#8220;OLE DB Data Source State&#8221; view within the monitoring pane. This is located underneath the &#8220;Synthetic Transaction&#8221; folder.<br />
This could take a while! (It took about 15 minutes in my environment)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Plugwise unleashed document released</title>
		<link>http://www.maartendamen.com/2010/08/plugwise-unleashed-document-released/</link>
		<comments>http://www.maartendamen.com/2010/08/plugwise-unleashed-document-released/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 18:34:42 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Plugwise unleashed]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=359</guid>
		<description><![CDATA[Today I am releasing the Plugwise Unleashed document. This document describes most of the Plugwise protocol.
The document can be downloaded from the downloads section on my site, or in the bottom of this post.
If you would like to know any more detail about the protocol, please drop a comment so I can have a look.
This [...]]]></description>
			<content:encoded><![CDATA[<p>Today I am releasing the Plugwise Unleashed document. This document describes most of the Plugwise protocol.<br />
The document can be downloaded from the downloads section on my site, or in the bottom of this post.<br />
If you would like to know any more detail about the protocol, please drop a comment so I can have a look.<br />
This is version 0.1 of the document so there might be some mistakes in it, please also let me know.</p>
<p>And last but not least if you like the document and use it, please at least reference my site/my document. Or, you could drop a donation that would be nice.</p>
<a class="downloadlink" href="http://www.maartendamen.com/wp-content/plugins/download-monitor/download.php?id=5" title="Version0.1 downloaded 153 times" >Plugwise Unleashed (153)</a>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/08/plugwise-unleashed-document-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 5: extending IR range</title>
		<link>http://www.maartendamen.com/2010/08/jeenode-infrared-project-part-5-extending-ir-range/</link>
		<comments>http://www.maartendamen.com/2010/08/jeenode-infrared-project-part-5-extending-ir-range/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 13:21:55 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=353</guid>
		<description><![CDATA[Ok, so my IR controller has been running for a while. Though I was only using it for receiving for now.
The range of the IR LED was not sufficient enough to control my devices. Today I had a look into the hardware schematics.
I increased the transmitting power by using a NPN transistor (BC549).

Here&#8217;s the schematic [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so my IR controller has been running for a while. Though I was only using it for receiving for now.<br />
The range of the IR LED was not sufficient enough to control my devices. Today I had a look into the hardware schematics.<br />
I increased the transmitting power by using a NPN transistor (BC549).<br />
<span id="more-353"></span></p>
<p>Here&#8217;s the schematic I used (all at 5V, USB power):</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/08/ir_transmitter.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/08/ir_transmitter.png" alt="" title="ir_transmitter" width="343" height="360" class="alignnone size-full wp-image-354" /></a></p>
<p>Using this schematic I doubled the range of my IR LED, the power drawn in the circuit is now 37mA. My former circuit, without using a NPN transistor drew 20mA (JeeNode max per digital pin). So that&#8217;s almost twice the power.<br />
You could increase this even further using smaller valued resistors, but that would push the boundaries of the LED and transistor. I didn&#8217;t need any bigger range anyway as I use IR emitter cables attached to my devices.<br />
Now that I&#8217;m satisfied with the hardware part of sending I can start looking at the software side! </p>
<p>p.s: here&#8217;s a picture of the box right now.. cables anyone?</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/08/2010-08-10_14-04-35_13_Doetinchem.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/08/2010-08-10_14-04-35_13_Doetinchem-1024x575.jpg" alt="" title="2010-08-10_14-04-35_13_Doetinchem" width="1024" height="575" class="alignnone size-large wp-image-356" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/08/jeenode-infrared-project-part-5-extending-ir-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mass creation of HP WSEM WiFi guest accounts using SSH and PowerShell</title>
		<link>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/</link>
		<comments>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 13:58:51 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wsem]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=348</guid>
		<description><![CDATA[I was asked to create 365 (1 year) of WiFi (daily) guest access accounts, and export them to CSV.
Of course I didn&#8217;t want to create them by hand.. this is where PowerShell came in. I used the following PowerShell script to create random WiFi guest accounts:


# Number of days to generate, default = 365
$NumDays 		= [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked to create 365 (1 year) of WiFi (daily) guest access accounts, and export them to CSV.<br />
Of course I didn&#8217;t want to create them by hand.. this is where PowerShell came in. I used the following PowerShell script to create random WiFi guest accounts:</p>
<p><span id="more-348"></span></p>
<pre class="brush: powershell;">
# Number of days to generate, default = 365
$NumDays 		= 365
$AccessGroup 	= &quot;Gasten&quot;
$ExpiryTime 	= &quot;20:00&quot;
$StartTime 		= &quot;07:00&quot;
$OutputCSV		= &quot;C:\TEMP\wireless.csv&quot;

$SshHost 		= &quot;127.0.0.1&quot;
$SshUser		= &quot;someuser&quot;

$access_codes = @()

# Start SSH session
New-SshSession $SshUser $SshHost
Invoke-Ssh &quot;z&quot;
Invoke-Ssh &quot;conf t&quot;
Invoke-Ssh &quot;wireless F&quot;
Invoke-Ssh &quot;conf t&quot;
Invoke-Ssh &quot;radius-server local&quot;

$i = 0;
do {
	# WSEM format: mm/dd/yyyy hh:mm
	$date = (Get-Date).AddDays($i)
	$date2 = Get-Date $date -Format &quot;dd-MM-yyyy&quot;
	$date = Get-Date $date -format &quot;MM:dd:yyyy&quot;
	$pass = RandomPassword 4
	$user = RandomPassword 4
	$output = &quot;rad-user $user password 0 $pass group $AccessGroup guest expiry-time $ExpiryTime expiry-date $date start-time $StartTime start-date $date&quot;

	# add user through SSH
	Invoke-ssh $output

	$Response = New-Object PSObject
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Datum&quot; -Value $date2
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Gebruikersnaam&quot; -Value $user
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Wachtwoord&quot; -Value $pass
	$access_codes += $Response

	$i++;
} while ( $i -le $NumDays )

# Save and disconnect SSH
Invoke-ssh &quot;write mem&quot;
Remove-SshSession

# Export to CSV
$access_codes | Export-Csv $OutputCSV

# Helper functions
function RandomPassword ([int]$intPasswordLength)
{
   $strNumbers = &quot;1234567890&quot;
   $strCapitalLetters = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;
   $strLowerLetters = &quot;abcdefghijklmnopqrstuvwxyz&quot;
   $rand = new-object random

   for ($a=1; $a -le $intPasswordLength; $a++)
      {
         if ($a -gt 3)
           {
      	      $b = $rand.next(0,3) + $a
      	      $b = $b % 3 + 1
      	   } else { $b = $a }
      	 switch ($b)
      	   {
      	      &quot;1&quot; {$b = &quot;$strNumbers&quot;}
      	      &quot;2&quot; {$b = &quot;$strCapitalLetters&quot;}
      	      &quot;3&quot; {$b = &quot;$strLowerLetters&quot;}
      	   }
         $charset = $($b)
         $number = $rand.next(0,$charset.Length)
         $RandomPassword += $charset[$number]
      }
   return $RandomPassword
}
</pre>
<p>Special thanks to Joel Bennett&#8217;s SharpSSH wrapper for PowerShell (located here: <a href="http://huddledmasses.org/scriptable-ssh-from-powershell/">http://huddledmasses.org/scriptable-ssh-from-powershell/</a>) which I used to automate the command line commands for the HP WSEM.<br />
This shows the great power of PowerShell for automating virtually anything! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HP Insight Management Agent reports that unused VMware nics are down</title>
		<link>http://www.maartendamen.com/2010/07/hp-insight-management-agent-reports-that-unused-vmware-nics-are-down/</link>
		<comments>http://www.maartendamen.com/2010/07/hp-insight-management-agent-reports-that-unused-vmware-nics-are-down/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 14:14:28 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[VMware vSphere]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vsphere]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=341</guid>
		<description><![CDATA[When you don&#8217;t use certain nics on your VMware hosts, HP Insight Management Agents may report that the nics are down. Which is the natural behavior of these clients.
The system management homepage on those hosts looks like this:


To find out the vmnic number, simple click the error, the vmnic number is shown on that page:

To [...]]]></description>
			<content:encoded><![CDATA[<p>When you don&#8217;t use certain nics on your VMware hosts, HP Insight Management Agents may report that the nics are down. Which is the natural behavior of these clients.<br />
The system management homepage on those hosts looks like this:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/07/vmware_nics1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/07/vmware_nics1.png" alt="" title="vmware_nics1" width="403" height="177" class="alignnone size-full wp-image-342" /></a></p>
<p><span id="more-341"></span><br />
To find out the vmnic number, simple click the error, the vmnic number is shown on that page:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/07/vmware_nics2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/07/vmware_nics2.png" alt="" title="vmware_nics2" width="725" height="126" class="alignnone size-full wp-image-343" /></a></p>
<p>To resolve this you simple have to put the nics into the &#8220;Down&#8221; state using &#8220;ifconfig&#8221;:</p>
<p><code>ifconfig vmnic3 down</code></p>
<p>To make this change more permanent (surviving reboots) you have to put the command in the file /etc/rc.local (this file is called once the host has been started)<br />
Here is an example rc.local disabling 2 nics:</p>
<p><code><br />
#!/bin/sh<br />
#<br />
# This script will be executed *after* all the other init scripts.<br />
# You can put your own initialization stuff in here if you don't<br />
# want to do the full Sys V style init stuff.</p>
<p>touch /var/lock/subsys/local<br />
ifconfig vmnic3 down<br />
ifconfig vmnic7 down<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/07/hp-insight-management-agent-reports-that-unused-vmware-nics-are-down/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 4: a better home&#8230;</title>
		<link>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/</link>
		<comments>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 20:10:03 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[hotglue]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=321</guid>
		<description><![CDATA[Agreed, a breadboard looks nice and &#8220;hacky&#8221;. But, it doesn&#8217;t really fit nicely into my interior :-)
It&#8217;s time to give the Jeenode infrared sender/receiver a better home!
The main ingredients to get this going are: 

Hot glue (love that stuff)
Solder
Some wires
A Jeelabs carrier board with case
A drill
A lot of patience&#8230;


I started out drilling a hole for [...]]]></description>
			<content:encoded><![CDATA[<p>Agreed, a breadboard looks nice and &#8220;hacky&#8221;. But, it doesn&#8217;t really fit nicely into my interior :-)<br />
It&#8217;s time to give the Jeenode infrared sender/receiver a better home!</p>
<p>The main ingredients to get this going are: </p>
<ul>
<li>Hot glue (love that stuff)</li>
<li>Solder</li>
<li>Some wires</li>
<li><a href="http://cafe.jeelabs.net/lab/cb1/">A Jeelabs carrier board with case</a></li>
<li>A drill</li>
<li>A lot of patience&#8230;</li>
</ul>
<p><span id="more-321"></span></p>
<p>I started out drilling a hole for the power supply. I used an USB cable to power the Jeenode (I cut the unused wires). USB is on a lot of devices nowadays (media boxes, media tanks, sat receivers you name it) so this is an ideal power source for my IR box.</p>
<p>Here is the hole in place (one part of the box is shown):<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box1.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box1-300x168.jpg" alt="" title="box1" width="300" height="168" class="alignnone size-medium wp-image-323" /></a></p>
<p>And here is the result of the closed box:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box2.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box2-300x168.jpg" alt="" title="box2" width="300" height="168" class="alignnone size-medium wp-image-326" /></a></p>
<p>The next step I took was to give the IR receiver a nice position, I choose the opposite of the power connector. I did this because I want the power connector, and other connectors out of sight.<br />
Once again I drilled a hole, inside the box I had to make a little piece of plastic tube to lift the IR sensor (I soldered it to a little hobby print board)</p>
<p>Here&#8217;s a picture of the plastic tube, and the IR sensor soldered on the hobby print board:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box3.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box3-300x168.jpg" alt="" title="box3" width="300" height="168" class="alignnone size-medium wp-image-327" /></a></p>
<p>And here is it glued to the box (I am a sloppy solderer, but hey it&#8217;s inside a box anyway :-) )</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box4.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box4-300x168.jpg" alt="" title="box4" width="300" height="168" class="alignnone size-medium wp-image-328" /></a></p>
<p>And this is how it looks on the outside:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box5.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box5-300x168.jpg" alt="" title="box5" width="300" height="168" class="alignnone size-medium wp-image-329" /></a></p>
<p>Next up was wiring the cables the same way as on the breadboard, this was more work then I expected it to be. Took me quite a while to get everything wired up.<br />
Here&#8217;s the result of the wiring inside the box:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box6.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box6-300x168.jpg" alt="" title="box6" width="300" height="168" class="alignnone size-medium wp-image-332" /></a></p>
<p>And this is how it looks from the outside:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box8.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box8-300x168.jpg" alt="" title="box8" width="300" height="168" class="alignnone size-medium wp-image-336" /></a></p>
<p>That&#8217;s it! The receiver has been put inside the box, I need some more time to fit the sender inside the box. I have some different idea&#8217;s for that instead of drilling holes.<br />
This step in the project required quite some different skills (drilling, glue&#8217;ing, soldering etc)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The case of the black Windows startup screen</title>
		<link>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/</link>
		<comments>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 14:40:02 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=313</guid>
		<description><![CDATA[Today I had a nice issue. One of the servers at work suddenly had a &#8220;black&#8221; Windows startup screen.
It looked like this:


This happened after the server (suddenly) ran out of free disk space. It turned out that all color settings where reset to &#8220;0&#8243; (black), the registry showed the following color values:

The fix for this [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had a nice issue. One of the servers at work suddenly had a &#8220;black&#8221; Windows startup screen.<br />
It looked like this:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/black1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/black1-300x180.png" alt="" title="black1" width="300" height="180" class="alignnone size-medium wp-image-314" /></a><br />
<span id="more-313"></span></p>
<p>This happened after the server (suddenly) ran out of free disk space. It turned out that all color settings where reset to &#8220;0&#8243; (black), the registry showed the following color values:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/black2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/black2.png" alt="" title="black2" width="407" height="577" class="alignnone size-full wp-image-315" /></a></p>
<p>The fix for this was easy, I took the color schema settings from a working 2003 server and inserted them remotely from my workstation. The color schema settings are located under the following registry key: HKEY_USERS\.DEFAULT\Control Panel\Colors</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 3: sending test</title>
		<link>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/</link>
		<comments>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 16:03:51 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=280</guid>
		<description><![CDATA[In the first and second part of this series I introduced my idea&#8217;s about the IR project.I also showed some basic receiving, and even receiving over the air.What was left out, was the sending part. Today I found some time to get a sending setup together.Here&#8217;s the setup:

A Jeelink containing a sketch which translates serial commands [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.maartendamen.com/?p=257">first</a> and <a href="http://www.maartendamen.com/?p=265">second</a> part of this series I introduced my idea&#8217;s about the IR project.<br />I also showed some basic receiving, and even receiving over the air.<br />What was left out, was the sending part. <br />Today I found some time to get a sending setup together.<br /><span id="more-280"></span>Here&#8217;s the setup:</p>
<ul>
<li>A Jeelink containing a sketch which translates serial commands to IR codes and sends them over the air;</li>
<li>A Jeenode on the receiving side, which receives the IR commands and sends them out to an IR led;</li>
<li>A python script to send commands to the serial port, to create a basic zapping demo.</li>
</ul>
<p>Here&#8217;s a little video demonstrating the sketches and python script below:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/-pKP8Yxzwjo&#038;hl=nl_NL&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-pKP8Yxzwjo&#038;hl=nl_NL&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>The Jeelink has the following sketch:</p>
<pre class="brush: cpp;">
/*
 * mdRFReceive - Generic home automation RF12 receiver.
 * Version 0.1 June, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/
#include &lt;Ports.h&gt;
#include &lt;RF12.h&gt;

#define MAX_STRING_LEN  20

byte needToSend;
long unsigned int sendbuf;
char buffer[MAX_STRING_LEN];
int bufferIndex = 0;

void setup() {
  Serial.begin(57600);
  rf12_config();
}

static void sendIR(long unsigned int code) {
  sendbuf = code;
  needToSend = 1;
}

char* subStr (char* str, char *delim, int index) {
   char *act, *sub, *ptr;
   char output;
   static char copy[MAX_STRING_LEN];
   int i;

   // Since strtok consumes the first arg, make a copy
   strcpy(copy, str);

   for (i = 1, act = copy; i &lt;= index; i++, act = NULL) {
	sub = strtok_r(act, delim, &amp;ptr);
	if (sub == NULL) break;
   }
   return sub;
}

unsigned long long conv64(char* str)
{
    unsigned long long res = 0;

    // remove 0x or 0X part
    if((strstr(str, &quot;0x&quot;) == str) || (strstr(str, &quot;0X&quot;) == str))
        str += 2;

    // do the conversion...
    for(; *str != 0; str++)
    {
        // multiply by 16 (remember, hexadecimal == base 16)
        res &lt;&lt;= 4;
        if(strchr(&quot;0123456789&quot;, *str) != NULL) // if within 0-9...
            res |= *str - '0';
        else if(strchr(&quot;ABCDEF&quot;, *str) != NULL) // if within A-F...
            res |= *str + 10 - 'A';
        else if(strchr(&quot;abcdef&quot;, *str) != NULL) // if within a-f...
            res |= *str + 10 - 'a';
        else
        {
            res &gt;&gt;= 4;
            break;
        }
    }

    return res;
}

static void handleInput (char* command, char* argument) {
  if (strcmp(command, &quot;send_tv&quot;)  == 0)
  {
    long unsigned int test = conv64(argument);
    sendIR(test);
  }
}

void loop() {
    if (Serial.available())
    {
      char ch = Serial.read();
      if (ch == '\n')
      {
        bufferIndex = 0;
        handleInput(subStr(buffer, &quot; &quot;, 1), subStr(buffer, &quot; &quot;, 2));
      } else {
        buffer[bufferIndex++] = ch;
      }
    }

  if (rf12_recvDone() &amp;&amp; rf12_crc == 0) {
    byte n = rf12_len;
    Serial.println(&quot;Packet CRC OK&quot;);
    Serial.print((int) rf12_hdr);
    for (byte i = 0; i &lt; n; i++) {
      Serial.print(' ');
      Serial.print((int) rf12_data[i]);
    }
    Serial.println();
  }

  if (needToSend &amp;&amp; rf12_canSend()) {
    needToSend = 0;
    rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
  }
}
</pre>
<p>The Jeenode has the following receiving sketch:</p>
<pre class="brush: cpp;">
/*
 * mdIR - IR interface for home automation.
 * Version 0.1 May, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/

#include &lt;RF12.h&gt;
#include &lt;Ports.h&gt;
#include &lt;IRremote.h&gt;

IRsend irsend;

int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN);

MilliTimer sendTimer;

byte needToSend;
decode_results results;

long unsigned int sendbuf;
long unsigned int received;

struct {
    byte decode;     // IR decode
} payload;

void setup () {
    Serial.begin(57600);
    Serial.println(57600);
    Serial.println(&quot;mdIR started...&quot;);
    rf12_config();
    irrecv.enableIRIn(); // Start the IR receiver
}

void loop () {
    if (irrecv.decode(&amp;results)) {
      needToSend = 1;
      sendbuf = results.value;

      Serial.println(results.value);
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
    }

    /* TODO: rf12_canSend doesn't work if I remove this... (needs to check incoming packets?) */
    if (rf12_recvDone() &amp;&amp; rf12_crc == 0 &amp;&amp; (int) rf12_hdr == 10) {
      byte n = rf12_len;
      Serial.println(&quot;Packet CRC OK&quot;);
      Serial.println((int) n);
      for (byte i = 0; i &lt; n; i++) {
        Serial.print(' ');
        Serial.print((int) rf12_data[i]);
      }
      Serial.println();

      received = ( ((long) rf12_data[3] &lt;&lt; 24)
                       + ((long) rf12_data[2] &lt;&lt; 16)
                       + ((long) rf12_data[1] &lt;&lt; 8)
                       + ((long) rf12_data[0] ) );

      irsend.sendSamsung(received, 32);
      /* Re-enable receiving mode */
      irrecv.enableIRIn();
      Serial.println();
    }

    if (needToSend &amp;&amp; rf12_canSend()) {
        needToSend = 0;
        Serial.println(&quot;need to send&quot;);
        rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
    }
}
</pre>
<p>The python scripts looks like this:</p>
<pre class="brush: python;">
from twisted.internet.serialport import SerialPort
import sys
from twisted.protocols import basic
if sys.platform == 'win32':
    from twisted.internet import win32eventreactor
    win32eventreactor.install()
from twisted.internet import reactor

class IRProtocol(basic.LineReceiver):
    def __init__(self):
        # Power on the tv
        reactor.callLater(10.0, self.send_tv, &quot;0xE0E040BF&quot;)

        # Zap a bit
        reactor.callLater(15.0, self.send_tv, &quot;0xE0E020DF&quot;)
        reactor.callLater(20.0, self.send_tv, &quot;0xE0E0A05F&quot;)
        reactor.callLater(25.0, self.send_tv, &quot;0xE0E0609F&quot;)
        reactor.callLater(30.0, self.send_tv, &quot;0xE0E010EF&quot;)
        reactor.callLater(35.0, self.send_tv, &quot;0xE0E0906F&quot;) 

    def lineReceived(self, line):
        &quot;&quot;&quot; Do nothing with received lines yet &quot;&quot;&quot;

    def send_tv(self, command):
        &quot;&quot;&quot;
        Send's an IR command.
        &quot;&quot;&quot;
        self.transport.write('send_tv ' + command + '\n')            

SerialPort(IRProtocol(), 6 , reactor, '57600')
reactor.run()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Green Jeenode</title>
		<link>http://www.maartendamen.com/2010/06/green-jeenode/</link>
		<comments>http://www.maartendamen.com/2010/06/green-jeenode/#comments</comments>
		<pubDate>Mon, 31 May 2010 23:30:43 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[jeenode]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[solar]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=275</guid>
		<description><![CDATA[I have just powered my first Jeenode with solar power.This node has been running for 5 days now. The solar panel is one normally used to charge cell phones.It supplies 5v and has a accu pack of 2800mah, this should keep this node running for quite a while&#8230;Click on &#8220;More&#8221; for a image of this [...]]]></description>
			<content:encoded><![CDATA[<p>I have just powered my first Jeenode with solar power.<br />This node has been running for 5 days now. <br />The solar panel is one normally used to charge cell phones.<br />It supplies 5v and has a accu pack of 2800mah, this should keep this node running for quite a while&#8230;<br />Click on &#8220;More&#8221; for a image of this Jeenode.<br /><span id="more-275"></span></p>
<p><img class="alignnone" style="display: block;" src="http://www.maartendamen.com/wp-content/uploads/2010/06/wpid-2010-05-31-20.19.38.jpg" alt="image" width="499" height="373" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/green-jeenode/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 2: going wireless</title>
		<link>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/</link>
		<comments>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/#comments</comments>
		<pubDate>Mon, 31 May 2010 17:09:42 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=265</guid>
		<description><![CDATA[In part 1 of this series I blogged about receiving infrared signals using an IR led. This blog post will focus on getting the signals up in the air (and off course receiving them on the other side, in my case my home automation server with a Jeelink attached)
The Jeenode&#8217;s have a HopeRF wireless receiver/transmitter [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.maartendamen.com/?p=257">In part 1 of this series</a> I blogged about receiving infrared signals using an IR led. This blog post will focus on getting the signals up in the air (and off course receiving them on the other side, in my case my home automation server with a Jeelink attached)<br />
The Jeenode&#8217;s have a HopeRF wireless receiver/transmitter on board, which makes life easy.<br />
<span id="more-265"></span>Jeelabs provides a RF12 library for really easy sending over the air, the receiver in my case is a Jeelink (which is basically a Jeenode but in nice small USB stick format)</p>
<p>I modified my existing source code to enable wireless transmitting:</p>
<pre class="brush: cpp;">
/*
 * mdIR - IR interface for home automation.
 * Version 0.1 May, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/

#include &lt;RF12.h&gt;
#include &lt;Ports.h&gt;
#include &lt;IRremote.h&gt;

int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN);

MilliTimer sendTimer;

byte needToSend;
decode_results results;

long unsigned int sendbuf;

struct {
    byte decode;     // IR decode
} payload;

void setup () {
    Serial.begin(57600);
    Serial.println(57600);
    Serial.println(&quot;mdIR started...&quot;);
    rf12_config();
    irrecv.enableIRIn(); // Start the IR receiver
}

void loop () {
    if (irrecv.decode(&amp;results)) {
      needToSend = 1;
      sendbuf = results.value;

      Serial.println(results.value);
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
    }

    /* TODO: rf12_canSend doesn't work if I remove this... (needs to check incoming packets?) */
    if (rf12_recvDone() &amp;&amp; rf12_crc == 0) {
    }

    if (needToSend &amp;&amp; rf12_canSend()) {
        needToSend = 0;
        Serial.println(&quot;need to send&quot;);
        rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
    }
}
</pre>
<p>Here&#8217;s a screenshot of my Jeelink receiving the packets send by the Jeenode receiving the infrared signals:</p>
<p><img class="alignnone size-full wp-image-268" title="jeelink_ir" src="http://www.maartendamen.com/wp-content/uploads/2010/05/jeelink_ir.png" alt="jeelink_ir" width="518" height="598" /><br />
<em>Image 1: Jeelink receiving IR signals send by another Jeenode.</em> Notice the different buttons pressed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
