<?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>Project Lab</title>
	<atom:link href="http://nootropicdesign.com/projectlab/feed/" rel="self" type="application/rss+xml" />
	<link>http://nootropicdesign.com/projectlab</link>
	<description></description>
	<lastBuildDate>Sun, 07 Apr 2013 13:10:20 +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>Arduino Backpack Board for RGB Matrix Panel</title>
		<link>http://nootropicdesign.com/projectlab/2012/07/09/backpack-board-for-rgb-matrix/</link>
		<comments>http://nootropicdesign.com/projectlab/2012/07/09/backpack-board-for-rgb-matrix/#comments</comments>
		<pubDate>Mon, 09 Jul 2012 12:02:44 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=1230</guid>
		<description><![CDATA[A while back, I did a project using a 32&#215;16 RGB LED matrix panel from Adafruit but found that connecting an Arduino to the panel was a real wiring mess. So I decided to design a small Arduino &#8220;backpack&#8221; board that snaps right onto the back of the panel so that there&#8217;s no more wiring [...]]]></description>
				<content:encoded><![CDATA[<p>A while back, I did a <a target="_blank" href="http://nootropicdesign.com/projectlab/2012/01/22/displaying-android-video-on-led-matrix/">project using a 32&#215;16 RGB LED matrix panel from Adafruit</a> but found that connecting an Arduino to the panel was a real wiring mess.  So I decided to design a small Arduino &#8220;backpack&#8221; board that snaps right onto the back of the panel so that there&#8217;s no more wiring frustration.  </p>
<p><strong>UPDATE! </strong> This is <a href="http://nootropicdesign.com/matrixbackpack/" title="now available in our store" target="_blank">now available in our store</a>!!!</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpack02.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpack02_sm.jpg" alt="" title="MatrixBackpack02_sm" width="640" height="480" class="alignleft size-full wp-image-1228" /></a><br />
<br clear="all"/><br />
The board is a simple Arduino that has an 8&#215;2 female header so that it can snap right onto the back of the RGB panel.  The board also includes a 2.1mm power jack for a 5V power supply, a 6 pin serial header for easy programming using a USB-serial cable, and a 2-pin terminal block for connecting to the panel&#8217;s power terminals.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpack01.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpack01_sm.jpg" alt="" title="MatrixBackpack01_sm" width="640" height="480" class="alignleft size-full wp-image-1226" /></a><br />
<br clear="all"/><br />
I had the board manufactured by <a href="http://dorkbotpdx.org/wiki/pcb_order">Laen&#8217;s PCB service at Dorkbot PDX</a>, which is a great way to get boards made in small quantities for projects just like this.  Customers of Laen will instantly recognize his signature purple boards.</p>
<p>I&#8217;m so happy with this simple solution for driving my panel that I used it for a display sign when I exhibited at the Twin Cities Maker &#8220;Minne-Faire&#8221; in April.  I wrote some animations for the Arduino backpack to display, and they look great.  The video doesn&#8217;t do them justice because it&#8217;s really hard to capture bright LEDs on video.  This panel is blindingly bright!</p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/5sfZQf-buwA" frameborder="0" allowfullscreen></iframe></p>
<p>Feel free to <a href="http://nootropicdesign.com/projectlab/downloads/MatrixDemo.zip">download the source for this demo</a>.</p>
<p>I&#8217;m not selling this board as a product because the market is probably too small, but if you have one of these RGB panels, you can make your own.  Just <a href="http://nootropicdesign.com/projectlab/downloads/RGBMatrixControllerDesign_v1.0.zip">download the design files</a> and have the PCB manufactured!</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpackBoard.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/06/MatrixBackpackBoard_sm.png" alt="" title="MatrixBackpackBoard_sm" width="640" height="630" class="alignleft size-full wp-image-1245" /></a></p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/MatrixBackpackSchematic.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/06/MatrixBackpackSchematic_sm.png" alt="" title="MatrixBackpackSchematic_sm" width="640" height="469" class="alignleft size-full wp-image-1246" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2012/07/09/backpack-board-for-rgb-matrix/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tabasco Bottle LED Mood Lamp</title>
		<link>http://nootropicdesign.com/projectlab/2012/06/08/tabasco-lamp/</link>
		<comments>http://nootropicdesign.com/projectlab/2012/06/08/tabasco-lamp/#comments</comments>
		<pubDate>Fri, 08 Jun 2012 11:48:19 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Art]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=1161</guid>
		<description><![CDATA[I love Tabasco and always though that their cute little miniature bottles could be the basis for a great specialty lamp. I was very happy to find that a 3mm LED fits perfectly in the bottle opening of the miniature bottles. By designing a custom circuit board I was able to make a lamp that [...]]]></description>
				<content:encoded><![CDATA[<p>I love Tabasco and always though that their cute little miniature bottles could be the basis for a great specialty lamp.  I was very happy to find that a 3mm LED fits perfectly in the bottle opening of the miniature bottles.  By designing a custom circuit board I was able to make a lamp that looks like a bundle of dried peppers.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_both.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_both_sm.jpg" alt="" title="tabascoLamp_both_sm" width="640" height="480" class="alignleft size-full wp-image-1232" /></a><br />
<br clear="all"/><br />
Each bottle is individually controlled with a TLC5940 16-channel PWM driver.  The software running on the ATmega328 is Arduino code that implements different lighting effects.  Here it is in action:</p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/euULP0kJSsw" frameborder="0" allowfullscreen></iframe></p>
<h3>Hardware</h3>
<p>I designed a circuit board for the ATmega328 and the TLC5940.  This is basically a custom Arduino and the design files are available below in case you want to make one.  The LEDs connect from the bottom of the board.  I am using a 5V regulated power supply, so there&#8217;s no need for an on-board voltage regulator.  I included a 6-pin serial header for easy Arduino programming and mounting holes on the corners so I can hang it from wires.  I also included a tactile button in case I wanted to allow some input to control the lamp (currently unused).  Also note the Tabasco logo right on the board silkscreen!</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_board.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_board_sm.jpg" alt="" title="tabascoLamp_board_sm" width="640" height="480" class="alignleft size-full wp-image-1198" /></a><br />
<br clear="all"/><br />
I photographed the assembly process so you could see how I constructed the lamp.</p>
<table>
<tr>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step01.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step01_sm.jpg" alt="" title="tabascoLamp_step01_sm" width="320" height="240" class="alignleft size-full wp-image-1163" /></a><br/>1. Make two holes in each cap using a small nail</td>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step02.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step02_sm.jpg" alt="" title="tabascoLamp_step02_sm" width="320" height="240" class="alignleft size-full wp-image-1165" /></a><br/>2. Insert a 3mm LED into the cap</td>
</tr>
<tr>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step03.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step03_sm.jpg" alt="" title="tabascoLamp_step03_sm" width="320" height="240" class="alignleft size-full wp-image-1167" /></a><br/>3. Ensure the LED is in the center</td>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step04.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step04_sm.jpg" alt="" title="tabascoLamp_step04_sm" width="320" height="240" class="alignleft size-full wp-image-1169" /></a><br/>4. Connect wires by bending the leads.  Make sure they don&#8217;t short!</td>
</tr>
<tr>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step05.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step05_sm.jpg" alt="" title="tabascoLamp_step05_sm" width="320" height="240" class="alignleft size-full wp-image-1182" /></a><br/>5. Carefully solder and clip the leads.</td>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step06.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step06_sm.jpg" alt="" title="tabascoLamp_step06_sm" width="320" height="240" class="alignleft size-full wp-image-1184" /></a><br/>6. Enclose in heat shrink tubing.</td>
</tr>
<tr>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step07.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step07_sm.jpg" alt="" title="tabascoLamp_step07_sm" width="320" height="240" class="alignleft size-full wp-image-1186" /></a><br/>7. Twist wires and weave together.</td>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step08.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step08_sm.jpg" alt="" title="tabascoLamp_step08_sm" width="320" height="240" class="alignleft size-full wp-image-1188" /></a><br/>8. Keep going!</td>
</tr>
<tr>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step09.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step09_sm.jpg" alt="" title="tabascoLamp_step09_sm" width="320" height="240" class="alignleft size-full wp-image-1190" /></a><br/>9. Insert wires into underside of board.</td>
<td valign="top"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step10.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_step10_sm.jpg" alt="" title="tabascoLamp_step10_sm" width="320" height="240" class="alignleft size-full wp-image-1192" /></a><br/>10. Now just solder and clip the wires.</td>
</tr>
</table>
<p><br clear="all"/></p>
<h3>Software</h3>
<p>Here is the Arduino code running on the lamp.  I used the <a href="http://code.google.com/p/tlc5940arduino/">TLC5940 Arduino library</a> to control the PWM driver.  You can <a href="http://nootropicdesign.com/projectlab/downloads/TabascoLamp.zip">download the code from here</a>.</p>
<pre class="codeblockscroll">
#include "Tlc5940.h"

#define NPINS 16
#define NVISUALIZATIONS 6
#define NFUNCTIONS 3
#define BUTTON 2

// pointers to the current and last visualizations                                    
void (*visualization)() = rise;
void (*lastVisualization)() = rise;

// array of visualizations                                                            
void (*visualizations[NVISUALIZATIONS])() = {throb, blinkRandom, onOff, upDown, rise, fall};                        

// An array of all the functions.                                                     
int (*allFunctions[NFUNCTIONS])(float x) = {linear, sine, exponential};


// Each pin has a function associated with it.  The function determines how the brightness                                                                                 
// of the LED changes over time.                                                      
int (*function[NPINS])(float x);

// The x values for the function associated with each LED.  The x value is the current position along                                                                      
// the x axis for the function.  There are are 256 x values on the x axis.  That is, the domain of the                                                                     
// function is [0-255].                                                               
float x[NPINS];

// dx describes (for each LED) how the x value changes over time.  If dx=1, then x is increased by 1                                                                       
// for each duty cycle.  If dx = -1, it is decreased by 1.  If dx=5, then the brightness of the LED will                                                                   
// change faster according to the function because we are moving along the function curve faster.                                                                          
float dx[NPINS];

// y is the current value of the function at x.  If the function is 'linear' and x=128, then y=128.                                                                        
// If the function is 'sine' and x=10, then y=0x03.  See the sineValues array below that defines                                                                           
// the sine function.                                                                 
int y[NPINS];

// For each LED we can specify whether the x value should "wrap" around when reaching the end.                                                                             
// There are 256 possible values for x [0-255].  If we reach 255 and dx=1, then we can wrap around                                                                         
// back to x=0 if wrapFunction=true.  If false, then adding 1 to 255 keeps x=255.     
boolean wrapFunction[NPINS];

// Definition of sine function.  Array lookup executes faster than actually computing the sine.                                                                            
unsigned char sineValues[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x05,0x06,0x07,0x08,
  0x09,0x0a,0x0c,0x0d,0x0f,0x10,0x12,0x13,0x15,0x17,0x19,0x1b,0x1d,0x1f,0x21,0x23,
  0x25,0x27,0x2a,0x2c,0x2e,0x31,0x33,0x36,0x38,0x3b,0x3e,0x40,0x43,0x46,0x49,0x4c,
  0x4f,0x51,0x54,0x57,0x5a,0x5d,0x60,0x63,0x67,0x6a,0x6d,0x70,0x73,0x76,0x79,0x7c,
  0x80,0x83,0x86,0x89,0x8c,0x8f,0x92,0x95,0x98,0x9c,0x9f,0xa2,0xa5,0xa8,0xab,0xae,
  0xb0,0xb3,0xb6,0xb9,0xbc,0xbf,0xc1,0xc4,0xc7,0xc9,0xcc,0xce,0xd1,0xd3,0xd5,0xd8,
  0xda,0xdc,0xde,0xe0,0xe2,0xe4,0xe6,0xe8,0xea,0xec,0xed,0xef,0xf0,0xf2,0xf3,0xf5,
  0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfc,0xfd,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,
  0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfd,0xfc,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,
  0xf6,0xf5,0xf3,0xf2,0xf0,0xef,0xed,0xec,0xea,0xe8,0xe6,0xe4,0xe2,0xe0,0xde,0xdc,
  0xda,0xd8,0xd5,0xd3,0xd1,0xce,0xcc,0xc9,0xc7,0xc4,0xc1,0xbf,0xbc,0xb9,0xb6,0xb3,
  0xb0,0xae,0xab,0xa8,0xa5,0xa2,0x9f,0x9c,0x98,0x95,0x92,0x8f,0x8c,0x89,0x86,0x83,
  0x80,0x7c,0x79,0x76,0x73,0x70,0x6d,0x6a,0x67,0x63,0x60,0x5d,0x5a,0x57,0x54,0x51,
  0x4f,0x4c,0x49,0x46,0x43,0x40,0x3e,0x3b,0x38,0x36,0x33,0x31,0x2e,0x2c,0x2a,0x27,
  0x25,0x23,0x21,0x1f,0x1d,0x1b,0x19,0x17,0x15,0x13,0x12,0x10,0x0f,0x0d,0x0c,0x0a,
  0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x03,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00
};


void setup() {
  randomSeed(analogRead(5));
  pinMode(BUTTON, INPUT);
  digitalWrite(BUTTON, HIGH);
  Tlc.init(0);
}

void loop(){

  lastVisualization = visualization;
  visualization = visualizations[random(NVISUALIZATIONS)];

  // call the current visualization function                                                                                   
  (*visualization)();

}

// Execute n duty cycles.                                                                                                      
// First we call stepXAll() which adds dx to each x value.  This moves the LED along the x axis                                
// of its function.                                                                                                            
// Then, for each LED,  we compute the new y value for the current x value according to which                                  
// function (linear, sine, exponential) that is associated with the LED.                                                       
// For any LED that is supposed to be on at all (any pin with a y value greater than 0), we turn it on.                        
// A duty cycle is a loop of 256 steps executed quickly in succession.  At the beginning of the duty cycle                     
// each LED that has a value of y>0 will be on.  At each step we see if there are any LEDs that need                           
// to be turned off for the remainder of the duty cycle.  So if an LED has y=100, we will turn it off at                       
// step 100.  That LED will have been on for the first 100 steps of the duty cycle and off for the                             
// remaining 156 steps.  So it is dimmer.  If an LED has y=255, then it will remain on during the whole                        
// duty cycle and be at full brightness.  An LED with a low value y=10 will be very dim because we turn                        
// it off very early in the duty cycle.                                                                                        
// This 256 step cycle is executed n times as specified by the input parameter n.                                              

void dutyCycle(int n) {
  for(int i=0;i&lt;n;i++) {
    stepXAll();
    computePinValueAll();
    for(int p=0;p&lt;NPINS;p++) {
      Tlc.set(p, y[p]*16);
    }
    Tlc.update();
    delay(10);
  }
}

void stepXAll() {
  for(int p=0;p&lt;NPINS;p++) {
    stepX(p);
  }
}

// Increment the x value for pin p by the value dx.                                                                            
// Wrap the function around back to 0 (or back to 255)                                                                         
// if wrapFunction is true for the pin p.                                                                                      
void stepX(int p) {
  x[p] = x[p] + dx[p];
  if (wrapFunction[p]) {
    if (x[p] > 255) {
      x[p] = x[p] - 256;
    } else if (x[p] < 0) {
      x[p] = x[p] + 256;
    }
  } else {
    if (x[p] > 255) {
      x[p] = 255;
    } else if (x[p] < 0) {
      x[p] = 0;
    }
  }
}


void computePinValueAll() {
  for(int p=0;p&lt;NPINS;p++) {
    computePinValue(p);
  }
}

// Compute value y for pin p.                                                                                                  
// Apply the function by invoking it with the x value.                                                                         
void computePinValue(int p) {
  y[p] = (*function[p])(x[p]);
}


//////////////////////////////////////////////////////////////////////////////////                                             
// Mathematical Functions                                                                                                      
//////////////////////////////////////////////////////////////////////////////////                                             

int linear(float x) {
  return (int)(x + 0.5);
}

int sine(float x) {
  return sineValues[(int)x];
}

int exponential(float x) {
 return (int) (255.0 * pow(50, ((x/127.5)-2)));
}


//////////////////////////////////////////////////////////////////////////////////                                             
// Visualizations                                                                                                              
//////////////////////////////////////////////////////////////////////////////////                                             

// Do 30 blinks.  Each LED that is blinked will fade                                                                           
// quickly down to 0 according to the exponential function.                                                                    
void blinkRandom() {
  for(int p=0;p&lt;NPINS;p++) {
    function[p] = exponential;
    wrapFunction[p] = false;
    x[p] = 0;
    dx[p] = -4;
  }

  for(int i=0;i&lt;30;i++) {
    int p = random(0, NPINS);
    x[p] = 255;
    dutyCycle(10);
  }
}

void onOff() {
  allOff();

  for(int p=0; p&lt;NPINS; p++) {
    x[p] = 0;
    dx[p] = 0;
    function[p] = linear;
    wrapFunction[p] = false;
  }

  int on = 0;
  int p;
  int d;
  while (on &lt; NPINS) {
    p = random(0, NPINS);
    if (x[p] == 0) {
      on++;
      x[p] = 255;
      dutyCycle(1);
      d = 200 - (on * 10);
      delay(d);
    }
  }

  delay(1000);
  while (on &gt; 0) {
    p = random(0, NPINS);
    if (x[p] == 255) {
      on--;
      x[p] = 0;
      dutyCycle(1);
      d = 40 + (on * 10);
      delay(d);
    }
  }

  delay(100);
}


void throb() {
  eachDown();

  float minSpeed = 0.4;
  float maxSpeed = 1.0;

  // Set random speeds for LEDs                                                                                                
  for(int i=0;i&lt;NPINS;i++) {
    dx[i] = minSpeed + (random(0, 17) * ((maxSpeed - minSpeed) / NPINS));
  }

  for(int p=0; p&lt;NPINS; p++) {
    function[p] = sine;
    wrapFunction[p] = true;
  }

  // Run for a while.  Each pin will throb according to sine wave.                                                             
  dutyCycle(random(500, 2000));

  eachDown();
  delay(500);
}


void fall() {
  int down[NPINS] = {5, 0, 15, 9, 11, 4, 2, 3, 7, 12, 14, 1, 8, 6, 10, 13};

  allOff();
  for(int p=0; p&lt;NPINS; p++) {
    function[down[p]] = linear;
    wrapFunction[down[p]] = false;
    x[down[p]] = 0;
    dx[down[p]] = 8;
    dutyCycle(8);

  }
  delay(200);
  allOff();


}

void rise() {
  int up[NPINS] = {13, 10, 6, 8, 1, 14, 12, 7, 3, 2, 4, 11, 9, 15, 0, 5};

  allOff();
  for(int p=0; p&lt;NPINS; p++) {
    function[up[p]] = linear;
    wrapFunction[up[p]] = false;
    x[up[p]] = 0;
    dx[up[p]] = 8;
    dutyCycle(8);

  }

  delay(200);
  allOff();


}
void upDown() {
 allUp();
 allDown();
}


void allUp() {
  if (lastVisualization == allUp) {
    return;
  }

  for(int p=0; p&lt;NPINS; p++) {
    x[p] = y[p];
    dx[p] = 1.0;
    function[p] = linear;
  }
  dutyCycle(256);
}

void allDown() {
  if (lastVisualization == allDown) {
    return;
  }

  for(int p=0; p&lt;NPINS; p++) {
    x[p] = y[p];
    dx[p] = -1.0;
    function[p] = linear;
  }
  dutyCycle(256);
}


void eachDown() {
  boolean done = true;

  if (lastVisualization == eachDown) {
    return;
  }

  for(int p=0; p&lt;NPINS; p++) {
    x[p] = y[p];
    dx[p] = -1;
    function[p] = linear;
    wrapFunction[p] = false;
  }

  done = false;
  while (!done) {
    dutyCycle(1);
    done = true;
    for(int p=0; p&lt;NPINS; p++) {
      if (y[p] > 0) {
        done = false;
        break;
      }
    }
  }
}

void allOn() {
  for(int p=0; p&lt;NPINS; p++) {
    function[p] = linear;
    x[p] = 255;
    dx[p] = 0;
  }
  dutyCycle(1);
}

void allOff() {
  for(int p=0; p&lt;NPINS; p++) {
    function[p] = linear;
    x[p] = 0;
    dx[p] = 0;
  }
  dutyCycle(1);
}
</pre>
<h3>Hardware Design Files</h3>
<p>The schematic and board design are open source hardware, so you are welcome to have a board fabricated yourself!  <a href="http://nootropicdesign.com/projectlab/downloads/TabascoLampDesign_v1.0.zip">Download the design files here</a>.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_sch.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_sch_sm.png" alt="" title="tabascoLamp_sch_sm" width="640" height="404" class="alignleft size-full wp-image-1219" /></a><br />
<a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_brd.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/05/tabascoLamp_brd_sm.png" alt="" title="tabascoLamp_brd_sm" width="640" height="634" class="alignleft size-full wp-image-1218" /></a><br />
<br clear="all"/></p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2012/06/08/tabasco-lamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless Robotics Platform with XBee Remote Control</title>
		<link>http://nootropicdesign.com/projectlab/2012/02/18/xbee-robotics-platform/</link>
		<comments>http://nootropicdesign.com/projectlab/2012/02/18/xbee-robotics-platform/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 13:03:07 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Level 7]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[XBee]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=1108</guid>
		<description><![CDATA[Difficulty Level = 7 [What's this?] I built a remote-controlled robotics platform using a 4WD mobile platform, an Arduino (Seeeduino Mega), an Adafruit motor shield, and two XBee radios for communication. There are also some super-bright white LEDs on the front for headlights. The point of the project was to show how an XBee radio [...]]]></description>
				<content:encoded><![CDATA[<p><strong><em>Difficulty Level = 7</em></strong>  <a target="_blank" href="/projectlab/difficulty-levels/">[What's this?]</a></p>
<p>I built a remote-controlled robotics platform using a 4WD mobile platform, an Arduino (Seeeduino Mega), an Adafruit motor shield, and two XBee radios for communication.  There are also some super-bright white LEDs on the front for headlights.  The point of the project was to show how an XBee radio can be used to send joystick sensor data without using a microcontroller on the remote.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-sm.jpg" alt="" title="roboticsPlatform-sm" width="640" height="480" class="alignleft size-full wp-image-1126" /></a><br />
<br clear="all"/><br />
<a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-headlights.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-headlights-sm.jpg" alt="" title="roboticsPlatform-headlights-sm" width="640" height="480" class="alignleft size-full wp-image-1122" /></a><br />
<br clear="all"/></p>
<p/>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/XP6WheaVWUA?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>The vehicle is very easy to control using a joystick and a couple of buttons to control the lights.  First I&#8217;ll describe how the remote control unit works, then I&#8217;ll show how the vehicle was built.</p>
<h3>The Remote</h3>
<p>Here&#8217;s a picture of the remote control unit that I built on a breadboard.  A <a target="_blank" href="http://www.adafruit.com/products/245">Parallax joystick</a> is used to control the vehicle, one button turns the headlights on/off, and another button puts the headlights in &#8220;scanner&#8221; mode, you know, like <a target="_blank" href="http://en.wikipedia.org/wiki/KITT">Kitt</a> or like a <a target="_blank" href="http://en.wikipedia.org/wiki/Cylon_(1978)">cylon</a>.  The radio requires a 3.3V supply, but the analog pins cannot take more than 1.2V, so I used some precision resistors to form a voltage divider so that the analog input voltage was stepped down to less than 1.2V.  Also note that the joystick is rotated 90 degrees so that it worked on a breadboard with this orientation.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-remote.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-remote-sm.jpg" alt="" title="roboticsPlatform-remote-sm" width="640" height="322" class="alignleft size-full wp-image-1124" /></a><br />
<br clear="all"/></p>
<p/>
<p>To make this work, one radio needs to be running the &#8220;coordinator&#8221; firmware, and the other running the &#8220;router&#8221; firmware.  In this project, the coordinator is on the vehicle and the router is on the remote control, but it should not really ma<tter.  It's important that each radio be running the API mode firmware, <i>not</i> the AT/transparent firmware.</p>
<p>I used the <a target="_blank" href="http://ftp1.digi.com/support/documentation/90001003_A.pdf">X-CTU tool from Digi</a> to write the appropriate firmware to the radios and configure them.  If you have not done this before, <i>this is not a good project to start with</i>.  It is best to start with 2 radios that you already have working together using the API firmware.</p>
<p>The XBee on the remote control unit is configured to send analog/digital sample packets every 100ms.  Pins AD1 (pin 19) and AD2 (pin 18) are configured as analog inputs and are connected to the potentiometers in the joystick.  Pins DIO3 (pin 17) and DIO4 (pin 11) are configured as digital inputs for the two buttons on the remote that control the lights on the vehicle.  Here is a list of the configuration parameters that were set on the remote radio:</p>
<ul>
<li>AD1/DIO1 = 2 (configured as analog input)</li>
<li>AD2/DIO2 = 2 (configured as analog input)</li>
<li>AD3/DIO3 = 3 (configured as digital input)</li>
<li>DIO4 = 3 (configured as digital input)</li>
<li>IR = 0&#215;64 (sample rate set to 100ms)</li>
<li>PR = 0x1FFF (all pullup resistors enabled &#8212; this is the default)</li>
</ul>
<p>This is a schematic of the remote control unit:<br />
<a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/xbeeRemoteSchematic.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/xbeeRemoteSchematic-sm.png" alt="" title="xbeeRemoteSchematic-sm" width="640" height="480" class="alignleft size-full wp-image-1141" /></a><br />
<br clear="all"/></p>
<p/>
<h3>The Vehicle</h3>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-electronics.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-electronics-sm.jpg" alt="" title="roboticsPlatform-electronics-sm" width="640" height="480" class="alignleft size-full wp-image-1118" /></a><br />
<br clear="all"/></p>
<p/>
<p>The wiring for the vehicle is fairly simple.  Inside the 4WD platform are 5 AA batteries for powering the motors, and a 9V battery for the Arduino.  I&#8217;m using a Seeeduino Mega because that&#8217;s what I had handy but any Arduino will work.  The Adafruit motor shield is connected to the 4 DC motors inside the chassis.  I used the 3.3V power supply on hte Arduino to power the XBee radio.  The TX/RX lines of the radio are connected to the RX/TX pins on the Arduino.  There&#8217;s a ribbon cable connecting 4 output pins to the LED headlights, and a ground wire running to the headlight assembly.  Here is the bottom of the headlight assembly.  These are 100 ohm resistors to keep the current draw below 20mA per LED.<br />
<a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-headlightAssembly.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/02/roboticsPlatform-headlightAssembly-sm.jpg" alt="" title="roboticsPlatform-headlightAssembly-sm" width="640" height="480" class="alignleft size-full wp-image-1120" /></a><br />
<br clear="all"/></p>
<p/>
<h3>The Software</h3>
<p>This code depends on the <a target="_blank" href="http://www.ladyada.net/make/mshield/download.html">Adafruit library for using the motor shield</a>, so download that and install it as an Arduino library.  The Arduino sketch for this vehicle <a href="http://nootropicdesign.com/projectlab/downloads/RobotVehicle.zip">RobotVehicle.zip can be downloaded from here</a>.  Read the code for an explanation of how it works.  The basic idea is to decode the incoming XBee API packets and map the joystick position information to the motor speeds.  If the joystick is forward, all four wheels move forward.  If the joystick is turned slightly to one corner, then the vehicle will move along an arc.  If the joystick is hard left or right, then the wheels on the left side and right side will turn in opposite directions, causing the vehicle to rotate in place.  By studying the code carefully, you should be able to understand how all of it works.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2012/02/18/xbee-robotics-platform/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Displaying Android Phone Video on an RGB LED Matrix</title>
		<link>http://nootropicdesign.com/projectlab/2012/01/22/displaying-android-video-on-led-matrix/</link>
		<comments>http://nootropicdesign.com/projectlab/2012/01/22/displaying-android-video-on-led-matrix/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 12:09:17 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[IOIO]]></category>
		<category><![CDATA[Level 10]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=1023</guid>
		<description><![CDATA[Difficulty Level = 10 [What's this?] I bought this awesome RGB LED matrix panel from Adafruit and really wanted to see if I could make it display video from an Android phone. It was somewhat difficult, but by using my Android phone, the OpenCV computer vision library for Android, a Sparkfun IOIO board, and an [...]]]></description>
				<content:encoded><![CDATA[<p><strong><em>Difficulty Level = 10</em></strong>  <a target="_blank" href="/projectlab/difficulty-levels/">[What's this?]</a></p>
<p>I bought this awesome <a target="_blank" href="http://www.adafruit.com/products/420">RGB LED matrix panel</a> from Adafruit and really wanted to see if I could make it display video from an Android phone.  It was somewhat difficult, but by using my Android phone, the <a target="_blank" href="http://opencv.willowgarage.com/wiki/Android">OpenCV computer vision library for Android</a>, a <a target="_blank" href="http://www.sparkfun.com/products/10748">Sparkfun IOIO board</a>, and an Arduino, I got it working.  </p>
<p><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixDiagram.png" alt="" title="RGBMatrixDiagram" width="640" height="269" class="alignleft size-full wp-image-1100"  style="border:none";/><br />
<br clear="all"/></p>
<p>All of the hardware and software setup details are below, but before I explain how it works, let&#8217;s see it in action:</p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/yhA4Jne7o14?rel=0" frameborder="0" allowfullscreen></iframe></p>
<h3>How It Works</h3>
<p>This is not a beginner project, so if you don&#8217;t have experience doing any Android development, you&#8217;ll need to be patient.  Just getting your Eclipse development environment set up for Android development with the OpenCV and IOIO libraries took me a couple of hours, and I&#8217;ve been using Eclipse for about 10 years.</p>
<p>An Android app running on the phone captures video frames and processes them down to a lower resolution suitable for the 16&#215;32 LED matrix.  <a href="http://opencv.willowgarage.com/wiki/" target="_blank">OpenCV</a> is a powerful computer vision/image processing library, and there&#8217;s a <a href="http://opencv.willowgarage.com/wiki/Android" target="_blank">version that runs on Android</a>.  I used the OpenCV library to convert the video frames to 16&#215;32 pixel resolution to match the LED matrix.  I also constrained the color space of the frames to 12 bit color.  That is, each pixel has 4 bits each for red, green, and blue.  That means that each pixel can have 16 different brightness levels of red/green/blue, yielding 4096 possible colors.  In other words, all of the image processing is performed on the phone because it&#8217;s much more powerful than the Arduino.</p>
<p>The 16&#215;32 12-bit image uses 1024 bytes of memory on the phone (2 bytes per pixel).  The Android then uses the IOIO library to write this data out one of the IOIO board&#8217;s serial ports.  Each frame starts with a two-byte frame marker 0xF0 0&#215;00, then the bytes for the pixel values are written.  The performance bottleneck is between the phone and the IOIO board.  I can only write about 4 frames per second, even though the serial interface between the IOIO and Arduino is 115200 baud.  Since each pixel really only needs 1.5 bytes instead of 2, I could pack the pixel data tighter to get perhaps one more frame per second, but didn&#8217;t think it was worth the trouble.</p>
<p>The green wire in the picture below is a serial connection from the IOIO and Arduino.  The Arduino code simply reads the pixel values, using the frame marker to know when a new frame begins.  The pixel values are written to the LED matrix panel using the Adafruit library for controlling the panel.  Driving this matrix is no small feat for the Arduino, since the matrix panel does not do any PWM on its own; the Arduino needs to generate the PWM.  This matrix driver software could have been written for the IOIO to control the matrix directly without an Arduino, but Adafruit had really tuned this library for high-performance and very precise timing, so I thought I&#8217;d better stay with the Arduino code for now.  The result is video at about 4 frames per second.  Not very fast, but the color rendition is pretty good.</p>
<h3>Hardware Setup</h3>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixHardware.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixHardware-sm.jpg" alt="" title="RGBMatrixHardware-sm" width="640" height="480" class="alignleft size-full wp-image-1045" style="border:none;"/></a><br />
<br clear="all"/><br />
The RGB matrix panel is wired to the Arduino <a href="http://ladyada.net/products/rgbledmatrix/">just as Adafruit&#8217;s instructions describe</a>.  They have an excellent page that describes how the panel works and how to use it.  </p>
<p>The RGB matrix and the Arduino are powered by a 5V regulated power supply that can provide 2A (also from Adafruit).  The IOIO board is powered independently by a 9V supply that can provide 1A.  It&#8217;s important to provide plenty of current to the IOIO board so that the phone can charge, however you can adjust a potentiometer on the IOIO to reduce the charging current.  As with any project with multiple power supplies, all the grounds must be connected.  A single green wire provides the serial data feed from the IOIO to the Arduino RX pin.  </p>
<p>I used a diffuser in front of the display to make it look much better.  Without a diffuser, the LEDs are simply blinding and it&#8217;s not easy to see any image.  My diffuser is a piece of acrylic with paper vellum on it.  The diffuser is held about 5mm in front of the LED panel (with a little roll of duct tape as a spacer).</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixDiffuser.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixDiffuser.jpg" alt="" title="RGBMatrixDiffuser" width="640" height="480" class="alignleft size-full wp-image-1044"  style="border:none;" /></a><br />
<br clear="all"/><br />
The phone (a Samsung Nexus S) is connected to the IOIO via USB.  I mounted above the panel by holding it very gently with a Panavise.</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixCameraMount.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixCameraMount.jpg" alt="" title="RGBMatrixCameraMount" width="640" height="480" class="alignleft size-full wp-image-1043" style="border:none;" /></a><br />
<br clear="all"/></p>
<h3>Software Setup</h3>
<p><b style="color:#EDC100;">Android + IOIO + OpenCV Software</b><br />
The hardest part of the software setup is preparing your development environment for Android, IOIO, and OpenCV development.  The details of how to do this are beyond the scope of this article, but all of the steps are documented in various places.</p>
<ol>
<li>Set up your Android development environment: this is documented on the <a href="http://developer.android.com/sdk/installing.html" target="_blank">Android SDK website</a>.  After you have performed this step, you will be able to write simple Android programs and run them on your phone.</li>
<li>Install the IOIO library: see <a href="http://www.sparkfun.com/tutorials/280" target="_blank">this great Sparkfun tutorial</a> which describes how to run Android apps that communicate with a connected IOIO board.  After you have performed this step, you will be able to upload the HelloIOIO app to your phone and have it communicate with your IOIO board.  Don&#8217;t move on to the next step until you are sure you have the IOIO working with your phone.</li>
<li>Install the OpenCV library for Android by following <a href="http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html#get-the-opencv-package-for-android-development" target="_blank">these instructions</a>.  After successfully doing this, you should be able to run the OpenCV Android examples on your Android phone.  Don&#8217;t proceed until you have this working successfully.</li>
<li>Now that you have all the supporting libraries in place, download the <a href="http://nootropicdesign.com/projectlab/downloads/RGBMatrixDriver.zip" target="_blank">RGBMatrixDriver Android application project</a> and install it in your Eclipse workspace and open it.  With luck, it will compile cleanly.  If not, make sure that the project is correctly pointing to the IOIO and OpenCV libraries as in the image below.<img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2012/01/RGBMatrixAndroidProperties.png" style="border:none;" /></li>
<li>You may need to customize the code a bit.  I used IOIO pin 7 to send serial data to the Arduino, so you may need to change the pins specified in the call to <code>openUart</code> in <code>RGBMatrixActivity.java</code>.  You may also need to change some screen dimensions specified in <code>RGBMatrixView.java</code> to work with your phone &#8212; just follow the comments.</li>
</ol>
<p>Once you have the application running on your phone, this is what it looks like in action.  The video image is displayed with the same resolution and colors as the RGB matrix.</p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/zn6Ky3Qc5w4?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p><b style="color:#EDC100;">Arduino Software</b><br />
Now that the hard part is done, it&#8217;s easy to get the Arduino software installed.</p>
<ol>
<li>First, you&#8217;ll need Adafruit&#8217;s library for driving the panel.  This project uses a slightly older version which you can <a href="http://nootropicdesign.com/projectlab/downloads/RGBmatrixPanel.zip" target="_blank">find here</a>.  Install it in your Arduino sketchbook libraries folder just like any other library.</li>
<li>Then download and install the <a href="http://nootropicdesign.com/projectlab/downloads/RGBMatrixSerial.zip" target="_blank"><code>RGBMatrixSerial</code> sketch</a> and install it in your Arduino sketchbook.  Compile it and upload it onto your Arduino.  The sketch is so simple, I&#8217;ll show the whole thing here:
<pre class="codeblockscroll">
#include "RGBmatrixPanel.h"

#define A   A0
#define B   A1
#define C   A2
#define CLK 8
#define LAT A3
#define OE  9
#define WIDTH 32

int count = 0;
byte currentByte = 0;
byte lastByte = 0;
uint16_t color;
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, true);

void setup()
{
  Serial.begin(115200);
  matrix.begin();
}

void loop() {
  int index;
  while (Serial.available()) {

    lastByte = currentByte;
    currentByte = Serial.read();

    // Look for the frame marker 0xF000
    if ((lastByte == 0xF0) &#038;&#038; (currentByte == 0x00)) {
      count = 0;
      matrix.swapBuffers(false);
    } else {
      if ((count % 2) == 1) {
        color = (lastByte << 8) | currentByte;
        index = (count-1)/2;
        matrix.drawPixel(index % WIDTH, index / WIDTH, color);
      }
      count++;
    }
  }
}
</pre>
</li>
</ol>
<h3>Future Ideas</h3>
<ul>
<li>increase the framerate a bit by packing 2 pixels in 3 bytes of transmitted data (only really need 1.5 bytes per pixel), but need different frame marker detection.</li>
<li>use the <a href="http://www.adafruit.com/products/607">32x32 matrix panel from Adafruit</a></li>
<li>try BlueTooth connection between phone and IOIO board (need to upgrade IOIO firmware)</li>
<li>Get an Arduino Mega ADK and use it to interface with the Android phone instead of the IOIO.  The framerate should be higher.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2012/01/22/displaying-android-video-on-led-matrix/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Vintage Holiday Ads for Our Kits!</title>
		<link>http://nootropicdesign.com/projectlab/2011/12/03/vintage-holiday-ads/</link>
		<comments>http://nootropicdesign.com/projectlab/2011/12/03/vintage-holiday-ads/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 15:18:51 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Art]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=1009</guid>
		<description><![CDATA[Here are our new holiday ads for some of our kits&#8230;show your friends! Click through for product info! Buy!]]></description>
				<content:encoded><![CDATA[<p>Here are our new holiday ads for some of our kits&#8230;show your friends!  Click through for product info!  Buy!</p>
<p><a href="http://nootropicdesign.com/hackvision/"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/12/hackvisionHolidayAd.jpg" alt="" title="hackvisionHolidayAd" width="522" height="678" class="alignleft size-full wp-image-1008" /></a><br />
<br clear="all"/></p>
<p/>
<a href="http://nootropicdesign.com/defusableclock/"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/12/defusableClockHolidayAd2.jpg" alt="" title="defusableClockHolidayAd2" width="520" height="681" class="alignleft size-full wp-image-1007" /></a><br />
<br clear="all"/></p>
<p/>
<a href="http://nootropicdesign.com/defusableclock/"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/12/defusableClockHolidayAd.jpg" alt="" title="defusableClockHolidayAd" width="520" height="660" class="alignleft size-full wp-image-1014" /></a><br />
<br clear="all"/></p>
<p/>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2011/12/03/vintage-holiday-ads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chipKIT Uno32 Review: Arduino Compatible?</title>
		<link>http://nootropicdesign.com/projectlab/2011/11/01/chipkit-uno32-review/</link>
		<comments>http://nootropicdesign.com/projectlab/2011/11/01/chipkit-uno32-review/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 23:07:26 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=942</guid>
		<description><![CDATA[I recently got a chipKIT Uno32 prototyping platform from Newark so I could take it for a spin. Newark is the US distribution arm of Farnell and they carry both the chipKIT Uno32 and the chipKIT Max32. The chipKIT boards are manufactured by Diligent and claim compatibility with Arduino boards. The Uno32 is similar to [...]]]></description>
				<content:encoded><![CDATA[<p>I recently got a <a href="http://www.newark.com/digilent/chipkit-uno32/arduino-uno-compatible-w-pic32mx320f128h/dp/47T1474" target="_blank">chipKIT Uno32</a> prototyping platform from <a href="http://www.newark.com" target="_blank">Newark</a> so I could take it for a spin.  Newark is the US distribution arm of <a href="http://www.farnell.com" target="_blank">Farnell</a> and they carry both the chipKIT Uno32 and the chipKIT Max32.<br />
<div id="attachment_952" class="wp-caption alignright" style="width: 650px"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/chipKIT-640x480.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/chipKIT-640x480.jpg" alt="" title="chipKIT-640x480" width="640" height="480" class="size-full wp-image-952" /></a><p class="wp-caption-text">Nice looking board!</p></div><br />
<br clear="all"/><br />
The chipKIT boards are manufactured by <a href="http://www.digilentinc.com">Diligent</a> and claim compatibility with Arduino boards.  The Uno32 is similar to the Arduino Uno, and the chipKIT Max32 is similar to the Arduino Mega, but they are both based on Microchip PIC32 microcontrollers.  The Uno32 that I have has a <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en532434" target="_blank">PIC32MX320F128H microcontroller</a>.</p>
<p>There are plenty of powerful features of the Uno32 that make it compelling, especially when comparing to the Arduino.  There are 42 I/O pins, which is nice.  The clock speed is 80MHz versus 16MHz on the Arduino.  For most hobbyists this won&#8217;t matter much; I have not often found CPU speed to be a limiting factor in projects.  There&#8217;s more Flash memory to store your programs: 128K versus Arduino 32K.  Again, I have never felt limited by the size of a program.  In fact, the largest Arduino program I&#8217;ve written is a full-featured <a target="_blank" href="http://nootropicdesign.com/projectlab/2011/02/06/asteroids-on-hackvision/">implementation of Asteroids</a> and this only took 28K of Flash memory for the program.</p>
<p>But when it comes to SRAM, the memory that you use in your programs to store data structures, buffers, stack, etc, the chipKIT Uno32 has 16K versus 2K on the Arduino.  This is a vast improvement for me.  I&#8217;ve done a lot of video work with the Arduino (e.g. the <a href="/ve/" target="_blank">Video Experimenter shield</a>, <a href="/hackvision/" target="_blank">Hackvision game system</a>, etc.) and the size of SRAM is a significant barrier to video frame storage.</p>
<p>There are also 2 UARTs used for serial communication, versus the 1 on Arduino.  When using Arduino, if you want to communicate with two serial devices at once (for example, the Serial Monitor on your computer and a GPS module), you had to use a software implementation of serial communication for one of the devices.  But with 2 UARTs, the chipKIT Uno32 allows 2 independent hardware implementations.  I like that a lot.  There&#8217;s also a realtime clock and calendar (RTCC) on the PIC32MX320F128H microcontroller with the option of connecting a 32.768KHz clock crystal.  That could be useful for some projects.</p>
<p>Make sure you check out the Hackaday article where they did an <a href="http://hackaday.com/2011/05/27/chipkit-uno32-first-impressions-and-benchmarks/" target="_blank">in-depth review</a> of these boards from a performance perspective.</p>
<p>But what I was <em>really</em> interested in understanding is Diligent&#8217;s claim that the chipKIT boards are &#8220;Arduino Compatible&#8221;.  What does this mean in <em>practical terms</em> for the hobbyist?</p>
<h3>Compatibility: The Good News</h3>
<p>Well, you can program the Uno32 using the normal Arduino API, like <span class="code">digitalWrite</span>, <span class="code">digitalRead</span>, <span class="code">analogRead</span>, etc.  For most hobbyists, this will allow them to read sensors, light LEDs, control motors, and the like.  Maybe you need lots of digital outputs &#8212; the Uno32 has 42 pins instead of 19 on the ordinary Arduino.  The Uno32 is a lot cheaper than the Arduino Mega.</p>
<p>So, the normal Arduino API works, but what about direct access to ports in order to more efficiently control digital I/O?  I often use <a href="http://www.arduino.cc/en/Reference/PortManipulation" target="_blank">direct manipulation</a> of the AVR microcontroller ports instead of using <span class="code">digitalWrite</span> and <span class="code">digitalRead</span> calls.  That is, I set a digital pin HIGH with something like <span class="code">PORTB |= 0&#215;2</span> instead (for speed).  Will this code work with the chipKIT boards?  Yes!  I was surprised, but apparently the chipKIT compiler makes the appropriate adjustments to the resulting compiled code to allow direct port manipulation using the AVR semantics.</p>
<h3>Compatibility: The Bad News</h3>
<p>Here are some things that I think are bad news with regard to Arduino compatibility.</p>
<ul>
<li><span class="highlight">Outputs are 3.3V</span> &#8212; This means that the output voltage of the digital pins isn&#8217;t high enough to be recognized as an input HIGH voltage by many 5V CMOS chips.  For example, you can&#8217;t use the digital outputs on chipKIT boards to drive a 74HC595 shift register.  The 3.3V output is not high enough to trigger the input pins on CMOS chips which generally require at least 3.5V.  This problem can be address by adding more components to your circuits (e.g. a transistor to translate to a higher input voltage), but that defeats the purpose of convenient Arduino shields.</li>
<li><span class="highlight">Current limitations</span> &#8212; On the Arduino, each digital pin can source/sink up to 40mA as an absolute maximum, but in practice you should limit to 20mA.  However, the chipKIT boards have a maximum of +/-18mA per pin, and the reference manual states that this should be limited to +7/-12mA per pin.  This is going to be a disappointment to people wanting to drive LEDs, 7-segment displays, etc.  Furthermore, the maximum current that can be sourced/sunk across ALL I/O pins simultaneously is only 200mA.  That&#8217;s not much current to spread across 42 pins!  I tried to light a bright blue LED and was only able to draw a dim 8mA (with no current limiting resistor at all!) because the forward voltage of the LED is just barely over the 3.3V board output voltage.  Again, this can be solved with external circuitry, but that&#8217;s not convenient.</li>
<li><span class="highlight">Code rewrites</span> &#8212; If your Arduino code accesses AVR registers directly (for example to use timers) or involves AVR assembly, you are going to have to rewrite it.  This means that using my <a href="/ve/">Video Experimenter</a> on the chipKIT board would b e a total rewrite of the gnarly AVR assembly.</li>
<li><span class="highlight">Incompatible pin assignments</span> &#8212; If you use special microcontroller functions found on the AVR, you will not find them on the same pins on the chipKIT boards.  For example, my <a href="/ve/">Video Experimenter</a> shield utilizes the analog comparator function to compare the voltage of a video signal with a reference voltage.  The analog comparator pin is D6 on the Arduino, but is D11 on the chipKIT Uno32.  This is another barrier to using Arduino shields on the chipKIT boards.  The pins don&#8217;t have the same functions.</li>
</ul>
<h3>Bottom Line</h3>
<p>The chipKIT Uno32 is a nice board and will give many Arduino users a boost in speed and in the number of pins available.  Users doing more sophisticated things that involve direct AVR register access, timers, and libraries written in AVR assembly won&#8217;t be able to simply switch to the chipKIT for their work without a lot of rewriting.  Most disappointing to me is that many Arduino shields simply aren&#8217;t going to work on the chipKIT.  And due to the 3.3V output, even projects using LEDs (the bread-and-butter of the Arduino world!) may have some challenges due to current limitations and the lower voltage available to light up all those blinky lights.  Nonetheless, I welcome Microchip and Diligent&#8217;s efforts and hope to see some great chipKIT projects in the future!</p>
<h3>Resources</h3>
<p><a href="http://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,892&#038;Cat=18">Diligent chipKIT site</a><br />
<a href="http://digilentinc.com/Data/Products/CHIPKIT-UNO32/chipKIT%20Uno32_rm.pdf">chipKIT Uno32 Reference Manual</a><br />
<a href="http://www.chipkit.org/forum/index.php">chipKIT forums</a><br />
<a href="http://www.microchip.com/stellent/groups/techpub_sg/documents/devicedoc/en026368.pdf">Tips and tricks for translating between 3.3V and 5V</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2011/11/01/chipkit-uno32-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watching the Feds Watch Me</title>
		<link>http://nootropicdesign.com/projectlab/2011/09/16/watching-the-feds-watch-me/</link>
		<comments>http://nootropicdesign.com/projectlab/2011/09/16/watching-the-feds-watch-me/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 12:17:00 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=905</guid>
		<description><![CDATA[I recently showed my Defusable Clock project on this blog. It got a lot of attention on the usual techie/hacker blogs, and the reaction was generally positive. I plan on selling an electronics kit so people can build their own, but I had reservations about doing so because some people might do something stupid with [...]]]></description>
				<content:encoded><![CDATA[<p>I recently showed my <a target="_blank" href="http://nootropicdesign.com/projectlab/2011/09/05/defusable-clock/">Defusable Clock project</a> on this blog.  It got a lot of attention on the usual techie/hacker blogs, and the reaction was generally positive.  I plan on selling an electronics kit so people can build their own, but I had reservations about doing so because some people might do something stupid with it.  Writing about the project allowed me to get feedback about whether it was a good or bad idea.  I concluded it was probably not a <i>bad</i> idea as long as I didn&#8217;t sell it pre-assembled, and didn&#8217;t sell anything that looked like explosives.  I really don&#8217;t want to do anything wrong or enable anyone to do anything wrong.  Just electronics fun.</p>
<p>A few days later, on Friday September 9, I noticed an interesting lurker in my online store.  The domain name of the potential customer caught my eye: <code>tsa.dhs.gov</code>.  Was this someone at the Department of Homeland Security?  Specifically, the Transportation Security Administration?</p>
<p><div id="attachment_907" class="wp-caption alignleft" style="width: 650px"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/store-dhs.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/store-dhs.png" alt="" title="store-dhs" width="640" height="409" class="size-full wp-image-907" /></a><p class="wp-caption-text">Who&#039;s this shopping in my store?</p></div><br />
<br clear="all"/><br />
I used an IP lookup tool to <a target="_blank" href="http://whois.domaintools.com/216.81.80.134">check the IP address for 216.81.80.134</a>. Sure enough, it was Homeland Security.  That was easy.</p>
<p><div id="attachment_903" class="wp-caption alignleft" style="width: 650px"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/dhs_iplookup.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/dhs_iplookup.png" alt="" title="dhs_iplookup" width="640" height="557" class="size-full wp-image-903" /></a><p class="wp-caption-text">IP address lookup confirms that the shopper is from DHS</p></div><br />
<br clear="all"/><br />
This isn&#8217;t the kind of attention I want.  I decided to check my Google Analytics console to see if I could learn anything about who was visiting my site that day.  One of the things you can look at is the service providers that your visitors are coming from.  This isn&#8217;t usually very interesting, because it&#8217;s just Comcast, Verizon, etc.  But this day was different.  I was absolutely shocked to find that over 5% of my traffic was coming from one location.</p>
<p><div id="attachment_902" class="wp-caption alignleft" style="width: 650px"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/analytics-dhs.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/analytics-dhs.png" alt="" title="analytics-dhs" width="640" height="480" class="size-full wp-image-902" /></a><p class="wp-caption-text">Over 5% of my visitors on Sept. 9 were from Department of Homeland Security</p></div><br />
<br clear="all"/><br />
That&#8217;s right &#8212; dozens of distinct visitors were from Homeland Security, and the number was rising steadily.  By mid-day over 100 people at Homeland Security had hit my site.</p>
<p>Uh oh.</p>
<p>I had not done anything wrong, but I really didn&#8217;t want a personal visit from Homeland Security, the FBI, or SEAL Team Six.  In late morning, my wife called me at the office from home &#8212; I was sure that gentlemen in dark suits were at the door, but it was a false alarm.  I was feeling paranoid.</p>
<p>Could the government really be that interested in me?  Maybe looking at a map of my U.S. visitors would make me feel better&#8230;</p>
<p><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/map_overlay.png"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/09/map_overlay.png" alt="" title="map_overlay" width="640" height="377" class="size-full wp-image-923" /></a><br />
<br clear="all"/><br />
Nope.</p>
<p>The statistics indicated that the visitors were not spending more than a minute on average on the site.  They were taking a quick look, then leaving.  My theory is that maybe a link to my Defusable Clock was included in some morning briefing or something, and a bunch of people checked it out.  What do you think?</p>
<p>Nonetheless, I felt compelled to add this paragraph to the clock project post, hoping it might defuse the situation (pun intended):</p>
<hr/>
<span class="highlight"><b>Dear friends at the U.S. Department of Homeland Security:</b></span><br />
I can see from my logs that you are very interested in my project, but I assure you that this is just a clock. There is nothing dangerous in these photographs; just wooden dowels and clay. I sell DIY electronic kits for customers to assemble themselves, and plan to sell the electronic components for this clock as a kit. It is no more dangerous than any other alarm clock. I would never sell or ship anything that looks like a dangerous substance or device as shown in the photos below.  <i>I’m on your side.</i> So, we’re cool, right?</p>
<hr/>
<br clear="all"/><br />
The hits from DHS came to a stop around 4:30pm EDT as government employees headed home for the weekend, so I started to feel better.  Their visits declined over the 9/11 weekend and were a mere trickle this week.  I successfully flew to NYC yesterday (Thursday the 15th) to attend World Maker Faire this weekend.  If you see me at Maker Faire, make sure to come up and say &#8220;glad you made it!&#8221;.  I&#8217;ll be wearing <a target="_blank" href="http://nootropicdesign.com/projectlab/2011/05/21/pcb-tshirt/">this shirt with an image of my Video Experimenter board design</a>.  See you there (hopefully)!</p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2011/09/16/watching-the-feds-watch-me/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Defusable Clock</title>
		<link>http://nootropicdesign.com/projectlab/2011/09/05/defusable-clock/</link>
		<comments>http://nootropicdesign.com/projectlab/2011/09/05/defusable-clock/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 12:06:46 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Art]]></category>

		<guid isPermaLink="false">http://nootropicdesign.com/projectlab/?p=865</guid>
		<description><![CDATA[The Defusable Clock kit is NOW AVAILABLE FOR PURCHASE! This may look like a dangerous device, but it&#8217;s really just an ordinary alarm clock &#8212; with a twist. &#160; I thought it would be fun to build an alarm clock that looks just like the type of bomb that we always see in Hollywood movies. [...]]]></description>
				<content:encoded><![CDATA[<p><br/><br />
<span class="highlight"><b>The Defusable Clock kit is <span style="text-decoration:underline;"><a href="http://nootropicdesign.com/defusableclock/">NOW AVAILABLE FOR PURCHASE!</a></span></b></span><br />
<br/><br />
This may look like a dangerous device, but it&#8217;s really just an ordinary alarm clock &#8212; with a twist.<br />
<br />
<a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/dynamite1-large.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/dynamite1-sm.jpg" alt="" title="dynamite1-sm" width="640" height="480" class="alignleft size-full wp-image-863" /></a><br />
&nbsp;<br clear="all"><br />
I thought it would be fun to build an alarm clock that looks just like the type of bomb that we always see in Hollywood movies.  I certainly don&#8217;t know anything about how a real bomb might look, but in the movies they always have sticks of dynamite strapped together, a red digital readout, and a bunch of curly wires.  Instead of just building an ordinary clock, I thought it should have a detonation sequence with a scary countdown just like in the movies.  And why not make it &#8220;defusable&#8221; so I an try to stop the countdown by cutting the correct wire?<br />
<br />
<iframe width="640" height="480" src="http://www.youtube.com/embed/yB-XQtM5RuA" frameborder="0" allowfullscreen></iframe></p>
<p>The Defusable Clock is a fully-functional alarm clock just like you&#8217;d expect (a normal beeping alarm, snooze alarm, etc.).  But at any time you can press the big red button to start a scary countdown sequence exactly like bombs in Hollywood movies.  There are 4 wires across the top of the clock.  You have 10 seconds to choose the correct wire to cut: one wire stops the countdown and saves the day, two have no effect, and one will &#8220;detonate&#8221; the device immediately.  These role of each wire is randomly assigned when the detonate button is pressed, so it&#8217;s a new challenge every time.  Also, the wires are attached with screw terminals, so you can replace them easily.  If you don&#8217;t want to actually cut the wires, you can just pull them out of the screw terminals if you keep the screws a little loose.</p>
<p>The microcontroller is an ATmega328 with the Arduino bootloader, so this clock is programmable with the Arduino IDE.  The ATmega328 is certainly more powerful than needed for a clock, but this device has lots of inputs/outputs, and ATmega328 chips are now about the same price as the older ATmega168.  It keeps very accurate time and requires a simple 9V &#8220;wall wart&#8221; power adapter.  A special alarm mode lets you even use the countdown sequence as the alarm and require it to be defused when you wake up in the morning.  What a stressful way to start the day!</p>
<p>We are going to offer this as an electronics kit later this fall.  Only the electronics will be in the kit &#8212; nothing that looks like dangerous explosives!  With some imagination, I&#8217;m sure you can make a great looking Defusable Clock for yourself, but don&#8217;t go scaring anyone with it, and don&#8217;t bring it anywhere near an airport, ok?  The product page will have plenty of warnings not to use this kit for any evil purposes or get into trouble with your school, employer, or local law enforcement!  There will also be a picture gallery where you can submit a picture of your clock after you build it.</p>
<p><span class="highlight"><b>UPDATE: the Defusable Clock kit is <a href="http://nootropicdesign.com/defusableclock/">NOW AVAILABLE FOR PURCHASE!</a></b></span></p>
<p>I&#8217;m sure some of you will have some ideas and comments, so please leave them below.  Keep in mind that this is no more dangerous than any other alarm clock, and yes, we have already spoken to a lawyer about all of this.</p>
<p>Here&#8217;s one more version I made using clay for plastic explosives:</p>
<div id="attachment_978" class="wp-caption alignleft" style="width: 650px"><a href="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/c4-large.jpg"><img src="http://nootropicdesign.com/projectlab/wp-content/uploads/2011/10/c4-sm.jpg" alt="" title="c4-sm" width="640" height="689" class="size-full wp-image-978" /></a><p class="wp-caption-text">Clay used to simulate C4</p></div>
<p><br clear="all"/></p>
]]></content:encoded>
			<wfw:commentRss>http://nootropicdesign.com/projectlab/2011/09/05/defusable-clock/feed/</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
	</channel>
</rss>
