<?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>Limina.Log &#187; Physical Computing</title>
	<atom:link href="http://log.liminastudio.com/category/itp/physical-computing/feed" rel="self" type="application/rss+xml" />
	<link>http://log.liminastudio.com</link>
	<description>Research &#38; Development at Limina.Studio</description>
	<lastBuildDate>Sun, 15 Jan 2012 21:25:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using the RN-XV WiFi Module as a Remote Switch</title>
		<link>http://log.liminastudio.com/itp/physical-computing/using-the-rn-xv-wifi-module-as-a-remote-switch</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/using-the-rn-xv-wifi-module-as-a-remote-switch#comments</comments>
		<pubDate>Wed, 21 Dec 2011 00:40:57 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[RN-XV]]></category>
		<category><![CDATA[WiFi]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=959</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/using-the-rn-xv-wifi-module-as-a-remote-switch' addthis:title='Using the RN-XV WiFi Module as a Remote Switch '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>It&#8217;s been a struggle, but I finally figured out how to use a Roving Networks RN-XV WiFi module as a remote switch.  It&#8217;s not hard now that I know how it works, but figuring out was quite difficult, as the manual is apparently incorrect and the firmware it shipped with was causing problems.  Read on [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/using-the-rn-xv-wifi-module-as-a-remote-switch' addthis:title='Using the RN-XV WiFi Module as a Remote Switch '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><a href="http://log.liminastudio.com/wp-content/uploads/2011/12/IMG_2464.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-960" title="RN-XV remote switch" src="http://log.liminastudio.com/wp-content/uploads/2011/12/IMG_2464-224x300.jpg" alt="" width="224" height="300" /></a>It&#8217;s been a struggle, but I finally figured out how to use a Roving Networks RN-XV WiFi module as a remote switch.  It&#8217;s not hard now that I know how it works, but figuring out was quite difficult, as the manual is apparently incorrect and the firmware it shipped with was causing problems.  Read on for the solution!</p>
<p><strong>Hardware</strong></p>
<p>Simple! Here&#8217;s all you need:</p>
<ul>
<li>An <a href="http://www.sparkfun.com/products/8276">XBee breakout board</a> (so you can plug it into your breadboard)</li>
<li>An <a href="http://www.sparkfun.com/products/8687">XBee Explorer</a> (not necessary with ad-hoc mode, but I had one around so this tutorial will use it)</li>
<li>3.3V regulator (ONLY—the module has a 10% tolerance, so anything beyond that will either not work or damage the module).</li>
<li>10µF and 0.1µF capacitors for good measure (clean power is especially important when using radio devices)</li>
<li>Power and Ground (Pins 1 and 10, the top and bottom pins on the left side of the module)</li>
<li>An LED connected to pin 9.  In practice you&#8217;d want to put a current-limiting resistor on it, i.e. 220 ohms, but for a quick test it won&#8217;t matter.  The module only drives 8mA on this pin.</li>
<li>That&#8217;s it!</li>
</ul>
<div><strong>Setup</strong></div>
<div></div>
<div>Although the module has an ad-hoc setup mode, where it broadcasts its own ad-hoc wifi network that you connect to with your computer, I found it faster to just plug it in directly to my computer using a serial adapter such as the XBee Explorer.  When you connect with ad-hoc mode, you talk to the module over telnet, when you use direct serial, you use a serial terminal such as <a href="http://freeware.the-meiers.org/">CoolTerm</a>, which the following instructions will use.</div>
<div></div>
<div>With your module plugged into USB, open up the port in CoolTerm.  You may see some data from the unit or a status message (it&#8217;s ok if you don&#8217;t).  Type $$$ (without hitting return) to enter command mode.  Now you can setup the module&#8217;s wifi settings (hit return after each command):</div>
<div></div>
<pre>set wlan phrase &lt;your wpa password&gt;
set wlan ssid &lt;your ssid&gt;
save
reboot</pre>
<p>&nbsp;</p>
<div></div>
<div>The module will power-cycle and the green status LED will start blinking.  After 5-10 seconds it should start blinking more slowly, which indicates that it has successfully connected to your WiFi network.  If your terminal session is still open, you should see a status message that indicates its success and its IP address (which you&#8217;ll need soon).</div>
<div></div>
<div>Now we need to update the firmware.  Luckily, they made this extremely easy!  Just do this:</div>
<div></div>
<pre>ftp u</pre>
<div></div>
<div>And it will take care of the rest—connecting to the Roving Networks FTP server, downloading the newest firmware image and &#8216;installing&#8217; it.</div>
<div></div>
<div>Once that&#8217;s done, you can transfer your module to your breadboard.  The rest of the work happens over telnet, so make sure your computer and module are connecting to the same WiFi network!  When the module is on your board and it&#8217;s joined your network, open a shell on your computer and do:</div>
<div></div>
<pre>telnet &lt;module's ip address&gt; 2000</pre>
<div></div>
<div>You should see a &#8216;*HELLO*&#8217; message.  Congratulations!  Now you can talk to your breadboarded module from anywhere!  To switch the LED on and off, first set the I/O direction mask:</div>
<div></div>
<pre>set sys mask 0x21f2</pre>
<div></div>
<div>This adds GPIO (General-Purpose Input/Output) Pin 1 (hex 0&#215;2) to the default mask, setting it as an output.  To switch it high, do:</div>
<div></div>
<pre>set sys output 2 2</pre>
<div></div>
<div>Similarly, to switch it low:</div>
<div></div>
<pre>set sys output 0 2</pre>
<div></div>
<div>And that&#8217;s it!  You can now, for instance, have a web server connect directly to that port and issue those commands dynamically to control your hardware remotely.  Try hooking up a relay to switch a house light!</div>
<p><strong>References</strong></p>
<ul>
<li><a href="http://www.rovingnetworks.com/files/resources/WiFly-RN-UM.pdf">RN-XV User Manual</a> (API reference, etc.)</li>
<li><a href="http://www.rovingnetworks.com/files/resources/WiFly-RN-XV-DS.pdf">RN-XV Datasheet</a> (pinout and electrical characteristics)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/using-the-rn-xv-wifi-module-as-a-remote-switch/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Eagle Error: old version of device set is not present in the new version of this device set.</title>
		<link>http://log.liminastudio.com/itp/physical-computing/eagle-error-old-version-of-device-set-is-not-present-in-the-new-version-of-this-device-set</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/eagle-error-old-version-of-device-set-is-not-present-in-the-new-version-of-this-device-set#comments</comments>
		<pubDate>Thu, 10 Nov 2011 19:47:18 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Eagle]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Solution]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=937</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/eagle-error-old-version-of-device-set-is-not-present-in-the-new-version-of-this-device-set' addthis:title='Eagle Error: old version of device set is not present in the new version of this device set. '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Today I was attempting to paste parts of an Eagle schematic I found online into a new schematic, and I was getting the following error message: Package variant PTH1 in the old version of device set RESISTOR is not present in the new version of this device set. This is caused by a library in [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/eagle-error-old-version-of-device-set-is-not-present-in-the-new-version-of-this-device-set' addthis:title='Eagle Error: old version of device set is not present in the new version of this device set. '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Today I was attempting to paste parts of an Eagle schematic I found online into a new schematic, and I was getting the following error message:</p>
<pre>Package variant PTH1 in the old version of device set RESISTOR is not present in the new version of this device set.</pre>
<p>This is caused by a library in the original schematic having some different package definition than the library in the new schematic.  The fix is easy: In the original schematic, go to Library &gt; Update All.  Then you can copy and paste without the error!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/eagle-error-old-version-of-device-set-is-not-present-in-the-new-version-of-this-device-set/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino Serial.print sends numbers instead of letters</title>
		<link>http://log.liminastudio.com/itp/physical-computing/arduino-serial-print-sends-numbers-instead-of-letters</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/arduino-serial-print-sends-numbers-instead-of-letters#comments</comments>
		<pubDate>Wed, 12 Oct 2011 03:04:49 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=934</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/arduino-serial-print-sends-numbers-instead-of-letters' addthis:title='Arduino Serial.print sends numbers instead of letters '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Recently I experienced a somewhat baffling, unexpected problem. I was using a line like: Serial.println('test'); And getting a series of numbers like 25536 instead of the expected text. It turned out the problem was just the use of the &#8216; instead of a &#8220;. Sigh.]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/arduino-serial-print-sends-numbers-instead-of-letters' addthis:title='Arduino Serial.print sends numbers instead of letters '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Recently I experienced a somewhat baffling, unexpected problem. I was using a line like:</p>
<pre>Serial.println('test');</pre>
<p>And getting a series of numbers like 25536 instead of the expected text.  It turned out the problem was just the use of the &#8216; instead of a &#8220;.  Sigh.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/arduino-serial-print-sends-numbers-instead-of-letters/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AVRdude Verification Error Solution</title>
		<link>http://log.liminastudio.com/itp/physical-computing/avrdude-verification-error-solution</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/avrdude-verification-error-solution#comments</comments>
		<pubDate>Wed, 12 Oct 2011 02:22:48 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[avrdude]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=931</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/avrdude-verification-error-solution' addthis:title='AVRdude Verification Error Solution '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;ve been getting an Arduino error like this: avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0007 0xff != 0x7f avrdude: verification error; content mismatch It may be as simple a fix as moving your USB cable from a hub directly to your computer—that fixed it for me! More information: I had [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/avrdude-verification-error-solution' addthis:title='AVRdude Verification Error Solution '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you&#8217;ve been getting an Arduino error like this:</p>
<pre>avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0007
         0xff != 0x7f
avrdude: verification error; content mismatch</pre>
<p>It may be as simple a fix as moving your USB cable from a hub directly to your computer—that fixed it for me!</p>
<p>More information: I had also been getting errors like this from avrdude:</p>
<pre>avrdude: 2 retries during SPI command</pre>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/avrdude-verification-error-solution/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming an ATMega With No Bootloader Using the USBtinyISP</title>
		<link>http://log.liminastudio.com/itp/physical-computing/programming-an-atmega-with-no-bootloader-using-the-usbtinyisp</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/programming-an-atmega-with-no-bootloader-using-the-usbtinyisp#comments</comments>
		<pubDate>Mon, 15 Aug 2011 03:38:09 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[ATMega]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[avrdude]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=914</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/programming-an-atmega-with-no-bootloader-using-the-usbtinyisp' addthis:title='Programming an ATMega With No Bootloader Using the USBtinyISP '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>The title says it all: for my &#8220;Deconspectrum&#8221; installation, I am burning a program onto a bunch of ATMega328 chips using a USBtinyISP (In-System Programmer).  At first I was running into a perplexing problem: the program was running much slower than it should have been.  I could tell immediately because I had a short POST [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/programming-an-atmega-with-no-bootloader-using-the-usbtinyisp' addthis:title='Programming an ATMega With No Bootloader Using the USBtinyISP '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>The title says it all: for my <a href="http://log.liminastudio.com/projects/deconspectrum">&#8220;Deconspectrum&#8221; installation</a>, I am burning a program onto a bunch of ATMega328 chips using a USBtinyISP (In-System Programmer).  At first I was running into a perplexing problem: the program was running much slower than it should have been.  I could tell immediately because I had a short POST (Power-On Self Test) at the beginning of the program that flashes the LED Red-Green-Blue, and it was going far slower than it should have been.<span id="more-914"></span></p>
<p>My first thought was that there was a problem with the ATMega &#8220;fuses,&#8221; which are just settings for various esoteric details of the chip&#8217;s functioning, including clock rate.  But I had never had to bother with them before.  Then I made a further discovery that the only time the program ran correctly was if I installed the Arduino bootloader first and uploaded the program using it.  What gives?</p>
<p>Thanks to the plucky denizens of the ITP Physical Computing list, I learned that indeed, it was a matter of fuses—the Arduino IDE apparently only sets the correct fuses when burning the bootloader, not when burning a program directly using an ISP.</p>
<p>The solution: use avrdude, the program that Arduino uses to actually program the chip behind the scenes, directly.  This turned out to not only solve my problem, but to make the programming process much faster and simpler.  Avrdude takes a &#8220;hex&#8221; file as an input to transfer to the chip, which is the compiled bytecode that the ATMega actually runs.  This way, I only have to compile the program once, and burn it directly—and since I&#8217;m programming about 40 chips, this makes things far faster.</p>
<p>All you need to do is get the <a href="http://www.obdev.at/products/crosspack/index.html">AVR &#8220;CrossPack&#8221;</a> installed (for OSX; for Windows you can use AVR Studio or a number of other packages) and then find your hex file.  In the Arduino IDE, hold Shift while pressing the &#8220;Verify&#8221; button to produce a verbose debug output.  In there you&#8217;ll see a path like this:</p>
<pre>/var/folders/9t/7qf1680d2pqgd0hy6qbfkqsr0000gn/T/build5025172614724793636.tmp/myProgram.cpp.hex</pre>
<p>You can then copy that file to your project directory:</p>
<pre>cp /var/folders/.../myProgram.cpp.hex ~/Projects/myProject/myProgram.cpp.hex</pre>
<p>And program your chip like so:</p>
<pre>avrdude -c usbtiny -p m328p -b 57600 -U flash:w:myProgram.cpp.hex:i -U efuse:w:0x05:m -U hfuse:w:0xde:m -U lfuse:w:0xff:m</pre>
<p>Those settings are for the ATMega328; for the 168 use:</p>
<pre>-p m168</pre>
<p>To get a list of parts, type:</p>
<pre>avrdude -c avrisp</pre>
<p>And there you have it! You&#8217;ll find that this saves a lot of time if you have to program lots of chips. Besides, not using the Arduino bootloader will save a little space on your chip <img src='http://log.liminastudio.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/programming-an-atmega-with-no-bootloader-using-the-usbtinyisp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino: Controlling an RGB LED by Hue</title>
		<link>http://log.liminastudio.com/itp/physical-computing/arduino-controlling-an-rgb-led-by-hue</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/arduino-controlling-an-rgb-led-by-hue#comments</comments>
		<pubDate>Thu, 04 Aug 2011 19:54:08 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[RGB LED]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=902</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/arduino-controlling-an-rgb-led-by-hue' addthis:title='Arduino: Controlling an RGB LED by Hue '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Hooking up an RGB LED to an Arduino isn&#8217;t hard by itself, but controlling it can be—if you know what color you want to display, how do you know what R, G and B values that is? Here&#8217;s some Arduino code, adapted and simplified from Kasper Kamperman, that I am using in my Deconspectrum art [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/arduino-controlling-an-rgb-led-by-hue' addthis:title='Arduino: Controlling an RGB LED by Hue '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Hooking up an RGB LED to an Arduino isn&#8217;t hard by itself, but controlling it can be—if you know what color you want to display, how do you know what R, G and B values that is?</p>
<p>Here&#8217;s some Arduino code, adapted and simplified from <a href="http://www.kasperkamperman.com/blog/arduino/arduino-programming-hsb-to-rgb/">Kasper Kamperman</a>, that I am using in my <a href="http://log.liminastudio.com/projects/deconspectrum">Deconspectrum art installation</a> to do just that:<span id="more-902"></span></p>
<pre>void setLED(int hue, int l){
	int col[3] = {0,0,0};
	getRGB(hue, 255, l, col);
	ledWrite(col[0], col[1], col[2]);
}

void getRGB(int hue, int sat, int val, int colors[3]) {
	// hue: 0-259, sat: 0-255, val (lightness): 0-255
	int r, g, b, base;

	if (sat == 0) { // Achromatic color (gray).
		colors[0]=val;
		colors[1]=val;
		colors[2]=val;
	} else  {
		base = ((255 - sat) * val)&gt;&gt;8;
		switch(hue/60) {
			case 0:
				r = val;
				g = (((val-base)*hue)/60)+base;
				b = base;
				break;
			case 1:
				r = (((val-base)*(60-(hue%60)))/60)+base;
				g = val;
				b = base;
				break;
			case 2:
				r = base;
				g = val;
				b = (((val-base)*(hue%60))/60)+base;
				break;
			case 3:
				r = base;
				g = (((val-base)*(60-(hue%60)))/60)+base;
				b = val;
				break;
			case 4:
				r = (((val-base)*(hue%60))/60)+base;
				g = base;
				b = val;
				break;
			case 5:
				r = val;
				g = base;
				b = (((val-base)*(60-(hue%60)))/60)+base;
				break;
		}
		colors[0]=r;
		colors[1]=g;
		colors[2]=b;
	}
}

void ledWrite(int r, int g, int b){
	analogWrite(LED_RED, 255-r);
	analogWrite(LED_GREEN, 255-g);
	analogWrite(LED_BLUE, 255-b);
}</pre>
<p>This gives you a very straightforward setLED function that takes a Hue from 0-359 and a Lightness from 0-255 (it could easily be adapted to specify the Saturation as well, which I have fixed at the maximum).</p>
<p>Note that the ledWrite function is designed for common-anode LEDs, where the microprocessor is current-sinking instead of sourcing; if you are current-sourcing, just take out the 255-val inversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/arduino-controlling-an-rgb-led-by-hue/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>From Eagle to Printed Circuit Board—Easy Tips</title>
		<link>http://log.liminastudio.com/itp/physical-computing/from-eagle-to-printed-circuit-board%e2%80%94easy-tips</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/from-eagle-to-printed-circuit-board%e2%80%94easy-tips#comments</comments>
		<pubDate>Wed, 27 Jul 2011 22:42:06 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[PCB]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=897</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/from-eagle-to-printed-circuit-board%e2%80%94easy-tips' addthis:title='From Eagle to Printed Circuit Board—Easy Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;ve never gotten a printed circuit board (PCB) manufactured, it&#8217;s pretty daunting at first, but well worth the trouble—it&#8217;s exciting to get a stack of fresh, neat circuit boards of your own design in the mail, and a whole lot more fun than hand-soldering perfboard! I use EAGLE to design my schematics and boards, [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/from-eagle-to-printed-circuit-board%e2%80%94easy-tips' addthis:title='From Eagle to Printed Circuit Board—Easy Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you&#8217;ve never gotten a printed circuit board (PCB) manufactured, it&#8217;s pretty daunting at first, but well worth the trouble—it&#8217;s exciting to get a stack of fresh, neat circuit boards of your own design in the mail, and a whole lot more fun than hand-soldering perfboard!</p>
<p>I use <a href="http://www.cadsoftusa.com/">EAGLE</a> to design my schematics and boards, and now that I&#8217;ve gotten used to its seemingly inscrutable interface, it&#8217;s quite fast and effective.  Here are some tips I&#8217;ve learned:<span id="more-897"></span></p>
<ul>
<li>Get <a href="http://www.opencircuits.com/SFE_Footprint_Library_Eagle">Sparkfun&#8217;s library</a> of common and useful parts, and check out their <a href="http://www.sparkfun.com/tutorials/108">tutorial</a>.  Drop the library in {Applications}/Eagle/lbr.</li>
<li>If you&#8217;re using an external mouse, holding the center button down pans the layout—extremely useful, hard to live without!</li>
<li>Get to know the names of the commands, like &#8216;add&#8217;, &#8216;group&#8217;, &#8216;move&#8217;; and remember that you can type the first couple of letters (&#8216;gro&#8217;) instead of click the button, which is much faster usually.</li>
<li>Moving groups is a bit of a pain; you first define the group by selecting it with the group tool, and then move it as a separate command.  You can right click and choose &#8220;Move Group&#8221; or Command (Ctrl on Windows)-Right Click.</li>
<li>When you are moving a part, right-clicking rotates it.</li>
<li>If you want to put a part on the bottom of your board instead of the top, just middle-click while moving it (or use the Mirror tool).</li>
<li>When adding parts, if you want to search for something, put asterisks around it, like &#8216;*battery*&#8217;, or else you probably won&#8217;t find anything.</li>
<li>Use <a href="http://www.sparkfun.com/tutorial/BeginningEmbedded/9-EaglePCBs/sfe-gerb274x.cam">Sparkfun&#8217;s CAM job</a> to output all the files you need to get boards made.  When I go through <a href="http://4pcb.com">Advanced Circuits</a>, I need these files:</li>
<ul>
<li>.drd, .GBL, .GBO, .GBS, .GTL, .GTO, .GTP, .GTS</li>
</ul>
<li>If you only need 1 or 2 boards, Advanced Circuits offers a &#8220;Student Special&#8221; on Standard Spec boards for $33 each.  Just put &#8220;Student&#8221; in the comments box when you order.</li>
<li>Another great way to get a few boards to test is with <a href="http://www.4pcb.com/index.php?load=content&amp;page_id=132">Barebones</a> boards, which have no solder mask (the green coating) and no silkscreening.</li>
<ul>
<li>This has a slight danger of making it possible to accidentally bridge traces while soldering, but if you&#8217;re careful, it&#8217;s a good savings.</li>
<li>When you get the boards, use a green scrub pad (a soft scouring pad) to get the traces nice and shiny.</li>
<li>You can put text or graphics on a copper layer if you&#8217;ve got the room for it, which is a neat way of making up for the lack of silkscreening!</li>
</ul>
<li>I also found a great way to <a href="http://todbot.com/blog/2011/06/06/from-illustrator-to-eagle-vector-graphics-in-circuits/">use vector images on your circuit board</a>, which I used to put the Limina.Studio logo on my newest project.</li>
<li>Got any other tips or ideas?  Post a comment and I&#8217;ll add them!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/from-eagle-to-printed-circuit-board%e2%80%94easy-tips/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless Projects over the Web: Digi Dia for Hackers Part 1</title>
		<link>http://log.liminastudio.com/itp/physical-computing/wireless-projects-over-the-web-digi-dia-for-hackers</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/wireless-projects-over-the-web-digi-dia-for-hackers#comments</comments>
		<pubDate>Mon, 02 May 2011 21:18:20 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ConnectPort]]></category>
		<category><![CDATA[Digi Dia]]></category>
		<category><![CDATA[xbee]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=836</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/wireless-projects-over-the-web-digi-dia-for-hackers' addthis:title='Wireless Projects over the Web: Digi Dia for Hackers Part 1 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Suppose you want to log data from a group of sensors, like temperatures around the house, or turn lights on and off remotely via a webpage, and you want to do this wirelessly.  You could use a WiFi shield for an Arduino, but they&#8217;re notoriously hard to set up and stay reliably connected. My preferred [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/wireless-projects-over-the-web-digi-dia-for-hackers' addthis:title='Wireless Projects over the Web: Digi Dia for Hackers Part 1 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><div>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/Dia_Schematic.png"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-871" title="Dia_Schematic" src="http://log.liminastudio.com/wp-content/uploads/2011/05/Dia_Schematic-275x300.png" alt="" width="275" height="300" /></a>Suppose you want to log data from a group of sensors, like temperatures around the house, or turn lights on and off remotely via a webpage, and you want to do this wirelessly.  You could use a WiFi shield for an Arduino, but they&#8217;re notoriously hard to set up and stay reliably connected.</p>
<p>My preferred way uses Digi XBee radio modules with the <a href="http://www.digi.com/products/wireless-routers-gateways/gateways/">ConnectPort gateway</a>, which connects a network of XBee modules with a LAN over ethernet.  So far, easy: build your microcontroller project that sends and receives data via an XBee ZigBee module (using &#8220;Series 2&#8243; hardware), and the ConnectPort is your mesh&#8217;s coordinator.</p>
<p>Then the question becomes how to send and receive the data from the coordinator.  If you had the coordinator plugged into a computer, you could write an interface however you liked.  Lucky for us, the ConnectPort is basically a tiny computer that runs Python!  So how do you access your project&#8217;s data via the ConnectPort over the web?<span id="more-836"></span>There are two overall approaches: transmit to another webserver, or use the ConnectPort as a webserver itself.  XBee fiend <a href="http://www.faludi.com/">Rob Faludi</a> and I developed a handy way to do the first approach, called the <a href="http://code.google.com/p/xig/">XBee Internet Gateway</a> (XIG), and Digi mastermind Jordan Husney vastly improved it.</p>
<p>XIG&#8217;s one ability is simple but hugely useful: it allows your Arduino to retreive a URL from the Internet.  Say you&#8217;re collecting temperatures from sensors via your microcontroller.  With XIG, you can post the values to a web script on a server somewhere by sending this string to the ConnectPort: &#8220;http://my.server.com/myscript.php?val1=6&amp;val2=10&amp;etc=etc&#8221;.  Your script can then optionally return some string for your Arduino to parse and use.</p>
<p>This is fast, easy, and effective!  Its only downside is that you need an external webserver to get the data moving.  For many of us, this is no problem, but wouldn&#8217;t it be nice to cut out the middleman?</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/Screen-shot-2011-05-02-at-5.03.53-PM.png"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-870" title="Screen shot 2011-05-02 at 5.03.53 PM" src="http://log.liminastudio.com/wp-content/uploads/2011/05/Screen-shot-2011-05-02-at-5.03.53-PM-300x92.png" alt="" width="300" height="92" /></a>Enter Digi&#8217;s <a href="http://www.digi.com/wiki/developer/index.php/IDigi_Dia_Wiki">Dia platform</a>.  Dia (Device Integration Application) is a Python program that runs on the ConnectPort that talks to your XBees and—the important part—runs its own web server so you can talk directly to the ConnectPort instead of using an external web server.</p>
<p>Now, Dia is a fairly new platform, and definitely designed for engineers more than hackers like ourselves.  So I did a deep dive into the platform recently and have brought the results to you!  Stay tuned for the next part!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/wireless-projects-over-the-web-digi-dia-for-hackers/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Easy programming for breadboard Arduinos</title>
		<link>http://log.liminastudio.com/itp/physical-computing/easy-programming-for-breadboard-arduinos</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/easy-programming-for-breadboard-arduinos#comments</comments>
		<pubDate>Mon, 02 May 2011 17:55:57 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[arduino]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=838</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/easy-programming-for-breadboard-arduinos' addthis:title='Easy programming for breadboard Arduinos '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;ve never made a breadboard Arduino, you really ought to try it (I have a quick tutorial)—you&#8217;ll suddenly discover that you rarely need an actual (and expensive) Arduino anymore.  The Arduino is built around the Atmel ATmega microprocessor, which you can buy from various places for roughly only $4-5! However, there are a few [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/easy-programming-for-breadboard-arduinos' addthis:title='Easy programming for breadboard Arduinos '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0728.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-850" title="Breadboard Arduino + Programming Board" src="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0728-300x224.jpg" alt="" width="300" height="224" /></a>If you&#8217;ve never made a breadboard Arduino, you really ought to try it (<a href="http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun">I have a quick tutorial</a>)—you&#8217;ll suddenly discover that you rarely need an actual (and expensive) Arduino anymore.  The Arduino is built around the Atmel ATmega microprocessor, which you can buy from various places for roughly only $4-5!</p>
<p>However, there are a few things about it that aren&#8217;t obvious at first, such as how to connect it to your computer via USB and make it programmable.<br />
<span id="more-838"></span> First off, be sure that your ATmega chip has the Arduino bootloader on it.  If you bought it from a major supplier such as Mouser or Digi-Key, it does not have the bootloader.  Sparkfun (among others) sells them with bootloaders.</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0720.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-855" title="Programming Header" src="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0720-300x224.jpg" alt="" width="300" height="224" /></a>Second, you&#8217;ll need an <a href="http://www.sparkfun.com/products/9873">FTDI USB breakout board</a>.  This connects to the TX and RX serial pins on the microprocessor and supplies a USB interface and firmware that your computer can recognize and use.  You&#8217;ll need the FTDI drivers for your system, which come with the Arduino software.</p>
<p>Third: the real work.  You need to connect some pins from the USB board to your breadboard:</p>
<ul>
<li>GND</li>
<li>TX</li>
<li>RX</li>
<li>DTR</li>
<li>Optional: 5V (if your breakout board supplies it)</li>
</ul>
<p>As you can see in the photo, I soldered up a handy little header so I can plug it right into a breadboard.  The serial pins are connected like so: TX→RX, RX→TX.  DTR is connected to a .1µF capacitor that goes to the RESET pin on the ATmega (pin 1).  That pin must also be connected to +5V via a 10kΩ resistor.</p>
<p>The DTR pin is the secret sauce: it pulls the reset pin down, which the Arduino bootloader requires to be programmed.  If you didn&#8217;t have this, you&#8217;d have to reset it by hand.  This way, it&#8217;s completely automatic, just like a regular Arduino board.</p>
<p>Let me know if this works for you!  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/easy-programming-for-breadboard-arduinos/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Breadboard Arduino: Fast, Cheap and Fun</title>
		<link>http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun#comments</comments>
		<pubDate>Mon, 02 May 2011 17:34:15 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[arduino]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=849</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun' addthis:title='Breadboard Arduino: Fast, Cheap and Fun '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;ve been enjoying making stuff with the Arduino, but don&#8217;t want to buy more Arduino boards just to make a new project, fear not—you don&#8217;t need them! The Arduino board is just a convenient wrapper around the ATmega microprocessor, and it&#8217;s easy to recreate on a breadboard.  Here&#8217;s what you&#8217;ll need: ATmega328 (with Arduino [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun' addthis:title='Breadboard Arduino: Fast, Cheap and Fun '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you&#8217;ve been enjoying making stuff with the Arduino, but don&#8217;t want to buy more Arduino boards just to make a new project, fear not—you don&#8217;t need them!</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0731.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-851" title="Breadboard Arduino" src="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0731-224x300.jpg" alt="" width="224" height="300" /></a>The Arduino board is just a convenient wrapper around the ATmega microprocessor, and it&#8217;s easy to recreate on a breadboard.  Here&#8217;s what you&#8217;ll need:<br />
<span id="more-849"></span></p>
<ul>
<li><a href="http://www.sparkfun.com/products/10524">ATmega328</a> (with Arduino bootloader)</li>
<li><a href="http://www.sparkfun.com/products/107">5V regulator</a> (i.e. L7805)</li>
<li><a href="http://www.sparkfun.com/products/8375">.1µF capacitor</a> (the little yellowish disc kind that says &#8220;104&#8243; on it)</li>
<li><a href="http://www.sparkfun.com/products/9420">16mhz resonator</a></li>
<li>10kΩ resistor</li>
<li>&gt;5V power supply (can be any power supply you have, such as wall-warts, since we&#8217;re using our own regulator)</li>
<li>Optional: <a href="http://www.sparkfun.com/products/9716">FTDI USB breakout board</a> (for programming from a computer)</li>
</ul>
<p>The bootloader is what makes the microprocessor easy to program with the Arduino environment.  You can also buy ATmegas <a href="http://www.sparkfun.com/products/9061">without the bootloader</a> for about a dollar cheaper, but they must have the bootloader manually loaded on to use Arduino.</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0728.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-850" title="Breadboard Arduino + Programming Board" src="http://log.liminastudio.com/wp-content/uploads/2011/05/IMG_0728-300x224.jpg" alt="" width="300" height="224" /></a>The resonator is a handy package that combines a crystal, which is where the microprocessor gets its clock signal from, and two capacitors, so all you have to do is plug it into the ATmega.</p>
<p>If you have an ATmega that&#8217;s already loaded with your program, you can just build this board as-is without the capacitor and leave pin 1 (RESET) connected to +5V via the 10k &#8220;pull-up&#8221; resistor.  You can even program a chip on an Arduino, remove it and plug it into your breadboard setup.</p>
<p>The one part remaining that I haven&#8217;t mentioned is the programming header I made, on the top right of the top photo (fully visible in the second photo).  This connects to the FTDI USB board I describe in my <a href="http://log.liminastudio.com/uncategorized/easy-programming-for-breadboard-arduinos">easy breadboard Arduino programming tutorial</a>.  The pins are, from top to bottom: Ground (Black), RX (White), TX (Green), DTR (Yellow).</p>
<p>Lastly, though not pictured here, it is good practice to use decoupling capacitors on your power supply to protect your microcontroller from any irregularities, as described in <a href="http://www.sparkfun.com/tutorials/57">this tutorial</a> (a few pages down).</p>
]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/breadboard-arduino-fast-cheap-and-fun/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

