<?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>NoMi DESIGN</title>
	<atom:link href="http://n0m1.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://n0m1.com</link>
	<description>Making good things happen...</description>
	<lastBuildDate>Tue, 05 Mar 2013 03:23:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Writing Your Own Arduino Libraries</title>
		<link>http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=writing-your-own-arduino-libraries</link>
		<comments>http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/#comments</comments>
		<pubDate>Thu, 17 May 2012 08:44:08 +0000</pubDate>
		<dc:creator>Socialhardware</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[How to]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1089</guid>
		<description><![CDATA[Here at Nomi Design we have a fair amount of experience writing Arduino Libraries. So we thought we would share with the world our techniques for writing code into  simple , clean, and easy to use Arduino Libraries. First of the question &#8230; <a href="http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/04/arduino-library2.jpg"><img class="alignleft size-full wp-image-1216" title="arduino library" src="http://n0m1.com/wp-content/uploads/2012/04/arduino-library2.jpg" alt="" width="1024" height="260" /></a></p>
<p>Here at Nomi Design we have a fair amount of experience writing Arduino Libraries. So we thought we would share with the world our techniques for writing code into  simple , clean, and easy to use Arduino Libraries.</p>
<p>First of the question that most people have is, &#8220;why bother?&#8221; Honestly you don&#8217;t ever need to write an arduino library. You could just dump all your code into a long sketch and be done with it. However writing an Arduino library allows for easier reuse and a chance to share your knowledge with the rest of the Arduino community. By wrapping up your code in a library others can access and build upon your hard work. Doesn&#8217;t that give you a warm fuzzy feeling?</p>
<p>Lets assume you have already written a sketch that interfaces with some sensor or device,  its working perfectly so you are now ready to share that knowledge with the world, so you decide to rewrite your sketch into an Arduino library.</p>
<p>The first step that I do is to actually write the most basic example sketch for the library. I consider this a planing step, kind of like story boarding before a film shoot. I write an example sketch first in order to plan how I want people to use my library. I later work backwards from this example sketch to make the library itself. This sounds counter intuitive but it allows you to first envision the clearest way for people to interface with the library. By writing your ideal interface first, you can then work to design the library to match. Sometimes you are not able to write the library to totally match but you can at least try for as close a match as you can. If you were to start the library first, there is a good chance you would make an overly complex and hard to use library.</p>
<p>Lets say this is my envisioned example sketch. I want people to interface with my new exampleLib in this manner:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">#include "ExampleLib.h"

//the constructor
ExampleLib exLib

void setup(){

   exLib.begin(); //initialize
}

void loop(){

  exLib.update(); //update every loop

}</pre>
<p>So by looking at this example I see that my Arduino Library will need an constructor (they always do). A begin() function to setup the library, and an update() function to poll my sensor and do some calculations or something every loop cycle. Now this is my ideal interface. There is a good chance I am going to need to pass in some data, or perhaps set or get some flags inside the library at the very least.  If there is something you know you need to do from the sketch, you should write it in now and try to make this as realistic and close to your final interface as possible.</p>
<p>The next step is to go ahead and start to write your library. The first thing to realize about an Arduino Library is that they are made of at least one, possibly many C++ classes. A common misconception about Arduino is that the Arduino language is based on Java, or it has its own language.  The reality is, the Arduino is made from nothing but a loose collection of C/C++ functions and objects.  I know this probably feels like the time your older brother told you Santa isn&#8217;t real, but those are the facts. To their credit though, the Arduino team do a pretty good job of hiding this from Arduino users, which is probably the reason why the Arduino became so popular. C/C++ especially for the AVR can be pretty intimidating to a new coder. So since an Arduino Library is made from C++ classes, the first thing to do is to actually write a C++ class. To do so you first create 2 files, the .h file and the .cpp file.</p>
<p>In the .h file you can write out the basic outline of a class, basically an easily readable class blueprint. Which is always setup about the same way:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">//include guard
#ifndef EXAMPLE_LIB_H
#define EXAMPLE_LIB_H

//Start of the class
class ExampleLib {

public: //everything under here is public, accessible outside of the class
//the class constructor
ExampleLib();
void begin();
void update();

private: //everything under here is private, only accessible inside the class
  int pollSensor();
  int fancyAlgorithm(int inputData);

}; //end of class

#endif
//include guard end if</pre>
<p>The next step is to start writing your .cpp file. The .cpp file is where all the &#8220;action&#8221; takes place. In your .cpp we will include the .h file and write the body of each function and the Constructor like so:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">#include "ExampleLib.h"

//the constructor
ExampeLib::ExampleLib(){

}

//the body of begin function
void ExampleLib::begin(){
   //setup your sensor here,for example
}

//the body of the update function
void ExampleLib::update(){
  int data =  pollSensor();
  int result = fancyAlgorithm(data);
}
int ExampleLib::pollSensor(){
  //analogRead or something
}
int ExampleLib::fancyAlgorithm(int inputData){
//some complex stuff
}</pre>
<p>The first thing you might ask yourself about this, is what is this &#8220;ExampleLib::&#8221; nonsense? What this  is a way to tell the compiler that this function is inside of the ExampleLib class. Without the ExampleLib:: before the function name the compiler would think this is  a function that exists outside of the ExampleLib class. In other words just because its in the ExampleLib.cpp file doesn&#8217;t mean its actually inside the class. If you were a really messy programmer you could dump all kinds of random outside functions in this file, or have multiple classes in this file. Sometimes people do just that, so its always good to pay attention and check that each function is part of the class you think its should be part of. In the .cpp file you will notice there is no way to tell if a function is public or private, they are all just lumped together in the .cpp. If you want to know which function is which you should refer to your &#8220;design plan&#8221; the .h file. Speaking of which, what is public and private exactly anyway? Basically public functions and variables are things that you can access outside of the class. Like So:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">exLib.update(); //the update function is public so we can use it in our sketch.
exLib.xVarible; //a public variable, can also be accessed directly in the sketch.</pre>
<p>If you tried to do the same thing with a private function, the compiler would complain. So if we write:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">exLib.fancyAlgorithm(data); //this will fail, you will get a compiler error</pre>
<p>You can however call this function from inside your ExampleLib class. So for example inside the update() function we can call fancyAlgorithm() and it works. Private functions are primarily used just to hide some of the complexity of a library and to prevent users from calling functions that would not make sense to call from outside the library.</p>
<p>So thats pretty much the basics of writing an Arduino library. Once its all written you just need to go ahead and place it in your libraries folder inside a folder with the name of your library. For example libraries/ExampleLib/ExampleLib.h If you are going to share this library with the rest of the world, you should probably also write up some examples so others can easily learn how use your library. Since you already wrote a sketch during your planning of the library you can just finish and test it and you have an example!</p>
<p><strong>Advanced tip:</strong>  If you write a library that consists of many .h and .cpp files you may be tempted to place some of them inside of subfolders. The problem is you can&#8217;t, since the Arduino IDE will not notice these cpp files and they will not be compiled or linked to your program. However there is a small trick you can do to get this to work. You can place all your extra .h and .cpp files inside a folder called utility. So for example. Libraries/ExampleLib/ExampleLib.h this is your main library .h file. So when you include your library you just need to type: #include &#8220;ExampleLib.h&#8221;. Then you can place the rest of your library class files inside the utility folder like so: Libraries/ExampleLib/utility/ExtraStuff.h and #include them into your ExampleLib.h this way: #include &#8220;utility/ExtraStuff.h&#8221;. This way if your library is made of 20 different cpp files you don&#8217;t need to have the user include them all into their sketch. They just need to include 1 file which is your library header file.</p>
<p>Well that should get you started writing your own Arduino Libraries. I am including the example library here, so you can use it as a template. <strong> <a href="http://n0m1.com/?attachment_id=1456">Download </a></strong></p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/" data-text="Writing Your Own Arduino Libraries"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F05%2F17%2Fwriting-your-own-arduino-libraries%2F&amp;title=Writing%20Your%20Own%20Arduino%20Libraries" id="wpa2a_2">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/05/17/writing-your-own-arduino-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>M&#8217;Day: Low Power Motion Sensor Arduino Night Light&#8230;</title>
		<link>http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mday-low-power-motion-sensor-arduino-night-light</link>
		<comments>http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/#comments</comments>
		<pubDate>Sun, 13 May 2012 04:01:16 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Battery]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[Low power]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1415</guid>
		<description><![CDATA[A few years back I made a motion sensitive night light as a Mother&#8217;s day gift and while it worked pretty well it really chewed out the batteries.  And as with all devices that eat batteries it eventually fell out &#8230; <a href="http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A few years back I made a motion sensitive night light as a <a href="http://en.wikipedia.org/wiki/Mother%27s_Day" target="_blank">Mother&#8217;s day</a> gift and while it worked pretty well it really chewed out the batteries.  And as with all devices that eat batteries it eventually fell out of use.  The standby current was around 4 mA due to the common LM324 opamp that was used to amplify the PIR motion sensor signal.  The original enclosure was CNC milled from a bit of re-purposed apple which had a former life as a guitar body I built as a child.  Apple happens to be my favorite wood, it&#8217;s rich and creamy and the project just needed some new electronic guts:<a href="http://n0m1.com/wp-content/uploads/2012/05/CNC-milled-finger-joint-Arduino-Motion-Light.jpg"><img class="alignnone size-full wp-image-1440" title="CNC milled finger joint Arduino Motion Light" src="http://n0m1.com/wp-content/uploads/2012/05/CNC-milled-finger-joint-Arduino-Motion-Light.jpg" alt="" width="1024" height="400" /></a></p>
<p>The new variant sports a TLC1079 micropower quad opamp from <a href="http://www.ti.com/product/tlc1079" target="_blank">TI</a> that draws just 150 microwatts per channel.  It also received  an upgrade from a Tiny13 to a Mega328p allowing for a custom Arduino bootloader spec&#8217;d for operation at 1MHz.  The upload speed was set at 62500 baud as this worked out best with the internal 8Mhz RC oscillator divided by 8.  As can be seen in the schematic below, the entire circuit forgoes a regulator and runs directly from battery.  It also includes a CDS to sense the light, a pair of RGB LEDs switched with 3 P-channel FETs and a 6 pin port to connect a USB to serial converter.  Note the DC blocking 4.7uF capacitor, non-polarized ceramic or polypropylene works best, all other parts are standard fare.  Click to view a larger image:<a href="http://n0m1.com/wp-content/uploads/2012/05/low-power-PIR-Arduino-RGB-Schematic.png"><img class="alignnone size-full wp-image-1432" title="low power PIR Arduino RGB Schematic" src="http://n0m1.com/wp-content/uploads/2012/05/low-power-PIR-Arduino-RGB-Schematic.png" alt="" width="2394" height="518" /></a></p>
<p>After the circuit was prototyped on a <a href="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/">breadboard Arduino</a>, it was moved to a piece of predrilled strip board for quick assembly.  Not shown are the P-channel FETS which are on the original RGB LED board under copious amounts of hot glue for diffusional purposes.  The LED PCB was originally made with the toner transfer method but strip board would have sufficed just as well.  The Red PCB holding the PIR sensor had a previous life as a <a href="https://triggertrap.com/" target="_blank">TriggerTrap</a> motion sensor, there are a few components under the dome as well.  Here is the circuit board with a bit of heatshrink keeping all the arms and legs inside:<a href="http://n0m1.com/wp-content/uploads/2012/05/PIR-low-power-Arduino-motion-Light.jpg"><img class="alignnone size-full wp-image-1436" title="PIR low power Arduino motion Light" src="http://n0m1.com/wp-content/uploads/2012/05/PIR-low-power-Arduino-motion-Light.jpg" alt="" width="1024" height="367" /></a>It&#8217;s been bench tested from 5 volts down to 2.7 volts and at a nominal battery voltage of 4.5 volts, it draws just 0.08 mA in sleep mode.  This equates to over 3 years of standby from a triple set of AA batteries.  Motion detection is quite good at over 5 meters and it&#8217;s more than what&#8217;s required to keep Mom from tripping up if she gets up for a night time stroll.</p>
<p>Programming was done in the Arduino IDE and the <a href="https://github.com/n0m1/Sleep_n0m1" target="_blank">n0m1 sleep library</a> was used to shut down the microcontroller for power saving.  The device wakes from slumber when either of the external interrupts are triggered, the light sensor triggers interrupt 1 and the motion sensor triggers interrupt 0.  The code itself is very simple, the light sensor sets the mode and if the mode is nighttime, the motion sensor triggers the RGB LEDs to cycle through a color gradient using the <a href="http://n0m1.com/2012/01/27/colorbabel-hue-to-rgb-do-you-copy/" target="_blank">Hue to RGB</a> conversion code.  As can be seen in the following video, it takes about 10 triggers to get all the way through the gradient as each trigger shows just one primary color and a bit of secondary color:<br />
<iframe src="http://www.youtube.com/embed/T0-zNYG0B0U?rel=0" frameborder="0" width="640" height="360"></iframe></p>
<p>The Arduino sketch, schematic, custom bootloader and boards entry are neatly wrapped up in the following RAR: <a href="http://n0m1.com/wp-content/uploads/2012/05/n0m1.com-Arduino-PIR-Night-Light.rar">n0m1.com Arduino PIR Night Light</a><br />
And the n0m1 sleep library can be found here: <a href="https://github.com/n0m1/Sleep_n0m1" target="_blank">https://github.com/n0m1/Sleep_n0m1</a><br />
Happy Mother&#8217;s Day Mom!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/" data-text="M&#8217;Day: Low Power Motion Sensor Arduino Night Light&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F05%2F13%2Fmday-low-power-motion-sensor-arduino-night-light%2F&amp;title=M%E2%80%99Day%3A%20Low%20Power%20Motion%20Sensor%20Arduino%20Night%20Light%E2%80%A6" id="wpa2a_4">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/05/13/mday-low-power-motion-sensor-arduino-night-light/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SuperDuplex: An InfraRed Bootloader for Arduino&#8230;</title>
		<link>http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=superduplex-an-infrared-bootloader-for-arduino</link>
		<comments>http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/#comments</comments>
		<pubDate>Mon, 07 May 2012 03:53:31 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Communication]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Infra Red]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1281</guid>
		<description><![CDATA[We&#8217;ve implemented an optical infrared Arduino bootloader based on the common 38kHz infrared remote modualtion.  Using the Asuro as inspiration, our bootloader goes a step further in that it works seamlessly from within the Arduino IDE, utilizing the STK500V2 protocol &#8230; <a href="http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We&#8217;ve implemented an optical infrared Arduino bootloader based on the common 38kHz infrared remote modualtion.  Using the Asuro as inspiration, our bootloader goes a step further in that it works seamlessly from within the Arduino IDE, utilizing the STK500V2 protocol without modification.  <a href="http://n0m1.com/wp-content/uploads/2012/05/Arduino-Optical-IR-Bootloader.jpg"><img class="alignnone size-full wp-image-1373" title="Arduino Optical IR Bootloader" src="http://n0m1.com/wp-content/uploads/2012/05/Arduino-Optical-IR-Bootloader.jpg" alt="" width="1024" height="435" /></a></p>
<p>As described in detail below, due to hardware specifics and a low carrier frequency, the maximum data rate is 4200 baud and in practice about 4k baud reliably without error.  While not amazingly fast, this results in about 1 min 30 seconds to transfer a moderately large Arduino sketch of 20kb.  With the sketch loaded, the IR hardware also functions as a bidirectional half duplex serial link.  As itemized in the following list, the project as a whole is the sum of it&#8217;s parts:</p>
<blockquote>
<ul>
<li>Echo Cancellation Simplex</li>
<li>Continuous Demodulation</li>
<li>Demodulator Phase Delay</li>
<li>USB Transceiver (Software)</li>
<li>USB Transceiver (Hardware)</li>
<li>Arduino IR Transceiver</li>
<li>Arduino Bootloader</li>
<li>Board Specifications</li>
</ul>
</blockquote>
<p><strong>Echo Cancellation Simplex</strong><br />
If you&#8217;ve ever talked to someone on speakerphone and heard your own echo, you can understand the confusion this creates.  This is the issue when adapting the normally full-duplex USB converter to infrared communication, while transmitting the reflected infrared bitstream is also being heard and it stuffs up the receive buffer like a bad head cold.  To make the bootloader work seamlessly with the Arduino IDE over modulated infrared, full duplex serial operation is blocked, this is achieved on both sides with software and/or hardware.</p>
<p><strong>Continuous Demodulation</strong><br />
Almost all infrared receivers found in home appliances have an automatic gain control (AGC) circuit to account for variations in signal strength as well as ambient interference from fluorescent lights.  If your lucky, the datasheet for the part will state the maximum duty cycle for data transmission before the AGC normalizes the signal and kills the output.  From testing it appeared to be less than 5%, which is much too low to send appreciable amounts of data within a reasonable time frame.<a href="http://n0m1.com/wp-content/uploads/2012/05/ir-demodulator.jpg"><img class="alignnone size-full wp-image-1356" title="ir demodulator" src="http://n0m1.com/wp-content/uploads/2012/05/ir-demodulator.jpg" alt="" width="1024" height="213" /></a>Ideally we want the AGC to allow a bit over 50% or no AGC at all.  Infrared demodulators without AGC are not common but thankfully, they do exist.  Besides being specifically purposed for high volume data transmission, they also find use in sensing and light barrier systems.  A couple of these devices are the TSOP58038 and the TSOP4038 from <a href="http://www.vishay.com/ir-receiver-modules/" target="_blank">Vishay</a>.</p>
<p><strong>Demodulator Phase Delay</strong><br />
To reject ambient noise, the infrared data is modulated with a 38kHz carrier frequency, a digital one is represented as a tone and a digital zero as no tone.  When the demodulator sees the correct carrier frequency,  it outputs a digital one.  Inside the demodulator, the detection process is implemented in analog as a band pass filter and requires about 7 carrier waves to pass before it reports on the output.  It is this requirement that introduces as phase response delay of about 200 microseconds and which can be seen in the following signal capture of the transmission &#8220;Hello World&#8221;: <a href="http://n0m1.com/wp-content/uploads/2012/05/IR-demodulator-phase-delay1.png"><img class="alignnone size-full wp-image-1337" title="IR demodulator phase delay" src="http://n0m1.com/wp-content/uploads/2012/05/IR-demodulator-phase-delay1.png" alt="" width="960" height="210" /></a>The red signal is the 38kHz modulated send and yellow is the demodulated receive signal.  The received signal is phase shifted right a full bit width (200us), resolution is at 1ms per division.</p>
<p><strong>USB Transceiver (Software)</strong><br />
For simplicity the computer side transceiver was first implemented in software with a spare Arduino and an IR shield.  A 120 ohm resistor is used to hold the Arduino&#8217;s reset pin high, preventing the transceiver from resetting.  It&#8217;s implemented using pinChange interrupt as a bit bang pass though, with the condition that when transmitting, the receiver is ignored.  As TTL serial signals are active low and the IR LED is active high, the transmission component is inverted.<a href="http://n0m1.com/wp-content/uploads/2012/05/IR-shield-and-truth-table.jpg"><img class="alignnone size-full wp-image-1359" title="IR shield and truth table" src="http://n0m1.com/wp-content/uploads/2012/05/IR-shield-and-truth-table.jpg" alt="" width="1024" height="309" /></a>The Arduino, the IR shield and the logical truth table to make sense of it all.</p>
<p><strong>USB Transceiver (Hardware)</strong><br />
Once the transceiver was proven in software, the design was moved into the hardware space.  This presented a couple of challenges in that the aforementioned phase delay made a logical OR difficult.  The solution was to implement a similar or longer delay on the TX line OR input.  As can be seen in the following schematic, this is implemented with a 100nF capacitor and 4k7 resistor, click for pops:  <a href="http://n0m1.com/wp-content/uploads/2012/05/discrete-PC-side-USB-IR-transceiver.png"><img class="alignnone size-full wp-image-1342" title="discrete PC side USB IR transceiver" src="http://n0m1.com/wp-content/uploads/2012/05/discrete-PC-side-USB-IR-transceiver.png" alt="" width="1673" height="417" /></a></p>
<p>The phase delay arrangement turns on quickly and turns off slowly,  adding about 2 milliseconds to block the receiver while transmitting using a bit of transistor logic.  As the signals are active low and the TX line is inverted, the gate function required for RXD is the logical OR between inverted TX and the demodulator output (refer to truth table for clarification).</p>
<p><strong>Arduino IR Transceiver</strong><br />
On the Arduino side, all that is required for additional hardware is a demodulator and an IR LED, this makes for a very cheap Arduino sans FT232R converter.  The demodulator is connected directly to the Arduino UART receiver (Pin 0).  The IR LED connection takes inspiration from the Asuro bootloader, the LEDs anode is fed with a 38kHz PWM from Pin3 while the cathode is connected to Arduino Pin1, the UART Transmitter.  As TTL serial is active low, the LED lights with the 38kHz carrier when commanded by the UART.<a href="http://n0m1.com/wp-content/uploads/2012/05/Arduino-with-IR-bootloader.png"><img class="alignnone size-full wp-image-1365" title="Arduino with IR bootloader" src="http://n0m1.com/wp-content/uploads/2012/05/Arduino-with-IR-bootloader.png" alt="" width="1690" height="552" /></a>This schematic has been setup on a bread board Arduino, the basics which have been detailed in the previous post here: <a href="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/">http://n0m1.com/2012/04/30/how-to-bread-board-arduino/</a></p>
<p><strong>Arduino Bootloader </strong><br />
The existing bootloader was modified for half duplex by turning off the receiver while transmitting, 38kHz PWM was setup and some delay was added to handle the phase offset of the demodulator.  Prior to making changes, some effort was required to successfully compile the bootloader as documented here: <a href="http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/">http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/</a></p>
<p>When uploading the IDE checks for the existence of the bootloader, so the hex, source and makefile need to be in the folder here: arduino-1.0\hardware\arduino\bootloaders\IRbbArduino\.  The source, hex and makefile can be downloaded here: <a href="http://n0m1.com/wp-content/uploads/2012/05/IRbbArduino.rar">IRbbArduino</a>.</p>
<p><strong>Board Specifications</strong><br />
The final bit of the puzzle is to let the Arduino IDE know who we are talking to.  We add a few lines of text to the end of the boards.txt file in \arduino-1.0\hardware\arduino\.  As seen below, it defines who, what and how we are talking.  The IDE must be restarted for these changes to apply:</p>
<pre class="brush: actionscript3; gutter: true; first-line: 1">##############################################################
bbArduino.name=BreadBoard Arduino328 16MHz w/IR Bootloader@2400
bbArduino.upload.protocol=arduino
bbArduino.upload.maximum_size=30720
bbArduino.upload.speed=2400
bbArduino.bootloader.low_fuses=0xc6
bbArduino.bootloader.high_fuses=0xdd
bbArduino.bootloader.extended_fuses=0x00
bbArduino.bootloader.path=IRbbArduino
bbArduino.bootloader.file=ATmegaBOOT_168_atmega328ir.hex
bbArduino.bootloader.unlock_bits=0x3F
bbArduino.bootloader.lock_bits=0x0F
bbArduino.build.mcu=atmega328p
bbArduino.build.f_cpu=16000000L
bbArduino.build.core=arduino
bbArduino.build.variant=standard</pre>
<p><strong>Video</strong><br />
Of course no post would be complete without a video of the bootloader in action.  The autoreset feature has yet to be implemented but will include a line in the sketch to signal a reset vector on command.  For now it&#8217;s reset manually or with power on, there is about a 2 second window in which it must be reset after the IDE indicates uploading.<br />
<iframe src="http://www.youtube.com/embed/hhBlUWy1W_8?rel=0" frameborder="0" width="640" height="480"></iframe></p>
<p>As per requested in comments below, here is the code for the PC side software transceiver which runs on an Arduino.<br />
Don&#8217;t forget to disable reset with a 120 ohm pullup, otherwise the Arduino will bootload instead of passing the data along to IR.<br />
&nbsp;</p>
<pre class="brush: c; gutter: true; first-line: 1">/*
 n0m1 IR bootloader PC side, software based bitbang pass through

http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/

 by krazatchu &amp; socialhardware - 2012/05/07

 IR Demodulator on pin 2
 IR LED on pin 3 with NPN inversion

 PC TXD on pin 1
 PC RXD on pin 0

 Reset pullup/disable using 120 ohm resistor
 Optional Red LED indictor on A1/A4
*/

#include &lt;PinChangeInt.h&gt;
boolean SerialRX = false;

void setup() {
  // dont use serial - bitbang output by turning pwm off and on

  // onboard Red LED indicator
  pinMode(A1, OUTPUT); // LED Anode
  pinMode(A4, OUTPUT); // LED Cathode

  // Disable the Timer2 Interrupt (which is used for receiving IR)
  TIMSK2 &amp;= ~_BV(TOIE2); //Timer2 Overflow Interrupt

  pinMode(3, OUTPUT); // IR TXT PWM
  digitalWrite(3, LOW); // IR TXT PWM

  // COM2A = 00: disconnect OC2A
  // COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
  // WGM2 = 101: phase-correct PWM with OCRA as top
  // CS2 = 000: no prescaling
  TCCR2A = _BV(WGM20);
  TCCR2B = _BV(WGM22) | _BV(CS20);

  // The top value for the timer.  Mod frequency will be SYSCLOCK/2/OCR2A.
  OCR2A = 210; // SYSCLOCK / 2 / khz / 1000; = 16M /2 /38 /1000 = 210.526
  OCR2B = OCR2A / 3; // 33% duty cycle

  pinMode(0, INPUT); // Serial receiver 
  PCintPort::attachInterrupt(0, serialRXDoff, RISING);
  PCintPort::attachInterrupt(0, serialRXDon, FALLING);

  pinMode(1, OUTPUT); // serial out
  digitalWrite(1, HIGH); // 
  pinMode(2, INPUT); // IR RXR1 38kHz
  PCintPort::attachInterrupt(2, serialTXDoff, FALLING);
  PCintPort::attachInterrupt(2, serialTXDon, RISING);

}

void loop() {
 // do nothing, let interupts work
}

void serialRXDon (){
	// turn pwm on - PIN3  
	SerialRX = true;
	// or switch to in/out
	TCCR2A |= _BV(COM2B1);
	// blink (300); 
}

void serialRXDoff (){
    // turn pwm off - PIN3  
    TCCR2A &amp;= ~(_BV(COM2B1)); 
    // digitalWrite(3, LOW);
    PORTD &amp;= ~ (1&lt;&lt;PORTD3);
    SerialRX = false;
}

void serialTXDon (){
    // turn on FTDI RXD
    if(SerialRX == false){
        // led on
		PORTC &amp;= ~(1&lt;&lt;PORTC1);
        PORTD |= (1&lt;&lt;PORTD1); 
	}
}

void serialTXDoff (){
	// turn off FTDI RXD
	if(SerialRX == false){
		// led off
		PORTC |= (1&lt;&lt;PORTC1);
		PORTD &amp;= ~(1&lt;&lt;PORTD1);
	}
}</pre>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/" data-text="SuperDuplex: An InfraRed Bootloader for Arduino&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F05%2F07%2Fsuperduplex-an-infrared-bootloader-for-arduino%2F&amp;title=SuperDuplex%3A%20An%20InfraRed%20Bootloader%20for%20Arduino%E2%80%A6" id="wpa2a_6">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/05/07/superduplex-an-infrared-bootloader-for-arduino/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to: Bread Board Arduino&#8230;</title>
		<link>http://n0m1.com/2012/04/30/how-to-bread-board-arduino/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-bread-board-arduino</link>
		<comments>http://n0m1.com/2012/04/30/how-to-bread-board-arduino/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 02:33:38 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[How to]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1288</guid>
		<description><![CDATA[Having a couple of Bread Board Arduinos handy can really make prototyping quick and painless.  And while the Bread Board Arduino has pretty much been flogged to death in every way, shape and horse, we&#8217;re posting our rendition as reference &#8230; <a href="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/04/Arduino-BreadBoard-with-USB.jpg"><img class="alignnone size-full wp-image-1289" title="Arduino BreadBoard with USB" src="http://n0m1.com/wp-content/uploads/2012/04/Arduino-BreadBoard-with-USB.jpg" alt="" width="1024" height="359" /></a></p>
<p>Having a couple of Bread Board Arduinos handy can really make prototyping quick and painless.  And while the Bread Board Arduino has pretty much been flogged to death in every way, shape and <em>horse</em>, we&#8217;re posting our rendition as reference for future projects and yet to be released libraries.  Before we begin, here are a few links to some of the nicer dead ponies previously referred to:</p>
<ul>
<li><a href="http://arduino.cc/en/Tutorial/ArduinoToBreadboard" target="_blank">The Arduino Reference Guide</a></li>
<li><a href="http://www.instructables.com/id/How-to-Breadboard-Arduino-Compatible/" target="_blank">Beautiful Printout Template via Instructables</a></li>
<li><a href="http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard" target="_blank">An Incredibly Detailed Assembly Guide by NYU</a></li>
</ul>
<p>For simplicity and to conserve power, our variant forgoes any and all voltage regulation.  It runs directly from 3x AA batteries where it will work reliably at 16MHz down to about 4 volts.  At 8MHz the battery voltage can safely fall to as low as 2.5 volts which is a great use for  &#8220;dead&#8221; batteries.  As indicated by the label, this specific Mega328 has it&#8217;s fuses set to the internal RC oscillator at 8MHz, the 16Mhz crystal is on the board but it&#8217;s just for show, what a poser&#8230;</p>
<p>The status LED is on Arduino pin 13, there is an SPI/ICSP connector at the top right and the USB dongle in the middle.  As we&#8217;ve been working on a modified bootloader, the ICSP connector has been seeing much use.  The USB miniboard is an in house design, it&#8217;s based on the QFN package of the FT232R and as well as having all the I/O broken out, it sports a 3/5 volt slide switch on the bottom.  The remainder of the parts are a smattering of capacitors, both bulk and bypass, as well as the reset and power switch.  Below we have the circuit diagram, roughly laid out in the bread board fashion, click to view full size:</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/Bread-Board-Arduino-Circuit1.png"><img class="alignnone size-full wp-image-1304" title="Bread Board Arduino Circuit" src="http://n0m1.com/wp-content/uploads/2012/04/Bread-Board-Arduino-Circuit1.png" alt="" width="1034" height="390" /></a></p>
<p>The Eagle footprint for the Mega328 is arranged as per the physical chip pins.  The library file is available here: <a href="http://n0m1.com/wp-content/uploads/2012/04/n0m1.com-mega328p.rar" target="_blank">n0m1.com-mega328p.rar</a>.  And the schematic in eagle format is here: <a href="http://n0m1.com/wp-content/uploads/2012/04/BBA-sch.rar">BBA sch</a></p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/04/30/how-to-bread-board-arduino/" data-text="How to: Bread Board Arduino&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F04%2F30%2Fhow-to-bread-board-arduino%2F&amp;title=How%20to%3A%20Bread%20Board%20Arduino%E2%80%A6" id="wpa2a_8">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/04/30/how-to-bread-board-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the Cheap: Supported Linear Rail&#8230;</title>
		<link>http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=on-the-cheap-supported-linear-rail</link>
		<comments>http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 01:39:45 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[CNC]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Mechanical]]></category>
		<category><![CDATA[Motion Control]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1259</guid>
		<description><![CDATA[Supported linear rail can be quite expensive, at over $100 per rail per meter, not including shipping.  An alternative support was theorized using 3/8&#8243; threaded rod, drilled, tapped and screwed into the rail.  Today it was assembled and tested, and &#8230; <a href="http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/04/cheap-supported-linear-rail-bearing.jpg"><img class="alignnone size-full wp-image-1260" title="cheap supported linear rail bearing" src="http://n0m1.com/wp-content/uploads/2012/04/cheap-supported-linear-rail-bearing.jpg" alt="" width="1024" height="191" /></a></p>
<p>Supported linear rail can be quite expensive, at over $100 per rail per meter, not including shipping.  An alternative support was theorized using 3/8&#8243; threaded rod, drilled, tapped and screwed into the rail.  Today it was assembled and tested, and has now been confirmed as a valid lower cost linear rail/bearing solution.  This following method required no precision equipment other than a straight edge.</p>
<p>To facilitate handling as well as semi-accurate drilling and tapping, a 2&#215;4 was notched approximately 90 degrees to carry the 25mm rail.  Strapping was placed across the rail and screwed on either side to firmly fix it.<a href="http://n0m1.com/wp-content/uploads/2012/04/rail-in-V-groove.jpg"><img class="alignnone size-full wp-image-1261" title="rail in V groove" src="http://n0m1.com/wp-content/uploads/2012/04/rail-in-V-groove.jpg" alt="" width="1024" height="253" /></a></p>
<p>With rail securely nestled in groove, it was then marked every 12cm, center-drilled for alignment, drilled to 5/16&#8243; and tapped to 3/8&#8243;.  The drilling was performed with a vise in the drill press, tapping was done with the cordless drill and was finished up by hand with a blunt tap.  No taps we&#8217;re harmed, maimed or mangled in the process, a localized anesthetic consisting mainly of 10w30 was used for the tapping process.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/tapping-linear-rail.jpg"><img class="alignnone size-full wp-image-1263" title="tapping linear rail" src="http://n0m1.com/wp-content/uploads/2012/04/tapping-linear-rail.jpg" alt="" width="1024" height="270" /></a></p>
<p>After blind tapping, the 3/8&#8243; threaded rod was cut to 14cm lengths and the cut ends were sanded to remove burs.  A pair of wrenches and a double nut was used to apply ample torque in securing the threaded rod into the linear shaft.  With the threaded hole being  tapered, some thread deformation occurred to make for a very solid fit.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/rod-into-rail-double-nut.jpg"><img class="alignnone size-full wp-image-1266" title="rod into rail double nut" src="http://n0m1.com/wp-content/uploads/2012/04/rod-into-rail-double-nut.jpg" alt="" width="1024" height="249" /></a></p>
<p>With the rails assembled, the focus then shifted to the body of the Y-axis.  A pair of thick walled 1.5&#8243; steel square channel were drilled every 12cm to match the increments in the rails.  A pair of 3/4&#8243; MDF sheets were also prepared, that along with the channel, form a torsion box structure making up the Y-axis.  As MDF is of sandwich construction, 1.5&#8243; fender washers were used as force spreaders to prevent critical surface deformation (cracks around washers).  With pressure the fender washers visibility deformed to apply a concave gradient.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/force-spreading-fender-washer.jpg"><img class="alignnone size-full wp-image-1268" title="force spreading fender washer" src="http://n0m1.com/wp-content/uploads/2012/04/force-spreading-fender-washer.jpg" alt="" width="1024" height="255" /></a></p>
<p>A single rail was bolted to the torsion box frame and adjusts were made with the straight edge of a level until no light could be seen between the level and the rail.  The Z-axis carriage was then added to align the second rail.  As the carriage rode from one end to the other, the second rail was tightened down to make for a parallel linear system.  No further adjusts were required, as seen in the following video the carriage rides smoothly end to end and without bind.</p>
<p><iframe src="http://www.youtube.com/embed/bGbWBDtzydw?rel=0" frameborder="0" width="640" height="360"></iframe></p>
<p>The last step is to seal the MDF from absorption of moisture for dimensional stability.  Weather permitting, this will be done with some epoxy based garage floor paint.  In perspective, this is one of three axis&#8217; making up the <a href="http://n0m1.com/2012/03/17/cnc-gantry-router-collecting-bits-pieces/">CNC Gantry Router</a> project.</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/" data-text="On the Cheap: Supported Linear Rail&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F04%2F23%2Fon-the-cheap-supported-linear-rail%2F&amp;title=On%20the%20Cheap%3A%20Supported%20Linear%20Rail%E2%80%A6" id="wpa2a_10">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/04/23/on-the-cheap-supported-linear-rail/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Face Detection and RC Servos</title>
		<link>http://n0m1.com/2012/04/19/face-detection-and-rc-servos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=face-detection-and-rc-servos</link>
		<comments>http://n0m1.com/2012/04/19/face-detection-and-rc-servos/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 23:11:35 +0000</pubDate>
		<dc:creator>Socialhardware</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Computer Vision]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Motion Control]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1234</guid>
		<description><![CDATA[Yesterday I gave a guest lecture at the Korea National University of the Arts  in an Arduino class taught by my friend Uram Choe, an amazing mechanized sculpture artist.  As seen above, if you like metal working, gears and motors, you &#8230; <a href="http://n0m1.com/2012/04/19/face-detection-and-rc-servos/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/04/uram1.jpg"><img class="alignleft size-full wp-image-1246" title="uram1" src="http://n0m1.com/wp-content/uploads/2012/04/uram1.jpg" alt="" width="1024" height="272" /></a>Yesterday I gave a guest lecture at the <a href="http://www.knua.ac.kr" target="_blank">Korea National University of the Arts </a> in an Arduino class taught by my friend <a href="http://www.uram.net/" target="_blank">Uram Choe</a>, an amazing mechanized sculpture artist.  As seen above, if you like metal working, gears and motors, you will love his sculptures!</p>
<p>The topic of my lecture was using computer vision with the Arduino.  Now I am not a computer vision expert or scientist, I have however, dabbled with <a href="http://opencv.willowgarage.com/wiki/" target="_blank">OpenCV</a> (the most popular computer vision library) enough over the years to know my way around the library fairly well, and get some pretty decent results.  The emphasis here is how to use OpenCV with an Arduino to combine things like motors with video tracking.  It&#8217;s surprisingly easy!</p>
<p>Usually I work with <a href="http://www.openframeworks.cc/">openframeworks</a> when using OpenCv but for this lecture I used <a href="http://processing.org/">Processing</a> for simplicity.  After all this lecture was for an Arduino class not a computer graphics class.  Processing also has a nice <a href="http://ubaa.net/shared/processing/opencv/">OpenCV library</a> that implements most of the basic functions of OpenCV.  It&#8217;s a great place to get started with computer vision.</p>
<p>Demonstrated here is one part of my lecture, which is a simple example of using the Haarfinder face detection algorithm from OpenCV in combination with the Arduino, the Firmata firmware and an RC servo motor.  The first step is to setup your servo motor and Arduino board, this is quite painless but if you are new to RC servos here is a breadboard diagram I whipped up in Fritzing.</p>
<p><img src="http://n0m1.com/wp-content/uploads/2012/04/RC_Arduino.jpg" alt="An RC servo breadboarded with an Arduino" width="503" height="596" /></p>
<p>The next step is to go and install all the correct libraries for both Processing and Arduino. For Processing you will need:</p>
<p>1. The OpenCV library and the OpenCV Processing Library. Follow this link and instructions to download and install both.  <a href="http://ubaa.net/shared/processing/opencv/">Download</a></p>
<p>2. The Firmata library for Processing (also called the Arduino Library for Processing).      <a href="http://arduino.cc/playground/uploads/Interfacing/processing-arduino.zip">Download</a>. Place this Library into your Processing libraries folder, which is located inside of your Processing sketchbook.</p>
<p>For the Arduino you will need:</p>
<p>1. The Firmata library firmware for Arduino. <a href="http://arduino.cc/playground/uploads/Interfacing/processing-arduino-for-firmata-v1.zip">Download</a>. Place this library inside your Arduino libraries folder which is located inside of your Arduino Sketchbook.</p>
<p>So now you have all the proper files and libraries installed, the next step is to put the Firmata firmware on to the Arduino.  All you need to do here is in your Arduino IDE select the Menu: Files -&gt; Examples -&gt; Arduino -&gt; firmware -&gt; Standard_Firmata and open and program this sketch onto your Arduino.  So now you have the Firmata firmware on your Arduino so you can now easily interface with Processing.</p>
<p>So go ahead and startup your Processing IDE and lets start some coding.  The full example code is here: <a href="http://n0m1.com/wp-content/uploads/2012/04/face_detection_firmata.zip">Download</a>.  The code is documented with lots of comments so most of it I won&#8217;t cover here.  However, I will go over a few of the more important or difficult aspects of the code.</p>
<p>In your Processing setup function there is one line of code that sets the input resolution of your camera.  In this example the input resolution is being set to width, height, which is the size of your window.  In many applications you will want to have a window that is bigger then your camera input resolution.  If your windows is larger then 320&#215;240 go ahead and change the opencv.capture parameters to your actual camera resolution.</p>
<pre class="brush: java; gutter: true; first-line: 1">void setup() {

    size( 320, 240 ); //set window size

    opencv = new OpenCV( this ); //setup openCV
    opencv.capture( width, height );   // open video stream</pre>
<p>The next critical part of code in the setup function is to set the opencv cascade type.</p>
<pre class="brush: java; gutter: true; first-line: 1"> opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT );</pre>
<p>In this line the cascade type is set to: CASCADE_FRONTALFACE_ALT which means the face detection algorithm will look for front facing faces.  There are however, other types of cascades available to you.  Here is a fairly self explainable list of alternatives from the OpenCV processing library docs:</p>
<ul>
<li>CASCADE_FRONTALFACE_DEFAULT</li>
<li>CASCADE_PROFILEFACE</li>
<li>CASCADE_FULLBODY</li>
<li>CASCADE_LOWERBODY</li>
<li>CASCADE_UPPERBODY</li>
</ul>
<p>Now there is only one important part of the code left to explain and that is the code contained in the Processing draw() function.  The first part of this code is a call to the openCV library to look at the current video frame, detect all the faces in that video and populate those face location and sizes as Rectangles into an array.</p>
<pre class="brush: java; gutter: true; first-line: 1">// detect faces and put them in an array
Rectangle[] faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 );</pre>
<p>The next few lines of code is what interfaces your Arduino with processing which is the core element of this whole tutorial.  Thanks to the Firmata library its surprisingly simple. First we check if there are faces in the scene.  We don&#8217;t want to try to send values if there are no faces present.  The next important thing is to map the values of the face X location to a value between 0 and 255.  Since 0-255 is the range of values the analogWrite command can send to the RC servo.  So now when the face is at X coordinate 320, the RC servo will be sent the value 255.  In the next line we actually call the Arduino analogWrite command and send the mapped value.  The cool feature of Firmata is that you can make actual Arduino function calls from inside processing and the interfacing happens seamlessly.  You don&#8217;t need to worry about sending serial data and parsing the results on the Arduino side.  By calling the analogWrite command in Processing the Arduino calls that command and PWMs the correct value to the RC servo.</p>
<pre class="brush: actionscript3; gutter: true; first-line: 1"> if(faces.length &gt; 0)
 {
    int mappedValue = (int) map(faces[0].x,0,width, 0, 255);
    arduino.analogWrite(3, mappedValue);
 }</pre>
<p>Now we have face tracking controlling a motor!  Very nice!  Obviously this could be taken much further with multiple faces, multiple motors, and multiple axises. This however, is a great start and its super easy to extend from here.  Goodluck!</p>
<p><strong>UPDATE</strong></p>
<p>It has come to my attention that people are having some issues with this example using windows 7. Something to do with the Processing window showing a blank screen and no video image. I imagine it has something to do with the OpenCV lib having problems grabbing the video from the camera. So I found a work around for the issue. It involves using the normal processing video library to grab the video, then to copy each frame of video into openCV to perform the face detection. This avoids depending on OpenCV to grab the video from the camera. Here is the code:</p>
<pre class="brush: java; gutter: true; first-line: 1">import processing.video.*;
import hypermedia.video.*;
import java.awt.Rectangle;

Capture myCapture;
OpenCV opencv;

int contrast_value    = 0;
int brightness_value  = 0;

void setup() 
{
  size( 320,240 );    

  myCapture = myCapture = new Capture(this, width, height, 30);
 
  opencv = new OpenCV( this );	
  
  opencv.allocate(width,height);  

  opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); 
}

void draw() 
{
 //read the output image 
  myCapture.read();
  opencv.copy(myCapture); //copy the video frame into openCV
  
  //put the image on the frame
  image( opencv.image(), 0, 0 );

   opencv.convert( GRAY ); //convert frame to gray scale
   opencv.contrast( contrast_value ); //apply contrast filter
   opencv.brightness( brightness_value ); //apply brightness filter

    // detect faces and put them in an array
    Rectangle[] faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 );

 //etc, etc, the same as before

}</pre>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/04/19/face-detection-and-rc-servos/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/04/19/face-detection-and-rc-servos/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/04/19/face-detection-and-rc-servos/" data-text="Face Detection and RC Servos"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F04%2F19%2Fface-detection-and-rc-servos%2F&amp;title=Face%20Detection%20and%20RC%20Servos" id="wpa2a_12">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/04/19/face-detection-and-rc-servos/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>LocoMotion: MMA8453 with Interrupts&#8230;</title>
		<link>http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=locomotion-mma8453-with-interrupts</link>
		<comments>http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 00:41:23 +0000</pubDate>
		<dc:creator>Socialhardware</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Motion Control]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=942</guid>
		<description><![CDATA[In the previous post about the MMA8453_N0m1 library we talked about how to get the stream of raw XYZ data back from the accelerometer.  In this post we will be getting into some of the more advanced features of the &#8230; <a href="http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/02/mma8453q.jpg"><img class="alignleft size-full wp-image-794" title="mma8453q" src="http://n0m1.com/wp-content/uploads/2012/02/mma8453q.jpg" alt="" width="1024" height="316" /></a>In the <a href="http://n0m1.com/2012/02/12/shake-rattle-roll-the-mma8453q-arduino/" target="_blank">previous post</a> about the MMA8453_N0m1 library we talked about how to get the stream of raw XYZ data back from the accelerometer.  In this post we will be getting into some of the more advanced features of the MMA8453.</p>
<p>The two advanced features that the MMA8453_N0m1 library breaks out for easier use are the interrupt motion detection, and the interrupt shake detection.  Now motion and shake sound like the same things, but in fact they are slightly different.  What motion detection does is allows you to detect any type of motion above a certain force threshold.  While shake is more specific and allows for only detecting sharp fast motion, by using a highpass filter to remove gentler smoother rolling motions.  The library includes 1 example for each feature.  However the way the library is designed, the two features are used in a very similar manner so we will only cover one here.</p>
<p>So lets assume you have the library and circuit still setup from the <a title="Shake, Rattle &amp; Roll: The MMA8453Q &amp; Arduino" href="http://n0m1.com/2012/02/12/shake-rattle-roll-the-mma8453q-arduino/">previous post</a> on the MMA8453_N0m1 lib.  The example we will be explaining is the shake example, because its ever so slightly more complex than the motion.  Though really its almost identical.  After making the library object just as before, the first thing you will do is initialize the library in the arduino setup() function, with the following function call:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">accel.shakeMode(32,true,true,true,false,2);</pre>
<p>So the first parameter in this function, which is currently set at &#8220;32&#8243;  the shake detection acceleration force threshold, which is a value between 0-127.  This value is calculated through a simple formula as follows.  The gravitational threshold you desire divided by 0.063.  So for example in the above line we do this: 2g/ 0.063g = 31.746, and since the parameter is an int, lets round that value to 32.</p>
<p>The next 3 parameters are just enabling each axis for shake detection; listed X, Y, Z.  So if your project only needs to detect a shaking motion over 1 axis you can disable the others.</p>
<p>The second last parameter is a boolean to enable one of the INT pins on the MMA8453. So, to put it simply, True = pin 2, False = pin1.</p>
<p>The last parameter is to set the Arduino interrupt pin number.  In this example we are setting it to pin 2.  However you could set this to any interrupt pin you have available.  Included in the example folder is an example that uses pin change interrupt to use a non standard interrupt pin.  After that you are pretty much done.  There are just a few simple lines left to add:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">accel.update();

  if(accel.shake())
  {

    if(accel.shakeAxisX()) //X
    {
      Serial.println("Shake X");
    }
  }</pre>
<p>You must call the update function at the top of the loop().  The shake function returns true or false if shake is detected, and the shakeAxisX(), shakeAxisY(), shakeAxisZ() functions will return true if a particular axis is shaken. That&#8217;s all there is to it!  The motion functions are almost identical except it will only return whether or not there is motion, not which axis is in motion.  Well I tried to make it more complex, then the <a href="http://n0m1.com/2012/02/12/shake-rattle-roll-the-mma8453q-arduino/">previous post</a>.  That formula had you sweating, didn&#8217;t it?</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/" data-text="LocoMotion: MMA8453 with Interrupts&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F04%2F08%2Flocomotion-mma8453-with-interrupts%2F&amp;title=LocoMotion%3A%20MMA8453%20with%20Interrupts%E2%80%A6" id="wpa2a_14">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/04/08/locomotion-mma8453-with-interrupts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to: Compiling the Arduino Bootloader&#8230;</title>
		<link>http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-compiling-the-arduino-bootloader</link>
		<comments>http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 02:49:13 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[How to]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1136</guid>
		<description><![CDATA[A project we&#8217;ve been recently working on requires a custom Arduino boot loader.  Working in an incremental fashion, the first step is getting the stock Arduino boot loader to compile with the latest WinAVR libraries and current Arduino 1.0 IDE.  &#8230; <a href="http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/04/command-prompt.jpg"><img class="alignleft size-full wp-image-1137" title="command prompt" src="http://n0m1.com/wp-content/uploads/2012/04/command-prompt.jpg" alt="" width="860" height="349" /></a></p>
<p>A project we&#8217;ve been recently working on requires a custom Arduino boot loader.  Working in an incremental fashion, the first step is getting the stock Arduino boot loader to compile with the latest WinAVR libraries and current Arduino 1.0 IDE.  While this wasn&#8217;t terribly difficult, it did require a bit of searching, debugging, testing and then a bit more debugging before it worked as intended.  Presented here for your convenience, are the fruits of this labor, outlined are the following steps:</p>
<ol>
<li>Download the latest Arduino IDE &#8211; 1.0</li>
<li>Modify the boot loader source</li>
<li>Modify the makefile</li>
<li>Compile in command prompt</li>
</ol>
<p><strong><br />
Step 1: Download the latest Arduino IDE &#8211; 1.0</strong><br />
The latest Arduino IDE, version 1.0 can be downloaded directly here: <a href="http://arduino.googlecode.com/files/arduino-1.0-windows.zip" target="_blank">http://arduino.googlecode.com/files/arduino-1.0-windows.zip</a><br />
The complete package is an 86MB zip that unpacks to about 240 MB.<br />
You can also locate the specific files in the <a href="https://github.com/arduino/Arduino" target="_blank">Github Arduino repository</a>.</p>
<p>Once you&#8217;ve downloaded and unzipped it, navigate to the bootloaders folder at the following path in Windows:  <em>\arduino-1.0\hardware\arduino\bootloaders</em>.  On the Mac, the path is <em>/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/</em>.  For purposes of testing, I&#8217;ve made a new folder here called: <em>\atmega168test</em>.  And populated the new test folder with the two files <em>ATmegaBOOT_168.c</em> and <em>Makefile</em> from the folder <em>\atmega</em>.</p>
<p>For programming under Windows, I prefer to use Programmers Notepad 2, an open source editor with syntax highlighting for many common languages (it makes the words pretty colors).  You can download it here: <a href="http://www.pnotepad.org/" target="_blank">http://www.pnotepad.org/</a>.  Windows Notepad or any other text editor will also suffice.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/Programmers-Notepad.jpg"><img class="alignleft size-full wp-image-1143" title="Programmers Notepad" src="http://n0m1.com/wp-content/uploads/2012/04/Programmers-Notepad.jpg" alt="" width="848" height="312" /></a></p>
<p><strong><br />
Step 2: Modify the boot loader source</strong><br />
The first (and only) compiler error we will tackle is due to the EEWE bit definition missing in versions 1.6.7 and newer of the file /<em>avr</em>/<em>eeprom.h.</em>  The actual compiler error reads as:</p>
<p style="padding-left: 30px;"><em>ATmegaBOOT_168.c: In function &#8216;main&#8217;:</em><br />
<em> ATmegaBOOT_168.c:596:11: error: &#8216;EEWE&#8217; undeclared (first use in this function)</em><br />
<em> ATmegaBOOT_168.c:596:11: note: each undeclared identifier is reported only once for each function it appears in</em><br />
<em> make: *** [ATmegaBOOT_168.o] Error 1</em></p>
<p>This <a href="http://code.google.com/p/arduino/issues/detail?id=152&amp;q=eewe" target="_blank">EEWE issue (152)</a> has been around for a while and was originally reported in 2009.  Within the source file <em>ATmegaBOOT_168.c</em>, around line 584, we will comment out the old and add in the new:</p>
<pre class="brush: actionscript3; gutter: true; first-line: 584">// ?kraz? -fixed EEWE bit definition missing in versions 1.6.7 and newer of the file /avr/eeprom.h
// According to this issue reported in 2009: http://code.google.com/p/arduino/issues/detail?id=152&amp;q=eewe
#if defined(EEPE)
				while(bit_is_set(EECR,EEPE));			//Wait for previous EEPROM writes to complete
#else
				while(bit_is_set(EECR,EEWE));			//Wait for previous EEPROM writes to complete
#endif

/*
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__)
				while(bit_is_set(EECR,EEPE));			//Wait for previous EEPROM writes to complete
#else
				while(bit_is_set(EECR,EEWE));			//Wait for previous EEPROM writes to complete
#endif
*/</pre>
<p>And don&#8217;t forget to save the file!</p>
<p><strong><br />
Step 3: Modify the makefile</strong><br />
Now that we have the bootloader fixed, it does compile without error, but it ends up larger than the 2k space allocation for the bootloader section of the MCUs flash.  The easiest solution here is to bump the compiler optimization level up to <em>-0s</em>.  This is in the makefile on line 52, beware the makefile isn&#8217;t C language, it uses the # operator to comment out a line:</p>
<pre class="brush: actionscript3; gutter: true; first-line: 52"># ?kraz? - changed opt level to fit under 2k
OPTIMIZE   = -Os
# OPTIMIZE   = -O2</pre>
<p><strong><br />
Step 4: Compile in command prompt<br />
</strong>The final step is to compile, under Windows we will be using the command prompt.  The location of command prompt will depend on your version of Windows, in 7 it can be found by typing the first few letters of command in the search box of the start menu.  Once it&#8217;s open, use the <em>&#8220;CD&#8221;</em> command navigate to the bootloader folder of your Arduino install as seen below in Windows, like this:</p>
<p style="padding-left: 30px;"><em>cd C:\arduino-1.0\hardware\arduino\bootloaders\atmega168test</em></p>
<p>And on the Mac, like this:</p>
<p style="padding-left: 30px;"><em>cd /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega168test</em></p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/04/cmd-pmpt-navigate.jpg"><img class="alignleft size-full wp-image-1168" title="cmd pmpt navigate" src="http://n0m1.com/wp-content/uploads/2012/04/cmd-pmpt-navigate.jpg" alt="" width="863" height="249" /></a></p>
<p>We then compile with the command <em>&#8220;make pro8&#8243;</em>, which specifies the target board, in this case it&#8217;s an Mega168 clocked at a relaxing 8Mhz.  Other board target definitions can be found listed in the makefile, such as diecimila, lilypad, ng, atmega328_pro8, mega, etc.   If the hex already exists in the folder, you will get a message <em>make: Nothing to be done for `pro8&#8242;.</em>  In this case just delete the hex and compile again with <em>&#8220;make pro8&#8243;</em>.  If everything went alright, you should see the compiler report as in the first image at the top of this post.  Good luck and happy compiling!</p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/" data-text="How to: Compiling the Arduino Bootloader&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F04%2F01%2Fhow-to-compiling-the-arduino-bootloader%2F&amp;title=How%20to%3A%20Compiling%20the%20Arduino%20Bootloader%E2%80%A6" id="wpa2a_16">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SiC LED: Half the cost, same great taste&#8230;</title>
		<link>http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sic-led-half-the-cost-same-great-taste</link>
		<comments>http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 01:04:09 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LEDs]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1094</guid>
		<description><![CDATA[NoMi Design&#8217;s northern lab recently received some next generation gallium-nitride on silicon carbide LEDs.  These new XBD series LEDs from Cree are promising double the lumen per dollar of existing technologies.  From what we gather, the reduced cost is a &#8230; <a href="http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/03/leds-banner.jpg"><img class="alignleft size-full wp-image-1103" title="leds banner" src="http://n0m1.com/wp-content/uploads/2012/03/leds-banner.jpg" alt="" width="1024" height="141" /></a></p>
<p>NoMi Design&#8217;s northern lab recently received some next generation gallium-nitride on silicon carbide LEDs.  These new XBD series LEDs from Cree are promising double the lumen per dollar of existing technologies.  From what we gather, the reduced cost is a result of a smaller die (2.45 mm²) and the silicon carbide base allowing higher manufacturing yields by way of better thermal expansion matching.  The four above on the left are the XBD SiC LEDs, for comparison, the two on the right are a slightly larger (3.45 mm²) and more powerful Cree XBG.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/03/LEDs-XBD-XBG-.jpg"><img class="alignleft size-full wp-image-1099" title="LEDs XBD XBG" src="http://n0m1.com/wp-content/uploads/2012/03/LEDs-XBD-XBG-.jpg" alt="" width="903" height="200" /></a></p>
<p>As seen on left the new SiC LEDs sport an XBox logo, copyright lawsuit expected in 3, 2, 1 &#8230;  This specific R3 binned XBG (right) is rated for 406 lumen at 1.5 Amps and the R2 binned SiC XBD (left) is rated for 252 lumen at 1 Amp.  Some modification of a Cree 7090 star was required to heatsink these tiny LEDs.  A bit of cutting, followed by application of Pb free solder paste and then into the toaster on high for about 5 minutes resulted in some baked goodness, crunchy on the outside but still chewy inside.</p>
<p><a href="http://n0m1.com/wp-content/uploads/2012/03/toasted-led.jpg"><img class="alignleft size-full wp-image-1109" title="toasted led" src="http://n0m1.com/wp-content/uploads/2012/03/toasted-led.jpg" alt="" width="768" height="212" /></a></p>
<p>Next up is the characterization curves, where we can see the SiC LED has a higher forward voltage for equal current when compared to the XBG.  With these new SiC LEDs offering up a much better lumen per dollar it won&#8217;t be long before they start showing up everywhere&#8230;<a href="http://n0m1.com/wp-content/uploads/2012/03/led-graph1.jpg"><img class="alignleft size-full wp-image-1126" title="led graph" src="http://n0m1.com/wp-content/uploads/2012/03/led-graph1.jpg" alt="" width="903" height="325" /></a></p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/" data-text="SiC LED: Half the cost, same great taste&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F03%2F30%2Fsic-led-half-the-cost-same-great-taste%2F&amp;title=SiC%20LED%3A%20Half%20the%20cost%2C%20same%20great%20taste%E2%80%A6" id="wpa2a_18">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/03/30/sic-led-half-the-cost-same-great-taste/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CNC Half Nuts: The Smell of Melting Plastic&#8230;</title>
		<link>http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cnc-half-nuts-the-smell-of-melting-plastic</link>
		<comments>http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 20:12:33 +0000</pubDate>
		<dc:creator>krazatchu</dc:creator>
				<category><![CDATA[CNC]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Mechanical]]></category>
		<category><![CDATA[Motion Control]]></category>

		<guid isPermaLink="false">http://n0m1.com/?p=1072</guid>
		<description><![CDATA[After cutting down the Y axis screw for the CNC gantry router project we had a short piece of 3/4 inch Acme leadscrew remaining that was just long enough to drive the Z-axis.  Buying an ACME tap to make a &#8230; <a href="http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://n0m1.com/wp-content/uploads/2012/03/half-nuts.jpg"><img class="alignleft size-full wp-image-1075" title="half nuts" src="http://n0m1.com/wp-content/uploads/2012/03/half-nuts.jpg" alt="" width="1024" height="268" /></a><br />
After cutting down the Y axis screw for the <a href="http://n0m1.com/2012/03/17/cnc-gantry-router-collecting-bits-pieces/">CNC gantry router</a> project we had a short piece of 3/4 inch Acme leadscrew remaining that was just long enough to drive the Z-axis.  Buying an ACME tap to make a single nut was out of the question as they are normally over $100.  So we set about heat forming a threaded nut from some bits of scrap <a href="http://en.wikipedia.org/wiki/Ultra-high-molecular-weight_polyethylene" target="_blank">UHMWPE </a>(Ultra High Molecular Weight Poly Ethylene).  We made the nut in two halves with the intention of  shimming them in the final build, this will allow for slight adjustment while keeping backlash under control.  According to Wikipedia, UHMWPE has a melting point of around 145°C and a co-efficient of friction that approaches Teflon.  Up next is short video of the thread forming followed by some drive testing with the cordless drill.<br />
<iframe src="http://www.youtube.com/embed/LlRrj6_2CYA?rel=0" frameborder="0" width="640" height="360"></iframe></p>
<p><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/"></a><a class="a2a_button_facebook_like addtoany_special_service" data-href="http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/"></a><a class="a2a_button_twitter_tweet addtoany_special_service" data-count="horizontal" data-url="http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/" data-text="CNC Half Nuts: The Smell of Melting Plastic&#8230;"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fn0m1.com%2F2012%2F03%2F24%2Fcnc-half-nuts-the-smell-of-melting-plastic%2F&amp;title=CNC%20Half%20Nuts%3A%20The%20Smell%20of%20Melting%20Plastic%E2%80%A6" id="wpa2a_20">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://n0m1.com/2012/03/24/cnc-half-nuts-the-smell-of-melting-plastic/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
