﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <channel>
    <title>Paul's Electronics</title>
    <description>Adventures in building, hacking, tinkering...</description>
    <link>http://www.sqlskills.com/blogs/paulselec/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.4.5.0</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://www.sqlskills.com/blogs/paulselec/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>This weblog is sponsored by &lt;a href="http://www.SQLskills.com"&gt;SQLskills&lt;/a&gt;. </blogChannel:blink>
    <dc:creator>Paul Randal</dc:creator>
    <dc:title>Paul's Electronics</dc:title>
    <item>
      <title>Why switch debouncing is so important...</title>
      <description>&lt;p&gt;
Here&amp;#39;s a graphic illustration of why mechanical switch debouncing is so important:
&lt;/p&gt;
&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2019%2f10%2fNewFile3.jpg" alt="" /&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
It&amp;#39;s the output of a push-button switch when I press it. The metal contacts inside the switch bounce against each other, creating two pulses when I expected just one. If I&amp;#39;d been debugging something sensitive to pulses, like using the output as a clock pulse, this would have messed up the debugging.
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
There are various methods of debouncing switches, and the most common is to use an&amp;nbsp;&lt;a href="https://en.wikibooks.org/wiki/Digital_Circuits/Latches" target="_blank"&gt;S-R latch&lt;/a&gt;.&amp;nbsp;
&lt;/div&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Why-switch-debouncing-is-so-important.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Why-switch-debouncing-is-so-important.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=0d45d595-7691-43e4-b53b-150faa0159f8</guid>
      <pubDate>Sat, 26 Oct 2019 13:58:00 -0800</pubDate>
      <category>General</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=0d45d595-7691-43e4-b53b-150faa0159f8</pingback:target>
      <slash:comments>35</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=0d45d595-7691-43e4-b53b-150faa0159f8</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Why-switch-debouncing-is-so-important.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=0d45d595-7691-43e4-b53b-150faa0159f8</wfw:commentRss>
    </item>
    <item>
      <title>Smoothing capacitors on power lines</title>
      <description>&lt;p&gt;
Well, the best laid plans of mice and men, and all that. Now I&amp;#39;ve got a long-term project to finally get back into electronics and blogging after an almost 10 year gap.
&lt;/p&gt;
&lt;p&gt;
I&amp;#39;m building an 8-bit computer on breadboards, based on the kit and videos by Ben Eater - see&amp;nbsp;&lt;a href="https://eater.net/8bit" target="_blank"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The first thing I want to blog about is something new I learned today. I&amp;#39;d always known how putting small ceramic capacitors across power lines helps to smooth out logic transitions and prevent spurious problems, but I didn&amp;#39;t know about using larger capacitors for the same purpose.
&lt;/p&gt;
&lt;p&gt;
Below is a scope plot of the rising edge of the output from a 555 clock circuit, with a 1us timebase, and no smoothing capacitors:
&lt;/p&gt;
&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2019%2f10%2fNewFile0.jpg" alt="" /&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
You can see that when the transistors in the 555 switch on, there&amp;#39;s a big pull from the power supply and the output voltage spikes momentarily.
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
This next plot is with a 0.01uF ceramic capacitor across the power lines:&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2019%2f10%2fNewFile1.jpg" alt="" /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
You can see that the voltage spike isn&amp;#39;t so high, but then oscillates down to a steady state over a few microseconds.
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
Finally, here&amp;#39;s a plot with a 10uF electrolytic capacitor across the power lines:
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2019%2f10%2fNewFile2.jpg" alt="" /&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
You can see that the rising edge is super-smooth as the capacitor provides all the necessary power without the big pull from the power supply.
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
You learn something every day!
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;
&lt;/div&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Smoothing-capacitors-on-power-lines.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Smoothing-capacitors-on-power-lines.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=6b52e38e-e1b5-4233-9e46-56878255e3f7</guid>
      <pubDate>Fri, 25 Oct 2019 15:42:00 -0800</pubDate>
      <category>555</category>
      <category>8-bit computer</category>
      <category>General</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=6b52e38e-e1b5-4233-9e46-56878255e3f7</pingback:target>
      <slash:comments>35</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=6b52e38e-e1b5-4233-9e46-56878255e3f7</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Smoothing-capacitors-on-power-lines.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=6b52e38e-e1b5-4233-9e46-56878255e3f7</wfw:commentRss>
    </item>
    <item>
      <title>Bouncing Ball with a Newhaven Display 160x128 RGB OLED</title>
      <description>&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;
Wow - it&amp;#39;s been more than 6 years since I had some serious time to play with electronics and blogged here! Life and work just got in the way.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;
After spending about a week sorting out my desk/lab area, arranging everything nicely and taking stock of all the kits, boards, components and tools I&amp;#39;ve got, I&amp;#39;m ready to start playing and blogging again.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;
The first thing I decided to play with is an Arduino shield from&amp;nbsp;&lt;a href="http://www.newhavendisplay.com/" target="_blank"&gt;Newhaven Display&lt;/a&gt;&amp;nbsp;that has one of their 1.69-inch 160x128 RGB OLED display modules. It cost $50.95 and I ordered it directly from them&amp;nbsp;&lt;a href="http://www.newhavendisplay.com/nhd169aushield-p-9482.html" target="_blank"&gt;here&lt;/a&gt;.
&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;
It&amp;#39;s a really nice looking board and I got it working very quickly using the example sketch they&amp;#39;ve posted on GitHub&amp;nbsp;&lt;a href="https://github.com/NewhavenDisplay/NHD-1.69-160128ASC3_Example" target="_blank"&gt;here&lt;/a&gt;. When you compile and upload the sketch, this is the result:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;
&amp;nbsp;&lt;img src="/blogs/paulselec/content/binary/BouncyBall/small_IMG_1750.jpg" alt="" /&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;I figured I&amp;#39;d play around with it so decided to write a classic bouncing ball zipping around the screen. I figured out how to use their interface, ripped out all the superfluous code from the example, and got it working.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;You can see a very short YouTube video of it in action&amp;nbsp;&lt;a href="https://youtu.be/kOrU_at4F0w" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;And below is the code.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana, geneva" size="2"&gt;Enjoy!&lt;/font&gt;
&lt;/p&gt;
&lt;pre&gt;
&lt;font face="courier new, courier" size="2"&gt;//---------------------------------------------------------
//---------------------------------------------------------
/*
Newhaven_Bounce
Adapted from Newhaven example code
*/
//---------------------------------------------------------
// The 8 bit data bus is connected to PORTD[7..0]
#define   SDI_PIN   11    // SDI (serial mode) signal connected to pin 11
#define   SCL_PIN   13    // SCL (serial mdoe) signal connected to pin 13
#define    RS_PIN    4    // RS signal connected to pin 4
#define   RES_PIN   6     // /RES signal connected to pin 6
#define    CS_PIN   5     // /CS signal connected to pin 5
#define    PS_PIN   A0    // PS signal connected to pin A0
#define   CPU_PIN   A1    // CPU signal connected to pin A1
#define   LVL_DIR   A2    // DIR (direction control) signal of level shifter IC connected to pin A2
#define   LVL_OEN   A3    // /OE (output enable) signal of level shifter IC connected to pin A3
#define    RED  0x0000FF
#define  GREEN  0x00FF00
#define   BLUE  0xFF0000
#define  WHITE  0xFFFFFF
#define  BLACK  0x000000
/*********************************/
/****** LOW LEVEL FUNCTIONS ******/
/************* START *************/
/*********************************/
// Send command to OLED
void OLED_Command_160128RGB (unsigned char c)
{
unsigned char i;
unsigned char mask = 0x80;
digitalWrite (CS_PIN, LOW);
digitalWrite (RS_PIN, LOW);
for(i = 0; i &amp;lt; 8; i++)
{
digitalWrite (SCL_PIN, LOW);
if((c &amp;amp; mask) &amp;gt;&amp;gt; 7 == 1)
{
digitalWrite (SDI_PIN, HIGH);
}
else
{
digitalWrite (SDI_PIN, LOW);
}
digitalWrite (SCL_PIN, HIGH);
c = c &amp;lt;&amp;lt; 1;
}
digitalWrite (CS_PIN, HIGH);
} // OLED_Command_160128RGB
// Send data to OLED
void OLED_Data_160128RGB (unsigned char d)
{
unsigned char i;
unsigned char mask = 0x80;
digitalWrite (CS_PIN, LOW);
digitalWrite (RS_PIN, HIGH);
for(i = 0; i &amp;lt; 8; i++)
{
digitalWrite (SCL_PIN, LOW);
if((d &amp;amp; mask) &amp;gt;&amp;gt; 7 == 1)
{
digitalWrite (SDI_PIN, HIGH);
}
else
{
digitalWrite (SDI_PIN, LOW);
}
digitalWrite (SCL_PIN, HIGH);
d = d &amp;lt;&amp;lt; 1;
}
digitalWrite (CS_PIN, HIGH);
} // OLED_Data_160128RGB
// Serial write for pixel data
void OLED_SerialPixelData_160128RGB (unsigned char d)
{
unsigned char i;
unsigned char mask = 0x80;
digitalWrite (CS_PIN, LOW);
digitalWrite (RS_PIN, HIGH);
for(i = 0; i &amp;lt; 6; i++)
{
digitalWrite (SCL_PIN, LOW);
if ((d &amp;amp; mask) &amp;gt;&amp;gt; 7 == 1)
{
digitalWrite (SDI_PIN, HIGH);
}
else
{
digitalWrite (SDI_PIN, LOW);
}
digitalWrite (SCL_PIN, HIGH);
d = d &amp;lt;&amp;lt; 1;
}
digitalWrite (CS_PIN, HIGH);
} // OLED_SerialPixelData_160128RG
// Write to RAM command
void OLED_WriteMemoryStart_160128RGB (void)
{
OLED_Command_160128RGB (0x22);
} // OLED_WriteMemoryStart_160128RGB
// Write one pixel of a given color
void OLED_Pixel_160128RGB (unsigned long color)
{
OLED_SerialPixelData_160128RGB (color &amp;gt;&amp;gt; 16);
OLED_SerialPixelData_160128RGB (color &amp;gt;&amp;gt; 8);
OLED_SerialPixelData_160128RGB (color);
}
// Set x,y pixel address
void OLED_SetPosition_160128RGB (unsigned char x_pos, unsigned char y_pos)
{
OLED_Command_160128RGB (0x20);
OLED_Data_160128RGB (x_pos);
OLED_Command_160128RGB (0x21);
OLED_Data_160128RGB (y_pos);
} // OLED_SetPosition_160128RGB
// Fill screen with a given color
void OLED_FillScreen_160128RGB (unsigned long color)
{
unsigned int i;
OLED_SetPosition_160128RGB (0, 0);
OLED_WriteMemoryStart_160128RGB ();
for(i = 0; i &amp;lt; 20480; i++)
{
OLED_Pixel_160128RGB(color);
}
} // OLED_FillScreen_160128RGB
/*===============================*/
/*===== LOW LEVEL FUNCTIONS =====*/
/*============= END =============*/
/*===============================*/
/*********************************/
/******** INITIALIZATION *********/
/************ START **************/
/*********************************/
// OLED initialization
void OLED_Init_160128RGB (void)
{
digitalWrite (RES_PIN, LOW);
delay (2);
digitalWrite (RES_PIN, HIGH);
delay (2);
// Display off, analog reset
OLED_Command_160128RGB (0x04);
OLED_Data_160128RGB (0x01);
delay (1);
// Normal mode
OLED_Command_160128RGB (0x04); 
OLED_Data_160128RGB (0x00); 
delay (1);
// Display off
OLED_Command_160128RGB (0x06);
OLED_Data_160128RGB (0x00);
delay (1);
// Turn on internal oscillator using external resistor
OLED_Command_160128RGB (0x02);
OLED_Data_160128RGB (0x01); 
// 90 hz frame rate, divider 0
OLED_Command_160128RGB (0x03);
OLED_Data_160128RGB (0x30); 
// Duty cycle 127
OLED_Command_160128RGB (0x28);
OLED_Data_160128RGB (0x7F);
// Start on line 0
OLED_Command_160128RGB (0x29);
OLED_Data_160128RGB (0x00); 
// rgb_if
OLED_Command_160128RGB (0x14);
OLED_Data_160128RGB (0x31); 
// Set Memory Write Mode
OLED_Command_160128RGB (0x16);
OLED_Data_160128RGB (0x76);
// Driving current r g b (uA)
OLED_Command_160128RGB (0x10);
OLED_Data_160128RGB (0x45);
OLED_Command_160128RGB (0x11);
OLED_Data_160128RGB (0x34);
OLED_Command_160128RGB (0x12);
OLED_Data_160128RGB (0x33);
// Precharge time r g b
OLED_Command_160128RGB (0x08);
OLED_Data_160128RGB (0x04);
OLED_Command_160128RGB (0x09);
OLED_Data_160128RGB (0x05);
OLED_Command_160128RGB (0x0A);
OLED_Data_160128RGB (0x05);
// Precharge current r g b (uA)
OLED_Command_160128RGB (0x0B);
OLED_Data_160128RGB (0x9D);
OLED_Command_160128RGB (0x0C);
OLED_Data_160128RGB (0x8C);
OLED_Command_160128RGB (0x0D);
OLED_Data_160128RGB (0x57);
// Set Reference Voltage Controlled by External Resister
OLED_Command_160128RGB (0x80);
OLED_Data_160128RGB (0x00);
// Mode set
OLED_Command_160128RGB (0x13);
OLED_Data_160128RGB (0xA0);
// Set column address start + end
OLED_Command_160128RGB (0x17);
OLED_Data_160128RGB (0);
OLED_Command_160128RGB (0x18);
OLED_Data_160128RGB (159);
// Set row address start + end
OLED_Command_160128RGB (0x19);
OLED_Data_160128RGB (0);
OLED_Command_160128RGB (0x1A);
OLED_Data_160128RGB (127);
// Display On
OLED_Command_160128RGB (0x06);
OLED_Data_160128RGB (0x01); 
}
/*===============================*/
/*======= INITIALIZATION ========*/
/*============= END =============*/
/*===============================*/
void setup ()
{
pinMode (LVL_OEN, OUTPUT);      // configure LVL_OEN as output
digitalWrite (LVL_OEN, LOW);
pinMode (LVL_DIR, OUTPUT);      // configure LVL_DIR as output
digitalWrite (LVL_DIR, HIGH);
DDRD = 0xFF;                    // configure PORTD as output
pinMode (RS_PIN, OUTPUT);       // configure RS_PIN as output
pinMode (RES_PIN, OUTPUT);      // configure RES_PIN as output
pinMode (CS_PIN, OUTPUT);       // configure CS_PIN as output
pinMode (PS_PIN, OUTPUT);       // configure PS_PIN as output
pinMode (CPU_PIN, OUTPUT);      // configure CPU_PIN as output
digitalWrite (LVL_OEN, LOW);
digitalWrite (CS_PIN, HIGH);    // set CS_PIN
pinMode (SDI_PIN, OUTPUT);      // configure SDI_PIN as output
pinMode (SCL_PIN, OUTPUT);      // configure SCL_PIN as output
PORTD = 0x00;                   // reset SDI_PIN and SCL_PIN, ground DB[5..0] of the display
digitalWrite (PS_PIN, LOW);     // reset PS_PIN
Serial.begin (57600);
}
void loop()
{
// Initialize the display
OLED_Init_160128RGB();
// Emtpy the screen
OLED_FillScreen_160128RGB(BLACK);
unsigned int xPosition = 0;
unsigned int yPosition = 0;
int xDirection = 1;
int yDirection = 1;
// Bouncing ball
while (1)
{
Serial.print (xPosition, DEC);
Serial.print (&amp;quot;, &amp;quot;);
Serial.println (yPosition, DEC);
OLED_SetPosition_160128RGB (xPosition, yPosition);
OLED_WriteMemoryStart_160128RGB ();
OLED_Pixel_160128RGB (WHITE);
if (xPosition == 0)
{
xDirection = 1;
}
else if (xPosition == 159)
{
xDirection = -1;
}
if (yPosition == 0)
{
yDirection = 1;
}
else if (yPosition == 127)
{
yDirection = -1;
}
delay (10);
OLED_SetPosition_160128RGB (xPosition, yPosition);
OLED_WriteMemoryStart_160128RGB ();
OLED_Pixel_160128RGB (BLACK);
xPosition += xDirection;
yPosition += yDirection;  
}
}&lt;/font&gt;
&lt;/pre&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Bouncing-Ball-with-a-Newhaven-Display-160x128-RGB-OLED.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Bouncing-Ball-with-a-Newhaven-Display-160x128-RGB-OLED.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=999999f8-e01f-4dc0-bbdb-6bb6c0d62af7</guid>
      <pubDate>Sat, 04 Feb 2017 14:52:00 -0800</pubDate>
      <category>Arduino</category>
      <category>Example Code</category>
      <category>OLED display</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=999999f8-e01f-4dc0-bbdb-6bb6c0d62af7</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=999999f8-e01f-4dc0-bbdb-6bb6c0d62af7</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Bouncing-Ball-with-a-Newhaven-Display-160x128-RGB-OLED.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=999999f8-e01f-4dc0-bbdb-6bb6c0d62af7</wfw:commentRss>
    </item>
    <item>
      <title>Kit building: vacuum fluorescent display clock</title>
      <description>&lt;p&gt;
I&amp;#39;ve always been intrigued by &lt;a href="http://en.wikipedia.org/wiki/Vacuum_fluorescent_display"&gt;vacuum fluorescent displays&lt;/a&gt; (VFDs) so I picked up the &lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=39&amp;amp;products_id=194"&gt;Ice Tube Clock Kit&lt;/a&gt; from &lt;a href="http://www.adafruit.com/"&gt;AdaFruit Industries&lt;/a&gt; that uses a Russian VFD tube. 
&lt;/p&gt;
&lt;p&gt;
(Click any photo for a 1024x768 image.) 
&lt;/p&gt;
&lt;p&gt;
Here&amp;#39;s what came in the kit: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000421.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000421.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
And here are a couple of shots of the VFD tube. It has 8 x 7-segment digits, with decimal points and a minus sign. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000424.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000424.JPG" alt="" /&gt;&lt;/a&gt; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000425.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000425.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
There&amp;#39;s a great page on AdaFruit&amp;#39;s website that describes the circuit and the calculations that went into designing it - &lt;a href="http://www.ladyada.net/make/icetube/design.html"&gt;check it out&lt;/a&gt;! 
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="http://www.ladyada.net/make/icetube/solder.html"&gt;building instructions&lt;/a&gt; are very thorough, as always, and this time includes test points as building progresses.&amp;nbsp;On the left is&amp;nbsp;a shot of testing the 7805 regulator, and on the right is testing the voltage booster circuit for the VFD. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000426.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000426.JPG" alt="" /&gt;&lt;/a&gt; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000428.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000428.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Once I had the main board made, it was time to thread the VFD into it&amp;#39;s PCB. This was a finnicky task but with patience it only took 15 minutes. The leads from the VFD bend very easily, which is a blessing and a curse. On the left you can see what I mean, and on the right I&amp;#39;ve got it ready to solder. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000429.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000429.JPG" alt="" /&gt;&lt;/a&gt; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000430.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000430.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
And here&amp;#39;s it soldered and nicely clipped. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000432.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000432.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Did a quick test and it worked! Then I put in the final few components on the main board and assembled the laser-cut perspex case. 
&lt;/p&gt;
&lt;p&gt;
Here are a couple of shots of the completed main PCB: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000434.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000434.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000435.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000435.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
And the clock itself... and in it&amp;#39;s final resting place. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000437.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000437.JPG" alt="" /&gt;&lt;/a&gt; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/IceTube/P1000438.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fSmallP1000438.JPG" alt="" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Hope you enjoyed the photos - let me know if these kinds of posts are interesting! 
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-vacuum-fluorescent-display-clock.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-vacuum-fluorescent-display-clock.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=58f1ee4a-7299-49c5-a815-3c46ac87009d</guid>
      <pubDate>Sat, 18 Dec 2010 14:51:00 -0800</pubDate>
      <category>Kit Building</category>
      <category>VFD</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=58f1ee4a-7299-49c5-a815-3c46ac87009d</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=58f1ee4a-7299-49c5-a815-3c46ac87009d</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-vacuum-fluorescent-display-clock.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=58f1ee4a-7299-49c5-a815-3c46ac87009d</wfw:commentRss>
    </item>
    <item>
      <title>More Arduino shields to play with...</title>
      <description>&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;It&amp;#39;s been quite a while since I&amp;#39;ve had bandwidth to sit down and get stuck into electronics again, but now I&amp;#39;m home for almost two months, so I&amp;#39;ll be blogging more on here. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Over the last few months I&amp;#39;ve discovered some new Arduino shields to play with and ordered them up. Here&amp;#39;s what I got: &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;1) The &lt;/font&gt;&lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=17_21&amp;amp;products_id=196"&gt;&lt;font face="verdana,geneva" size="2"&gt;Wingshield Screwshield&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; kit from &lt;/font&gt;&lt;a href="http://www.adafruit.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;Adafruit Industries&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. Took me about 5 minutes to solder together. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fwingshield_MED.jpg" alt="" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;2) The &lt;/font&gt;&lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=17_21&amp;amp;products_id=81"&gt;&lt;font face="verdana,geneva" size="2"&gt;Motor/Stepper/Servo Shield kit&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://www.adafruit.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;Adafruit Industries&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. Took me about 1/2 hour to solder together. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fmshieldclose_MED.jpg" alt="" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;3) The &lt;/font&gt;&lt;a href="http://www.sparkfun.com/products/9026"&gt;&lt;font face="verdana,geneva" size="2"&gt;Arduino Ethernet Shield with micro SD connector&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. This comes assembled and I got it from &lt;/font&gt;&lt;a href="http://www.sparkfun.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;SparkFun Electronics&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2farduinoeshield_MED.jpg" alt="" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;4) The &lt;/font&gt;&lt;a href="http://asynclabs.com/store?page=shop.product_details&amp;amp;flypage=flypage.tpl&amp;amp;product_id=26&amp;amp;category_id=6"&gt;&lt;font face="verdana,geneva" size="2"&gt;WiShield&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://asynclabs.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;async_labs&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; that provides 802.11b wireless. This also comes assembled. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2fwishield2.jpg" alt="" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;5) The &lt;/font&gt;&lt;a href="http://www.sparkfun.com/products/9760"&gt;&lt;font face="verdana,geneva" size="2"&gt;Joystick Shield Kit&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://www.sparkfun.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;SparkFun Electronics&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. Took about 15 minutes to solder together. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2f09895-02.jpg" alt="" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;6) The &lt;/font&gt;&lt;a href="http://www.sparkfun.com/products/9363"&gt;&lt;font face="verdana,geneva" size="2"&gt;Color LCD Shield&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://www.sparkfun.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;SparkFun Electronics&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. This just needed the headers soldered on. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f12%2f09363-01b.jpg" alt="" /&gt;&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Lots of potential for tinkering and cool stuff here!&lt;/font&gt; 
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/More-Arduino-shields-to-play-with.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/More-Arduino-shields-to-play-with.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=b950c9dd-008e-4a8c-b3a4-131176aab05f</guid>
      <pubDate>Sat, 18 Dec 2010 12:14:00 -0800</pubDate>
      <category>Arduino</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=b950c9dd-008e-4a8c-b3a4-131176aab05f</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=b950c9dd-008e-4a8c-b3a4-131176aab05f</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/More-Arduino-shields-to-play-with.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=b950c9dd-008e-4a8c-b3a4-131176aab05f</wfw:commentRss>
    </item>
    <item>
      <title>Kit building: Four interactive light panels connected together</title>
      <description>&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Well, summer&amp;#39;s over and that means I can justify being indoors playing with (and blogging about) electronics again. Expect this blog to get busy again! &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Back in March&amp;nbsp;I &lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Evil-Mad-Science-interactive-light-board.aspx"&gt;&lt;font face="verdana,geneva" size="2"&gt;blogged&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; about building an &lt;/font&gt;&lt;a href="http://evilmadscience.com/majors/150-panelkits"&gt;&lt;font face="verdana,geneva" size="2"&gt;interactive light panel&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://evilmadscience.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;Evil Mad Science Laboratories&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. Over the summer I built the other three light panel kits I&amp;#39;d ordered and finally got around to hooking them together and testing them out. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;They fit together using 8-pin connectors in any configuration imaginable. Below are two photos of the connectors (borrowed from their website): &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f10%2fconn1.JPG" alt="" width="240" height="180" /&gt; &lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f10%2fconn2.JPG" alt="" width="240" height="180" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Below are three photos showing my four panels in a variety of configurations (click for larger versions): &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/BigP1050056.jpg"&gt;&lt;font face="verdana,geneva" size="2"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f10%2fSmallP1050056.JPG" alt="" width="223" height="314" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; &lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/BigP1050064.jpg"&gt;&lt;font face="verdana,geneva" size="2"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f10%2fSmallP1050064.JPG" alt="" width="166" height="314" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/BigP1050062.jpg"&gt;&lt;font face="verdana,geneva" size="2"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f10%2fSmallP1050062.JPG" alt="" width="314" height="208" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Finally, I shot some short videos showing the 1 x 4 configuration in action:&lt;/font&gt; 
&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=28PRAPQeaes"&gt;&lt;font face="verdana,geneva" size="2"&gt;http://www.youtube.com/watch?v=28PRAPQeaes&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;(in daylight)&lt;/font&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=iOIx_0jYDlE"&gt;&lt;font face="verdana,geneva" size="2"&gt;http://www.youtube.com/watch?v=iOIx_0jYDlE&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;(in darkness - very cool!)&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Next up will be some more Arduino stuff...&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&lt;/font&gt;
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Four-interactive-light-panels-connected-together.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Four-interactive-light-panels-connected-together.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=476e8afb-6b20-45e3-9717-3b6538bb1c7d</guid>
      <pubDate>Sat, 02 Oct 2010 07:24:00 -0800</pubDate>
      <category>Kit Building</category>
      <category>LED Projects</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=476e8afb-6b20-45e3-9717-3b6538bb1c7d</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=476e8afb-6b20-45e3-9717-3b6538bb1c7d</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Four-interactive-light-panels-connected-together.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=476e8afb-6b20-45e3-9717-3b6538bb1c7d</wfw:commentRss>
    </item>
    <item>
      <title>Kit building: Evil Mad Science interactive light board</title>
      <description>&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;It&amp;#39;s been another few weeks of traveling and client work so I haven&amp;#39;t had any chance to tinker. Apologies to those subscribers expecting the frenetic pace of my &lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paul/"&gt;&lt;font face="verdana,geneva" size="2"&gt;SQL blog&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; - ain&amp;#39;t gonna happen. I&amp;#39;m at home for a few weeks now though, so should have spare cycles to get back to the Arduino. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;This week I decided to build a kit, as I didn&amp;#39;t have time to get stuck into something more intellectually challenging. A while ago I&amp;#39;d ordered a set of 4 &lt;/font&gt;&lt;a href="http://evilmadscience.com/majors/150-panelkits"&gt;&lt;font face="verdana,geneva" size="2"&gt;interactive light panel kits&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; from &lt;/font&gt;&lt;a href="http://evilmadscience.com/"&gt;&lt;font face="verdana,geneva" size="2"&gt;Evil Mad Science&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; so I chose to make one of those (I&amp;#39;ve also got an &lt;/font&gt;&lt;a href="http://evilmadscience.com/tinykitlist/75-peggy2"&gt;&lt;font face="verdana,geneva" size="2"&gt;RGB Peggy 2 board&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; that I&amp;#39;m itching to make!). &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;I&amp;#39;m very impressed with the kit - the instructions are *excellent* - totally suitable for a novice, but easily digestable by someone more advanced without being annoyingly simple. The packaging is great too - with all components packed and labeled separately - not something I expect, but a nice time saver. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;The kit took me about 4&amp;nbsp;hours of soldering and neat lead-snipping to put together. I powered it on and it worked first time. However, it&amp;#39;s supposed to work in the dark and I couldn&amp;#39;t get anything out of it. The board looked perfectly put together so I contacted Evil Mad Science. Windell replied within 90 minutes with some suggestions. I replied that I&amp;#39;ve got a degree in electronics so talk techie - smileys ensued and we troubleshooted (troubleshot?). I&amp;#39;d hooked up a spare IR LED and shown that the phototransistors were working, but obviously the IR LEDs on the board weren&amp;#39;t - with only about 10mV foward voltage across each. The whole IR LED circuit has 24V through it, so something was sucking down the power. I traced it to a broken IR LED with very high resistance both ways, and taking 18V - no wonder it wasn&amp;#39;t working. I swapped out the broken LED and put in another, and hey presto! Great technical support!&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Great kit to put together and I&amp;#39;m going to build a wall tile to hang in the house somewhere! &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Here&amp;#39;s a link to a 25sec video I shot on YouTube: &lt;/font&gt;&lt;a href="http://www.youtube.com/watch?v=51dUYjEgTi8"&gt;&lt;font face="verdana,geneva" size="2"&gt;http://www.youtube.com/watch?v=51dUYjEgTi8&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Here are some photos (click for larger images): &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Left: kit contents for one board. Right: PCB (*really* well produced). &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/P1020805.JPG"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f3%2fSmallP1020805.JPG" alt="" width="283" height="212" /&gt; &lt;/a&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/P1020806.JPG"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f3%2fSmallP1020806.JPG" alt="" width="283" height="212" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Left: ready to start soldering. Right: Completed board ready for testing. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/P1020807.JPG"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f3%2fSmallP1020807.JPG" alt="" width="283" height="212" /&gt;&lt;/a&gt; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/EvilMadScience/P1020885.JPG"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f3%2fSmallP1020885.JPG" alt="" width="283" height="212" /&gt;&lt;/a&gt; 
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Evil-Mad-Science-interactive-light-board.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Evil-Mad-Science-interactive-light-board.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=52e1aecd-eb1b-4481-a397-300b1d6449c1</guid>
      <pubDate>Fri, 12 Mar 2010 12:53:00 -0800</pubDate>
      <category>Kit Building</category>
      <category>LED Projects</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=52e1aecd-eb1b-4481-a397-300b1d6449c1</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=52e1aecd-eb1b-4481-a397-300b1d6449c1</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Evil-Mad-Science-interactive-light-board.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=52e1aecd-eb1b-4481-a397-300b1d6449c1</wfw:commentRss>
    </item>
    <item>
      <title>Arduino: Windows simulator of driving matrices of 8x8 LED arrays</title>
      <description>&lt;p&gt;
It&amp;#39;s been a couple of weeks since I&amp;#39;ve been able to play hands-on with electronics because I&amp;#39;ve been busy with client work and out-of-town traveling. 
&lt;/p&gt;
&lt;p&gt;
To continue satisfying my must-be-tinkering-with-something urges, I hit upon the idea of using some old Windows code I had lying around to allow me to program LED matrices, without the LED matrices or an Arduino. This means I can effectively be developing code for the Arduino while on the road (we travel around 50% of the year seeing our clients around the world). The old code was for a life simulator (creatures running around fighting, breeding, etc) but it had all the code to display a bitmap on screen and update it already worked out. I figured that I could use it to simulate an 8x8 LED matrix - so off I went. 
&lt;/p&gt;
&lt;p&gt;
What it turned into is a couple of classes that simulate a maze and an 8x8, 16x16, or 32x32 LED display. I thought the code would be useful to a bunch of you so I&amp;#39;ve zipped it up for you to download and play with. The cool thing is that I can work on the maze processing code while on the road and then come home and drop it into the Arduino environment to compile and use. As long as I have LED matrix driving code on the Arduino, it should work like a charm. 
&lt;/p&gt;
&lt;p&gt;
Here&amp;#39;s a screenshot of the simulator running: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f2%2fScreenshot.JPG" alt="" width="448" height="299" /&gt; 
&lt;/p&gt;
&lt;p&gt;
Black &amp;#39;dots&amp;#39; are on LEDs, spaces are off LEDs, the lighter colored dot is supposed to be a different color LED to represent a person. The simulator can switch between 8x8, 16x16, and 32x32 displays by pressing the Page Up and Page Down keys. Movement is through the arrow keys. The display mode can either be static with screen changes when the person crosses a window border (i.e. the person moves around on the screen) or scrolling, where the person stays still and the maze moves around. Pressing S switches between the two modes. 
&lt;/p&gt;
&lt;p&gt;
The code is in a zip file: &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/MazeSimulator/Maze021710.zip"&gt;Maze021710.zip&lt;/a&gt;&amp;nbsp;(12.1k) and I&amp;#39;ve been using VS 2005 Professional to develop and debug. 
&lt;/p&gt;
&lt;p&gt;
There are plenty of comments in the code and I&amp;#39;m happy to answer questions about it. 
&lt;/p&gt;
&lt;p&gt;
Enjoy! 
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Arduino-Windows-simulator-of-driving-matrices-of-8x8-LED-arrays.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Arduino-Windows-simulator-of-driving-matrices-of-8x8-LED-arrays.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=0fa1747a-8c41-46e1-bfc6-39cd7fbb6eae</guid>
      <pubDate>Wed, 17 Feb 2010 08:32:00 -0800</pubDate>
      <category>Arduino</category>
      <category>Example Code</category>
      <category>LED matrix</category>
      <category>LED Projects</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=0fa1747a-8c41-46e1-bfc6-39cd7fbb6eae</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=0fa1747a-8c41-46e1-bfc6-39cd7fbb6eae</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Arduino-Windows-simulator-of-driving-matrices-of-8x8-LED-arrays.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=0fa1747a-8c41-46e1-bfc6-39cd7fbb6eae</wfw:commentRss>
    </item>
    <item>
      <title>Arduino: cascading shift registers to drive 7-segment displays with PC input</title>
      <description>&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;In the &lt;a href="http://www.sqlskills.com/blogs/paulselec/post/Arduino-figuring-out-shift-registers.aspx"&gt;last post&lt;/a&gt; I figured out how to drive a 74HC595 shift register to control 8 LEDs from only 3 digital outputs of the Arduino. Now I&amp;#39;ve taken that a step further and cascaded (sometimes called daisy-chained) four 595s together to drive 7-segment displays and also&amp;nbsp;added code to accept&amp;nbsp;input from the PC.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Instead of using 10-LED bar graphs like I did last time, I&amp;#39;ve moved on to 7-segment displays - which are more challenging and provide a more meaningful output. The 7-segment displays I have are common-cathode, wired as shown below: &lt;/font&gt;
&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
	&lt;font face="verdana,geneva" size="2"&gt;&lt;font face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a - pin 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dp (decimal point) - pin 9&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; ---&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b - pin 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; common cathode - pins 12 and 4&lt;br /&gt;
	f |&amp;nbsp;&amp;nbsp; | b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c - pin&amp;nbsp;8&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; --- g&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d - pin 7&lt;br /&gt;
	e |&amp;nbsp; &amp;nbsp;| c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e - pin 6&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; --- . dp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f - pin 2&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g - pin 1&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;
	&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;The code to illuminate decimal digits on a 7-segment display is pretty straightforward. I assigned each of the 7 segment-pins on the display to an output on the 595, from QA through QG (see the circuit diagram below). Each pin from QA to QG is assigned a binary value&amp;nbsp;of 2 ^ pin#, so figuring out which pins to make high to produce each decimal digit is just a matter of adding together the binary values representing each pin necessary to light up the right segments. You can see this array being initialized in the &lt;font face="courier new,courier"&gt;setup()&lt;/font&gt; function.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;I&amp;#39;ve also moved to a proper coding style, with &lt;font face="courier new,courier"&gt;g_&lt;/font&gt; prefixing each global variable to distinguish them from local variables inside functions and methods. It&amp;#39;s a good practice to define unchanging variables as &lt;font face="courier new,courier"&gt;const&lt;/font&gt; to allow the compiler to optimize the code around them - this also prevents mistakes where the code accidentally tries to change the value - the compiler won&amp;#39;t allow it as the variable is effectively read-only and a difficult-to-debug bug is avoided.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;To daisy-chain 595s together is really simple - connect the serial output (pin 9) of the &amp;#39;lowest&amp;#39; 595 to the serial input (pin 14) of the next one in the chain, and connect all the latch (pin 12) and clock (pin 11) inputs together. When the first 595 accepts a new bit, the highest bit in the register will be pushed out of it&amp;#39;s serial line as input to the next 595 in the chain. Enough bits must be pushed to fill all the 595s with new data correctly. In the previous post I only had a single 595 so I only had to push 8 bits of data from the Arduino. With two 595s I need to push 16 bits, with the first 8 bits effectively flowing through the first 595 and into the second. And so on with more 595s in the chain.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Care must be taken to push the 8-bit values in the correct order - the 8 bits for the 595 furthest from the Arduino must be pushed first, and the 8 bits for the 595 nearest the Arduino in the chain must be pushed last. I do this in the code in the &lt;font face="courier new,courier"&gt;sendSerialData()&lt;/font&gt; function by passing in the number of registers in use, plus a pointer to an array of bytes. Each element in the array has the byte to be pushed to the corresponding register - with the highest register number the furthest away from the Arduino. The code then iterates backwards through the away, pushing each byte in succession.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Rather than doing the obvious count-from-0-to-9999 code, I decided to figure out how to read input from the PC. This is done in the &lt;font face="courier new,courier"&gt;readNumberFromPC()&lt;/font&gt; function. If it detects that something has been sent from the PC, it reads each character, with a 10ms delay between each character read to ensure that all characters are received from the PC. Without the delay, the Arduino executes so fast that it may read the first character from the input stream, try again, and the next character hasn&amp;#39;t made it over the slow (compared to the Arduino!) link from the PC - resulting in the input being chopped into two parts. This delay doesn&amp;#39;t cause a problem with the 595s as their outputs are latched, and so stay the way they were set until the next update - preventing any display flickering.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;In the &lt;font face="courier new,courier"&gt;loop()&lt;/font&gt; function, the logic to put the correct digit-byte in the register array is hard-coded. In the next rev I&amp;#39;ll make this register-count agnostic.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;As far as the circuit is concerned, I&amp;#39;ve got one 220ohm resistor on each 7-segment common cathode going to ground, which produces a bright enough display. I&amp;#39;ve also added a 100nF decoupling capacitor on the Vcc pin of each 595 to forestall any noise problems.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;The complete circuit diagram is as below (click for a larger version):&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/ShiftRegisters/7SegShiftRegisters2.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f1%2fSmall7SegShiftRegisters2.jpg" alt="" width="445" height="336" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Here&amp;#39;s the breadboard layout, with a close up of IC2 (click for larger versions):&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/ShiftRegisters/P1020798.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f1%2fSmallP1020798.JPG" alt="" width="314" height="208" /&gt;&lt;/a&gt;&amp;nbsp; &lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/ShiftRegisters/P1020799.jpg"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f1%2fSmallP1020799.JPG" alt="" width="235" height="250" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Once I&amp;#39;d figured out the wiring for one of the displays, adding the other three was pretty easy. At this point I ran out of 595s so I couldn&amp;#39;t take the experiment any further, but I do have a bunch more on the way from &lt;/font&gt;&lt;a href="http://www.jameco.com"&gt;&lt;font face="verdana,geneva" size="2"&gt;Jameco&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;I took a short (40s) video of the board in action - check it out &lt;/font&gt;&lt;a href="http://www.youtube.com/watch?v=5dvIgG5hWiI"&gt;&lt;font face="verdana,geneva" size="2"&gt;here on YouTube&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;And all the code is below(to download as a text file click &lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/ShiftRegisters/4x7SegHC595.txt"&gt;&lt;font face="verdana,geneva" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;). Drop me a comment if you find this stuff useful!&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;[Edit: 12/19/10 - &lt;/font&gt;&lt;a href="http://arduino-for-beginners.blogspot.com/2010/12/digital-clock-with-7-segments-led-and.html"&gt;&lt;font face="verdana,geneva" size="2"&gt;here&amp;#39;s a link&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; to someone who built a clock based on my code below.]&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Next up - replacing some of the shift registers with transistors to allow a bigger fan-out from the Arduino.&lt;/font&gt; 
&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;/*&lt;br /&gt;
	&amp;nbsp; Driving multiple 7-seg displays with 74HC595 shift registers.&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; Feel free to re-use.&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp; 01/30/2010&lt;br /&gt;
	*/&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// This pin gets sets low when I want the 595s to listen&lt;br /&gt;
	const int&amp;nbsp; g_pinCommLatch = 6;&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// This pin is used by ShiftOut to toggle to say there&amp;#39;s another bit to shift&lt;br /&gt;
	const int&amp;nbsp; g_pinClock&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 7;&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// This pin is used to pass the next bit&lt;br /&gt;
	const int&amp;nbsp; g_pinData&amp;nbsp;&amp;nbsp;&amp;nbsp; = 4;&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Definitions of the 7-bit values for displaying digits&lt;br /&gt;
	byte g_digits [10];&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Current number being displayed&lt;br /&gt;
	int g_numberToDisplay = 0;&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Number of shift registers in use&lt;br /&gt;
	const int g_registers = 4;&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Array of numbers to pass to shift registers&lt;br /&gt;
	byte g_registerArray [g_registers];&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;void setup()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; pinMode (g_pinCommLatch, OUTPUT);&lt;br /&gt;
	&amp;nbsp; pinMode (g_pinClock, OUTPUT);&lt;br /&gt;
	&amp;nbsp; pinMode (g_pinData, OUTPUT);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; Serial.begin (56600);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; // Setup the digits array&lt;br /&gt;
	&amp;nbsp; // a = 8 b = 4 c = 2 d = 64 e = 32 f = 1 g = 16&lt;br /&gt;
	&amp;nbsp; g_digits [0] = 8 + 4 + 2 + 64 + 32 + 1;&lt;br /&gt;
	&amp;nbsp; g_digits [1] = 4 + 2;&lt;br /&gt;
	&amp;nbsp; g_digits [2] = 8 + 4 + 16 + 32 + 64;&lt;br /&gt;
	&amp;nbsp; g_digits [3] = 8 + 4 + 16 + 2 + 64;&lt;br /&gt;
	&amp;nbsp; g_digits [4] = 1 + 16 + 4 + 2;&lt;br /&gt;
	&amp;nbsp; g_digits [5] = 8 + 1 + 16 + 2 + 64;&lt;br /&gt;
	&amp;nbsp; g_digits [6] = 8 + 1 + 16 + 2 + 64 + 32;&lt;br /&gt;
	&amp;nbsp; g_digits [7] = 8 + 4 + 2;&lt;br /&gt;
	&amp;nbsp; g_digits [8] = 8 + 4 + 2 + 64 + 32 + 1 + 16;&lt;br /&gt;
	&amp;nbsp; g_digits [9] = 8 + 4 + 2 + 1 + 16 + 64;&lt;br /&gt;
	} // setup&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Simple function to send serial data to one or more shift registers by iterating backwards through an array.&lt;br /&gt;
	// Although g_registers exists, they may not all be being used, hence the input parameter.&lt;br /&gt;
	void sendSerialData (&lt;br /&gt;
	&amp;nbsp; byte registerCount,&amp;nbsp; // How many shift registers?&lt;br /&gt;
	&amp;nbsp; byte *pValueArray)&amp;nbsp;&amp;nbsp; // Array of bytes with LSByte in array [0]&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; // Signal to the 595s to listen for data&lt;br /&gt;
	&amp;nbsp; digitalWrite (g_pinCommLatch, LOW);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; for (byte reg = registerCount; reg &amp;gt; 0; reg--)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; byte value = pValueArray [reg - 1];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; for (byte bitMask = 128; bitMask &amp;gt; 0; bitMask &amp;gt;&amp;gt;= 1)&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (g_pinClock, LOW);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (g_pinData, value &amp;amp; bitMask ? HIGH : LOW);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (g_pinClock, HIGH);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; // Signal to the 595s that I&amp;#39;m done sending&lt;br /&gt;
	&amp;nbsp; digitalWrite (g_pinCommLatch, HIGH);&lt;br /&gt;
	}&amp;nbsp; // sendSerialData&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Print a message specifying valid inputs, given the number of registers defined and then consume all current input.&lt;br /&gt;
	void badNumber ()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; int dummy;&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; Serial.print (&amp;quot;Please enter a number from 0 to &amp;quot;);&lt;br /&gt;
	&amp;nbsp; for (int loop = 0; loop &amp;lt; g_registers; loop++)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Serial.print (&amp;quot;9&amp;quot;);&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; Serial.println (&amp;quot; inclusive.&amp;quot;);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; while (Serial.available () &amp;gt; 0)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; dummy = Serial.read ();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; // Necessary to get all input in one go.&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; delay (10);&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	} //badNumber&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;// Read a number from the PC with no more digits than the defined number of registers.&lt;br /&gt;
	// Returns: number to display. If an invalid number was read, the number returned is the current number being displayed&lt;br /&gt;
	//&lt;br /&gt;
	int readNumberFromPC ()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; byte incomingByte;&lt;br /&gt;
	&amp;nbsp; int&amp;nbsp; numberRead;&lt;br /&gt;
	&amp;nbsp; byte incomingCount;&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; if (Serial.available () &amp;gt; 0)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; numberRead = 0;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; incomingCount = 0;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; while (Serial.available () &amp;gt; 0)&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; incomingByte = Serial.read () - 48;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; incomingCount++;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (incomingByte &amp;lt; 0 || incomingByte &amp;gt; 9 || incomingCount &amp;gt; g_registers)&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; badNumber ();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return g_numberToDisplay;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numberRead = 10 * numberRead + incomingByte;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Necessary to get all input in one go.&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay (10);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Serial.print (&amp;quot;Now displaying: &amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Serial.println (numberRead, DEC);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; return numberRead;&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; return g_numberToDisplay;&lt;br /&gt;
	} // readNumberFromPC&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;br /&gt;
	&lt;font face="courier new,courier"&gt;void loop()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; g_numberToDisplay = readNumberFromPC ();&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; if (g_numberToDisplay &amp;lt; 10)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [3] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [2] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [1] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [0] = g_digits [g_numberToDisplay];&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; else if (g_numberToDisplay &amp;lt; 100)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [3] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [2] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [1] = g_digits [g_numberToDisplay / 10];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [0] = g_digits [g_numberToDisplay % 10];&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; else if (g_numberToDisplay &amp;lt; 1000)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [3] = g_digits [0];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [2] = g_digits [g_numberToDisplay / 100];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [1] = g_digits [(g_numberToDisplay % 100) / 10];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [0] = g_digits [g_numberToDisplay % 10];&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; else&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [3] = g_digits [g_numberToDisplay / 1000];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [2] = g_digits [(g_numberToDisplay % 1000) / 100];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [1] = g_digits [(g_numberToDisplay % 100) / 10];&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; g_registerArray [0] = g_digits [g_numberToDisplay % 10];&lt;br /&gt;
	&amp;nbsp; }&lt;/font&gt; 
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier"&gt;&amp;nbsp; sendSerialData (g_registers, g_registerArray);&lt;br /&gt;
	} // loop&lt;/font&gt; 
	&lt;/p&gt;
&lt;/blockquote&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Arduino-cascading-shift-registers-to-drive-7-segment-displays.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Arduino-cascading-shift-registers-to-drive-7-segment-displays.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=60f64003-347b-43d2-876d-d1dc731f175f</guid>
      <pubDate>Sun, 31 Jan 2010 15:33:00 -0800</pubDate>
      <category>Arduino</category>
      <category>Example Code</category>
      <category>Example Movies</category>
      <category>LED Projects</category>
      <category>Shift Registers</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=60f64003-347b-43d2-876d-d1dc731f175f</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=60f64003-347b-43d2-876d-d1dc731f175f</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Arduino-cascading-shift-registers-to-drive-7-segment-displays.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=60f64003-347b-43d2-876d-d1dc731f175f</wfw:commentRss>
    </item>
    <item>
      <title>Arduino: figuring out shift registers</title>
      <description>&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;One of the parts that makes possible the scrolling message kit I built over the weekend (see &lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/post/Kit-building-Hansen-Hobbies-mini-scrolling-LED-sign-kit.aspx"&gt;&lt;font face="verdana,geneva" size="2"&gt;Kit building: Hansen Hobbies mini-scrolling LED sign kit&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;) is a shift register. This is a very neat device that uses at least 2 inputs to load 8 parallel outputs. The idea is to pulse a clock input for each bit of data in the 8-bit register, loading each bit in succession until all 8 bits have been loaded. The shift registers in the kit I made are 74HC164s, which means that the outputs immediately&amp;nbsp;go high or low to relfect&amp;nbsp;the bits as they&amp;#39;re loaded into the shift register and shifted along into their desired positions. Many people prefer a latched shift register, where the outputs reflect a steady-state of the register until all 8 new bits have been loaded, and then the outputs change to the new bits in the register (i.e the latched register has two registers - a true shift register and a storage register). &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;The simple algorithm to load a latched shift-register is: &lt;/font&gt;
&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;pull the latch pin low &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;pull the clock pin low &lt;br /&gt;
	pull the data pin high or low to reflect bit 1 &lt;br /&gt;
	pull the clock pin high &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;&amp;lt;repeat for bits 2 through 8&amp;gt; &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="verdana,geneva" size="2"&gt;&lt;font face="courier new,courier"&gt;pull the latch pin high&lt;/font&gt; &lt;/font&gt;
	&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;It&amp;#39;s up to you whether you load the 8-bit value as MSB (most-significant-bit) first or LSB (least-significant-bit) first - you&amp;#39;ll soon work out if you&amp;#39;ve got it the wrong way around! &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;I&amp;#39;m going to use a 74HC595 shift register that can source 35mA per output - perfect for driving the LEDs in my 10-bar LED arrays. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;There are two ways to implement the logic above - using the Arduino shiftOut function or writing one yourself. I played around with&amp;nbsp;both to make sure I fully understood what&amp;#39;s going on - and I like bit-twiddling in C/C++. The Arduino site has a good language reference on shiftOut (see &lt;/font&gt;&lt;a href="http://www.arduino.cc/en/Reference/ShiftOut"&gt;&lt;font face="verdana,geneva" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;) and also a tutorial on using the 74HC595 (see &lt;/font&gt;&lt;a href="http://www.arduino.cc/en/Tutorial/ShiftOut"&gt;&lt;font face="verdana,geneva" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;). I decided to figure out how to use the chip myself so I internalized how to do it in future&amp;nbsp;- but I&amp;#39;m not trying to be a purist and re-inventing the wheel. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;The circuit is pretty simple - remember to pull the OutputEnable (active low) pin low and the MemoryClear (active low) pin high. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f1%2fShiftRegister.jpg" alt="" width="448" height="285" /&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;And a photo (click for larger image): &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.sqlskills.com/blogs/paulselec/content/binary/ShiftRegisters/P1020791.jpg"&gt;&lt;font face="verdana,geneva" size="2"&gt;&lt;img src="http://www.sqlskills.com/blogs/paulselec/image.axd?picture=2010%2f1%2fSmallP1020791.JPG" alt="" width="235" height="286" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;The code I used is below, with the two different functions to push data out to the shift register. I had a problem with the code where I originally had the &lt;font face="courier new,courier"&gt;counter&lt;/font&gt; variable in the &lt;font face="courier new,courier"&gt;loop()&lt;/font&gt; function as a &lt;font face="courier new,courier"&gt;byte&lt;/font&gt; and the LEDs&amp;nbsp;counted to the end and then stopped. I put in the serial output to do some testing and connected up with Windows HyperTerminal - so much easier to do&amp;nbsp;it with this than when trying to debug code I&amp;#39;d written in the storage engine of SQL Server :-)&amp;nbsp;Of course as soon as the counter value reached 256, it overflowed and was stored as 0, so no more&amp;nbsp;LEDs being lit up. If you do this, don&amp;#39;t forget to hangup before trying to upload a sketch to the Arduino otherwise it won&amp;#39;t be able to grab the COM port.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Here&amp;#39;s the code:&lt;/font&gt; 
&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;/*&lt;br /&gt;
	&amp;nbsp; Driving a 74HC595 shift register&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp; 01/27/2010&lt;br /&gt;
	*/ &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;// This pin gets sets low when I want the 595 to listen&lt;br /&gt;
	const int&amp;nbsp; pinCommLatch = 2; &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;// This pin is used by ShiftOut to toggle to say there&amp;#39;s another bit to shift&lt;br /&gt;
	const int&amp;nbsp; pinClock&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 3; &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;// This pin is used to pass the next bit&lt;br /&gt;
	const int&amp;nbsp; pinData&amp;nbsp;&amp;nbsp;&amp;nbsp; = 4; &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;void setup()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; pinMode (pinCommLatch, OUTPUT);&lt;br /&gt;
	&amp;nbsp; pinMode (pinClock, OUTPUT);&lt;br /&gt;
	&amp;nbsp; pinMode (pinData, OUTPUT);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; //Serial.begin (56600);&lt;br /&gt;
	} // setup &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;// Using the builtin shiftOut function&lt;br /&gt;
	void sendSerialData1 (&lt;br /&gt;
	&amp;nbsp; byte&amp;nbsp; value)&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; // Signal to the 595 to listen for data&lt;br /&gt;
	&amp;nbsp; digitalWrite (pinCommLatch, LOW);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; shiftOut (pinData, pinClock, MSBFIRST, value);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; // Signal to the 595 that I&amp;#39;m done sending&lt;br /&gt;
	&amp;nbsp; digitalWrite (pinCommLatch, HIGH);&lt;br /&gt;
	}&amp;nbsp; // sendSerialData1 &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;// Using my own method with as few instructions as possible&lt;br /&gt;
	// Gotta love C/C++ for bit-twiddling!&lt;br /&gt;
	void sendSerialData2 (&lt;br /&gt;
	&amp;nbsp; byte&amp;nbsp; value)&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; // Signal to the 595 to listen for data&lt;br /&gt;
	&amp;nbsp; digitalWrite (pinCommLatch, LOW); &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;&amp;nbsp; for (byte bitMask = 128; bitMask &amp;gt; 0; bitMask &amp;gt;&amp;gt;= 1)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (pinClock, LOW);&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (pinData, value &amp;amp; bitMask ? HIGH : LOW);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; digitalWrite (pinClock, HIGH);&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	&amp;nbsp; // Signal to the 595 that I&amp;#39;m done sending&lt;br /&gt;
	&amp;nbsp; digitalWrite (pinCommLatch, HIGH);&lt;br /&gt;
	}&amp;nbsp; // sendSerialData2&lt;br /&gt;
	&amp;nbsp; &lt;br /&gt;
	void loop()&lt;br /&gt;
	{&lt;br /&gt;
	&amp;nbsp; for (int counter = 1; counter &amp;lt; 256; counter++)&lt;br /&gt;
	&amp;nbsp; {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; sendSerialData2 (counter); &lt;/font&gt;
	&lt;/p&gt;
	&lt;p&gt;
	&lt;font face="courier new,courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay (75);&lt;br /&gt;
	&amp;nbsp; }&lt;br /&gt;
	} // loop &lt;/font&gt;
	&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;I recorded a quick video of the code above&amp;nbsp;driving the 595 to get the LEDs to count from 1 to 255 in binary - checkout it on YouTube &lt;/font&gt;&lt;a href="http://www.youtube.com/watch?v=oeJAATX0vek"&gt;&lt;font face="verdana,geneva" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="verdana,geneva" size="2"&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="verdana,geneva" size="2"&gt;Next up - daisy-chaining multiple shift-registers. &lt;/font&gt;
&lt;/p&gt;
</description>
      <link>http://www.sqlskills.com/blogs/paulselec/post/Arduino-figuring-out-shift-registers.aspx</link>
      <author>paul.nospam@nospam.sqlskills.com (paul)</author>
      <comments>http://www.sqlskills.com/blogs/paulselec/post/Arduino-figuring-out-shift-registers.aspx#comment</comments>
      <guid>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=934bb9f1-14b4-470b-b23a-61115f49f34f</guid>
      <pubDate>Thu, 28 Jan 2010 10:35:00 -0800</pubDate>
      <category>Arduino</category>
      <category>LED Projects</category>
      <category>Shift Registers</category>
      <dc:publisher>paul</dc:publisher>
      <pingback:server>http://www.sqlskills.com/blogs/paulselec/pingback.axd</pingback:server>
      <pingback:target>http://www.sqlskills.com/blogs/paulselec/post.aspx?id=934bb9f1-14b4-470b-b23a-61115f49f34f</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.sqlskills.com/blogs/paulselec/trackback.axd?id=934bb9f1-14b4-470b-b23a-61115f49f34f</trackback:ping>
      <wfw:comment>http://www.sqlskills.com/blogs/paulselec/post/Arduino-figuring-out-shift-registers.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.sqlskills.com/blogs/paulselec/syndication.axd?post=934bb9f1-14b4-470b-b23a-61115f49f34f</wfw:commentRss>
    </item>
  </channel>
</rss>