<?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>n8blog &#187; Hardware</title>
	<atom:link href="http://www.n8gray.org/blog/category/hacking/hardware/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.n8gray.org</link>
	<description>distraction in action</description>
	<lastBuildDate>Thu, 01 Jul 2010 18:21:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pronto to LIRC</title>
		<link>http://www.n8gray.org/blog/2007/01/28/pronto-to-lirc/</link>
		<comments>http://www.n8gray.org/blog/2007/01/28/pronto-to-lirc/#comments</comments>
		<pubDate>Sun, 28 Jan 2007 08:23:37 +0000</pubDate>
		<dc:creator>n8</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://www.n8gray.org/blog/2007/01/28/pronto-to-lirc/</guid>
		<description><![CDATA[In a recent post I discussed the URC-300 universal remote, one of my favorite new toys.  I yakked a bit about discrete codes and left off with a tantalizing tease about using discrete codes from the Remote Central database with LIRC.  Just to refresh your memory, this would be nifty because it would [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.n8gray.org/blog/2007/01/18/urc-300/">a recent post</a> I discussed the <span class="caps">URC</span>-300 universal remote, one of my favorite new toys.  I yakked a bit about discrete codes and left off with a tantalizing tease about using discrete codes from <a href="http://www.remotecentral.com/cgi-bin/files/rcfiles.cgi?area=pronto&amp;#038;db=discrete">the Remote Central database</a> with <a href="http://www.lirc.org/"><span class="caps">LIRC</span></a>.  Just to refresh your memory, this would be nifty because it would allow me to learn the discrete codes into the <span class="caps">URC</span>-300 (or any other learning remote), which otherwise wouldn&#8217;t be able to use them.</p>

<p><span id="more-137"></span></p>

<p>I&#8217;m not going to cover setting up <span class="caps">LIRC </span>or choosing an IR transceiver, since those topics are covered in detail on the <span class="caps">LIRC </span>website.  Let&#8217;s just say that there are many options available to you at pretty cheap prices, and if you&#8217;ve got any skill at all with a soldering iron you can build an IR transceiver for pocket change.</p>

<p>Discrete codes are almost always distributed in Philips Pronto format.  It&#8217;s sort of the <em>lingua franca</em> of remote controls.  What we <strong>really</strong> want is a nice little utility that reads a pronto code and spits out a <span class="caps">LIRC </span>config file.  There&#8217;s lots of info out there on the pronto format and IR codes in general, but, sadly, no such utility exists, so we have to do things the hard way.</p>

<p>First, an overview of our strategy.  When you push a button on a remote control it transmits a number to the device it controls.  There are a variety of techniques manufacturers use for encoding numbers as IR pulses, but in the end it&#8217;s all about getting <strong>one number</strong> (or &#8220;code&#8221;) to that device.  As you&#8217;ll see, it&#8217;s not too hard to get that code out of a pronto code, but it can be tricky to translate the encoding information to <span class="caps">LIRC. </span> What we&#8217;re going to do is let <span class="caps">LIRC </span>worry about all the encoding details by either using a pre-existing config file for the device or learning one from its remote.  Once we have that config it&#8217;s trivial to insert the new discrete codes.</p>

<p>To start with, we need a <span class="caps">LIRC </span>config file for the device in question.  I&#8217;m going to use the Roku Soundbridge as an example device here.  If you&#8217;re lucky there&#8217;s a ready-made config file on the <span class="caps">LIRC </span>website for your device.  If you&#8217;re <strong>really</strong> lucky it already has the discrete codes and you&#8217;re finished!  For the Soundbridge I&#8217;m not so lucky<sup class="footnote"><a href="#fn1">1</a></sup>.  Thankfully we have the original remote, so we can use <span class="caps">LIRC </span>to build a config file.  We fire up <code>irrecord</code> and follow the instructions (no need to actually record all the remote&#8217;s buttons), and pretty soon we have something like this:</p>



<pre>begin remote

  name  soundbridge
  bits           16
  [snip]
  pre_data_bits   16
  pre_data       0xF609
  [snip]
      begin codes
          power                    0x6897
          menu                     0xE817
          [snip]
      end codes
end remote</pre>



<p>There&#8217;s no need to understand everything in the file, so I&#8217;ve snipped out everything but the interesting parts.  What do we see here?  It looks like the Soundbridge remote sends 32-bit codes (a 16-bit header and a 16-bit code).  The code for toggling power is 0xF6096897 and the code for the menu button is 0xF609E817.  All the codes start with the same prefix (0xF609) so it&#8217;s only written once.</p>

<p>Now all we need is are the discrete power codes (we&#8217;ll call them power_on and power_off).  These are normally provided in one of two ways &#8212; as pronto codes or .ccf files.  We can use either one, but for now let&#8217;s assume you have a .ccf file.  In fact, <a href="http://www.rokulabs.com/">Roku Labs</a> provides a .ccf file for the Soundbridge on <a href="http://www.rokulabs.com/downloads/">their website</a>.  We&#8217;re going to use <a href="http://giantlaser.com/tonto/">Tonto</a>, the open-source ccf editor, to examine the contents of the .ccf file.  I&#8217;m not going to talk about installing Tonto, just suffice to say that it&#8217;s much the same as setting up any other Java program.</p>

<p>So now we do the following steps (<a href="http://www.n8gray.org/wp-content/uploads/2007/01/tontoarrows.png">here&#8217;s a screenshot</a> you can follow if you get lost):</p>


<ol>
<li>Start Tonto</li>
<li>Load Soundbridge.ccf</li>
<li>Use the tree view on the left side to navigate to devices/soundbridge/extras</li>
<li>Double-click &#8220;extras&#8221; to open a view of the extras panel.  The &#8220;power on&#8221; and &#8220;power off&#8221; buttons here are the discrete controls we&#8217;re looking for!</li>
<li>Double-click the &#8220;power on&#8221; button to examine its properties</li>
<li>Double-click the &#8220;[IR] Power On&#8221; line to see the details of the IR signal</li>
<li>Click the &#8220;Expert&#8221; button to see the &#8220;expert&#8221; details.  <img src='http://www.n8gray.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>



<p>Bingo!  In the expert details view there&#8217;s a HexValue field that reads f609c23d.  Remember how our other codes started with <span class="caps">F609</span>?  So all we need to do is add a line to the codes section of the <span class="caps">LIRC </span>config file:</p>



<pre>      begin codes
          power                    0x6897
          menu                     0xE817
          power_on                 0xC23D
      end codes
end remote</pre>



<p>Save this file in the appropriate place, point your IR transmitter at the Soundbridge (or whatever your device is), restart lircd, and try <code>irsend SEND_ONCE soundbridge power_on</code>.  The power should turn on.  Try it again and it should <strong>stay</strong> on.  Yay!  Now you can teach the code to your remote or use it with <span class="caps">LIRC. </span> Repeat with the rest of the codes you want to use and write macros that Just Work&#8482;.</p>

<p>One last detail.  If you <strong>don&#8217;t</strong> have a full ccf file and just have the pronto code (a <em>very</em> long string of hex digits) for a command, you can still extract the code.  In the first (non-expert) IR Signal dialog we saw in Tonto, the text field contains the pronto code for the button.  If you paste in a different pronto code and then click &#8220;expert&#8221; you&#8217;ll see the hex code for that code.  So just use any old ccf file you can find, any device, any button, and paste in the code you need.  This is how I got the discrete power codes for my <span class="caps">JVC TV.</span></p>

<p>[1] If <strong>you</strong> have a Soundbridge your luck should be much better now.  I&#8217;ve sent in the Soundbridge config file to the <span class="caps">LIRC </span>developers so it should be in their database soon.  <img src='http://www.n8gray.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.n8gray.org%2Fblog%2F2007%2F01%2F28%2Fpronto-to-lirc%2F&amp;linkname=Pronto%20to%20LIRC"><img src="http://www.n8gray.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.n8gray.org/blog/2007/01/28/pronto-to-lirc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hardware Links</title>
		<link>http://www.n8gray.org/blog/2005/10/24/hardware-links/</link>
		<comments>http://www.n8gray.org/blog/2005/10/24/hardware-links/#comments</comments>
		<pubDate>Tue, 25 Oct 2005 05:42:00 +0000</pubDate>
		<dc:creator>n8</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://www.n8gray.org/sandbox/wordpress/?p=51</guid>
		<description><![CDATA[
Ever wanted to know the pinout of a PlayStation controller connector?  How about how to build a null-modem cable?  Who among us hasn&apos;t, at some point, wanted to build their own PS/2 to Serial Mouse adapter?  Thanks to the folks at the Hardware Book, you can get all this information and more!

Once [...]]]></description>
			<content:encoded><![CDATA[<p>
Ever wanted to know the pinout of a PlayStation controller connector?  How about how to build a null-modem cable?  Who among us <i>hasn&apos;t</i>, at some point, wanted to build their own PS/2 to Serial Mouse adapter?  Thanks to the folks at <a href="http://www.hardwarebook.net">the Hardware Book</a>, you can get all this information and more!<br />
<p>
Once you&apos;ve figured out the pinout of that Amiga Video connector and want to build a custom circuit, it&apos;s good to know how to <a href="http://www.5bears.com/pcb.htm">make your own iron-on <span class="caps">PCB </span>masks</a> using a laser printer and photo paper.  <a href="http://www.fullnet.com/u/tomg/gooteepc.htm">Here&apos;s another site</a> with lots of info.<br />
<p>
Of course, you&apos;ll actually need to know a little bit about electronics to use this knowledge.  <a href="http://www.iguanalabs.com/advanced.htm">These guys</a> have some tutorials, and <a href="http://www.makezine.com/blog/">these guys</a> have cool ideas.<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.n8gray.org%2Fblog%2F2005%2F10%2F24%2Fhardware-links%2F&amp;linkname=Hardware%20Links"><img src="http://www.n8gray.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.n8gray.org/blog/2005/10/24/hardware-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
