<?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>Top Down View &#187; hardware</title>
	<atom:link href="http://www.topdownview.com/tag/hardware/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.topdownview.com</link>
	<description>My View Of The World</description>
	<lastBuildDate>Fri, 11 Nov 2011 19:33:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Glitch and the LED Sneakers: Epilogue</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 18:25:56 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=600</guid>
		<description><![CDATA[What now? Well, it was a one-off&#8230; a little bit of fun for the Glitch Launch Party and an excuse for me to explore the Arduino platform. However I just noticed today that the in-game shoes have a couple more tricks up their sleeves (do shoes have sleeves?). When you&#8217;re away from the keyboard in [...]]]></description>
			<content:encoded><![CDATA[<h5>What now?</h5>
<p>Well, it was a one-off&#8230; a little bit of fun for the Glitch Launch Party and an excuse for me to explore the Arduino platform. However I just noticed today that the in-game shoes have a couple more tricks up their sleeves (do shoes have sleeves?). When you&#8217;re away from the keyboard in the game and your Glitch falls asleep, the shoes pulse gently in time with your breathing. Also when you laugh or frown, the lights have their own emotions that mirror your character&#8217;s. This got me thinking about ways to extend the project.</p>
<p><span id="more-600"></span>One possible project might be to add the control button back into the system &#8211; pressing that would override the current effect for a limited amount of time to show an &#8220;emotional&#8221; effect. Maybe press once for laughing, twice rapidly for angry, three times for sleeping.</p>
<p>Another project might be to explore analogue control of the lights to allow a fading pattern. The Lilypad supports analogue out using a Pulse Width Modulation technique (ie it turns the pin on &amp; off rapidly&#8230; more on than off means brighter, more off than on means dimmer) &#8211; but the built-in support only works with 6 of the I/O pins so I&#8217;d have to investigate controlling the rapid on/off cycling myself.</p>
<p>Another project might be to add some sort of sensor to the system&#8230; maybe a resistive chest strap so it can tell my breathing pattern, or a thermo sensor so it can detect my temperature. The board could then alter the light patterns automatically to represent some aspect of my physical state.</p>
<h5>What Went Wrong</h5>
<p>In general the project went off really really smoothly. From both an electrical and software point of view it was very simple but I know that simple doesn&#8217;t always mean free of frustrating faults. I had no significant issues with either the electronics or the software, just a couple of minor niggles.</p>
<p>One &#8216;gotcha&#8217; was that the USB connection to the computer had to be wiggled just-so or else I would get power but no data to the Lilypad. At this point the Arduino software would see no serial port and fail to download to the board. Having hit this a couple of times I learnt how to spot it and wiggle the cable successfully.</p>
<p>Another hiccup was the power consumption with multiple LEDs on simultaneously. During initial testing with a single AAA cell, I found, at idle, the Lilypad was drawing about 9mA from the power supply board. With 2 LEDs on per side (4 total) that rose to 93mA. Because of the way the step-up electronics work, that worked out at 230mA from the actual cell. If I tried to turn on more LEDs the cell couldn&#8217;t supply enough current and the Lilypad reset. I minimised the peak battery loading by careful construction of the flashing patterns to alternate the shoes on/off cycles but I replaced the single AAA cell with a three pack for extra safety. Reading the <a href="http://www.onsemi.com/pub_link/Collateral/NCP1400A-D.PDF">datasheet for the NCP1400A</a> voltage converter chip says the chip has a 100mA maximum output current so I think I was lucky to be able to get as much out of it as I did.</p>
<h5>What Would I Do Differently</h5>
<p>There were a couple of things that I&#8217;d do differently if I did the project over again.</p>
<p>First, I&#8217;d take into account the way that the straps sat on the shoes before I glued the LED ribs on to them. The stretchy straps lean slightly forwards because of the slope of the shoe &#8211; I didn&#8217;t think of this and I glued the LED ribs onto them at right angles and so they&#8217;re on a slope rather than being parallel to the ground. If I&#8217;d tried the shoes and straps on first, before I got the glue gun out, I could have glued the LED ribs on at an angle so they remained flush and level to the ground.</p>
<p>Secondly, I&#8217;d choose a different power supply. There&#8217;s some really nice <a href="http://www.sparkfun.com/products/339">Lithium Polymer batteries</a> available, supplying 3.7v with a capacity of 1000mAh or more. The <a href="http://www.sparkfun.com/products/8786">power supply board for this</a> is electrically almost identical to the AAA board, the only addition being an over-current protector &#8211; which might actually be overkill as the NCP1400A has a 350mA current limiter built-in. I think this would have been a little neater than my contraption with the 3xAAA cells. Although, given that I didn&#8217;t have to buy a separate charger, or a battery, the solution I ran with was actually cheaper and more flexible.</p>
<p>&nbsp;</p>
<p>All in all, a great success and I&#8217;m looking forward to having some more fun with Arduino (Lilypad or otherwise) in the future &#8211; as soon as I can think of another excuse!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; In Action!</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 18:16:44 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=587</guid>
		<description><![CDATA[So it&#8217;s all put together&#8230; but what do they look like? Show us! OK, OK&#8230; your patience is finally rewarded, here&#8217;s a video of what they look like in action: &#160; If you&#8217;re so inclined, here&#8217;s a more detailed video walk-through showing all the bits &#38; pieces plus the shoes in action: &#160; In case the videos [...]]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s all put together&#8230; but what do they look like? Show us!</p>
<p>OK, OK&#8230; your patience is finally rewarded, here&#8217;s a video of what they look like in action:</p>
<p><span id="more-587"></span><br />
<object type="application/x-shockwave-flash" width="640" height="361" data="http://www.flickr.com/apps/video/stewart.swf?v=109786" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=03c4b44ae7&#038;photo_id=6323539289"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=109786"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=109786" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=03c4b44ae7&#038;photo_id=6323539289" height="361" width="640"></embed></object>
</p>
<p>&nbsp;</p>
<p>If you&#8217;re so inclined, here&#8217;s a more detailed video walk-through showing all the bits &amp; pieces plus the shoes in action:</p>
<p><iframe src="http://www.youtube.com/embed/YaFkh5pO_rM" frameborder="0" width="560" height="315"></iframe></p>
<p>&nbsp;</p>
<p>In case the videos don&#8217;t work for you, the originals are on Flickr and YouTube, <a title="shoe demo on flickr" href="http://www.flickr.com/photos/55055992@N00/6323539289/">here</a> and <a title="Full shoe walkthrough (ha) and demo on YouTube" href="http://www.youtube.com/watch?v=YaFkh5pO_rM">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Putting It All Together</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 17:08:48 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=560</guid>
		<description><![CDATA[At this point I&#8217;ve got a jumble of wires, crocodile clips and circuit boards spread across half my desk. Nothing too shoe-related going on yet and definitely not portable. To bring this to life, I needed two basic set of things: something in which to mount the Lilypad, power board and batteries. My original idea [...]]]></description>
			<content:encoded><![CDATA[<p>At this point I&#8217;ve got a jumble of wires, crocodile clips and circuit boards spread across half my desk. Nothing too shoe-related going on yet and definitely not portable.</p>
<p>To bring this to life, I needed two basic set of things:</p>
<ul>
<li>something in which to mount the Lilypad, power board and batteries. My original idea was something along the lines of a money belt with the Lilypad in the small of my back and a wire to the button somewhere easily accessible</li>
<li>something to hold the LEDs and attach to the shoes. I wasn&#8217;t going to modify the shoes in any way so my original idea was some sort of a fabric overshoe sewn together and held in place with stretchy straps and velcro.</li>
</ul>
<p><span id="more-560"></span>Really it all comes down to what you can find&#8230; you have to be imaginative and flexible with your plans. I took a trip to my local thrift store and mooched around all the aisles. Then I mooched around them all again. After many &#8220;maybes&#8221;, instead of the money belt, I settled on a small leather camera case with a belt loop and for the shoe end of things I picked up (an awesome find for $1.50) a back support belt. Yes really. The belt was 8 inches wide, had rigid vertical ribs like a corset (once detached, these would be great to mounting the LEDs onto) and was held up by a set of stretchy braces (suspenders for you North Americans) (which would provide all the stretchy straps I needed) and held together by loads of velcro tabs &amp; fasteners. Just perfect &#8211; a tripartite triumph.</p>
<h4>Shoe Pieces</h4>
<p>Once home, I started with the shoe pieces. I cut out a pair of the ribs from the back support belt and hot glued the LEDs in place across the front. The wiring consisted of a common 0v wire running the length of the rib just below the LEDs and the individual signal wires looped up over the top. More hot glue on the back held everything in place. I cut lengths of stretchy strap from the braces and hand-sewed velcro onto the end (note to self: don&#8217;t ever hand-sew velcro again&#8230; ow ow ow) &#8211; this would then wrap around the shoe and fasten back onto itself with the LED rib glued onto the strap at the appropriate point. I cut 8 inches off the end of the ribbon cable and split it into two 5-way wires &#8211; one for each foot. These 5 wires I then soldered to the LED wires on the back of the ribs and attached the ribs to the stretchy straps with a big squirt of hot glue, sandwiching all the solder joints in the middle &#8211; so no exposed bare wires. Then I soldered the male (PCB mount) half of the Insulation Displacement Connectors onto the other ends of the 5-way wires (the smallest IDCs that Lee&#8217;s stocked were 10-way so half the pins were unused but, at under a buck a connector, I&#8217;m not complaining). Finally, to protect the soldered joints (and to protect my ankles from the soldered joints) I wrapped an inch of heat-shrink tubing around the connector and squirted another big blob of hot glue up the open end of the heat shrink to act as a strain relief. And the shoe pieces were complete.</p>
<p style="text-align: center;"><a title="Glitch shoes - the LED shoe piece by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320228181/"><img class="aligncenter" src="http://farm7.static.flickr.com/6225/6320228181_3b912ea026.jpg" alt="Glitch shoes - the LED shoe piece" width="500" height="376" /></a></p>
<h4>Power &amp; control unit</h4>
<p>In theory the Lilypad can be run from a single AAA cell fitted to the power supply board. This will step-up anything from as low as 1.2v into the 5.0v needed to power the Lilypad. This worked initially but I found that driving too many LEDs at once required too much current for the single cell to provide reliably and the Lilypad would reset itself. Instead I borrowed a 3xAAA holder from an old flashlight, fitted three 750mAh AAA NiMH cells into that and soldered the output onto the power board. Now I&#8217;ve got about 4v and 2000mAh capacity&#8230; should be plenty. As a quick test I let the system sit with all 8 LEDs on for a while and it took 90 minutes to drain. Great &#8211; I&#8217;ll pack a backup set of batteries and I should be fine.</p>
<p>A two foot length cut from the 10-way ribbon cable comes up into the camera case through a small hole I cut in the bottom and is then soldered directly onto the I/O pins of the Lilypad. I decided that it was good to show off the controller so I hot glued a patch of velcro onto the back of it &amp; a corresponding piece onto the front of the case so I could mount it there. This also gave me access to the reset button that I could now easily use for changing modes.</p>
<p style="text-align: center;"><a title="Glitch shoes - power &amp; control unit by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320206345/"><img class="aligncenter" src="http://farm7.static.flickr.com/6051/6320206345_6514fb55e8.jpg" alt="Glitch shoes - power &amp; control unit" width="500" height="376" /></a></p>
<p>The whole contraption then slips onto a belt with the batteries in the bottom of the camera bag and the power supply board on top of them for easy access to the power switch. The cable comes out of the bottom of the case and attaches to the cable coming up the legs with any excess being easily hidden in a pocket.</p>
<p style="text-align: center;"><a title="Glitch shoes - control pack by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320266929/"><img src="http://farm7.static.flickr.com/6041/6320266929_634b8feab1.jpg" alt="Glitch shoes - control pack" width="376" height="500" /></a></p>
<h4>Connecting Cable</h4>
<p>Connecting the control &amp; power unit to the feet was easy. I took the remaining length of 10-way ribbon cable, ripped it up the middle for most of its length and attached connectors to the three ends. The 10-way will connect to the control &amp; power unit, the two 5-ways will connect to the shoe pieces and most of the wiring will be hidden inside my jeans.</p>
<p><a title="Glitch shoes - connecting cable by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320752940/"><img class="aligncenter" src="http://farm7.static.flickr.com/6036/6320752940_a2d61cce7c.jpg" alt="Glitch shoes - connecting cable" width="500" height="376" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Final Code</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 05:48:35 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=534</guid>
		<description><![CDATA[I had a couple of sets of changes I needed to make to my test code. Firstly I needed the ability to change the effects mode using the button. I originally added this by testing to see if the button was down, incrementing a global variable that I used for the mode, a switch statement [...]]]></description>
			<content:encoded><![CDATA[<p>I had a couple of sets of changes I needed to make to my test code.</p>
<p>Firstly I needed the ability to change the effects mode using the button. I originally added this by testing to see if the button was down, incrementing a global variable that I used for the mode, a switch statement to divert program flow depending on the current mode value and different functions for each effects mode. The effect was pretty to look at but the code was even worse than the previous test: overly long and the patterns were defined by the actual program logic &#8211; meaning that more program code would have to be written in order to add more patterns and the code to control 8 LEDs would be twice as long. You can see that particular iteration here: <a href="http://topdownview.com/arduino/glitch/Glitch_multimode">http://topdownview.com/arduino/glitch/Glitch_multimode</a></p>
<p><span id="more-534"></span>When I was trying to come up with a clever design for storing the LED patterns, I kept wanting to use objects&#8230; it was very hard to constrain myself to simple procedural C!</p>
<p>I chose to do a lot of work with arrays. To start with, I could put the pins used by the LEDs into an array:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"> <span class="kw4">int</span> ledPins<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="nu0">5</span><span class="sy0">,</span> <span class="nu0">6</span><span class="sy0">,</span> <span class="nu0">7</span><span class="sy0">,</span> <span class="nu0">8</span><span class="sy0">,</span> <span class="nu0">9</span><span class="sy0">,</span> <span class="nu0">10</span><span class="sy0">,</span> <span class="nu0">11</span><span class="sy0">,</span> <span class="nu0">12</span> <span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>and then reset them all in setup() like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> pin <span class="sy0">=</span> <span class="nu0">0</span> <span class="sy0">;</span> pin <span class="sy0">&amp;</span>lt<span class="sy0">;</span> numLeds <span class="sy0">;</span> pin<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  pinMode<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>pin<span class="br0">&#93;</span><span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
  digitalWrite<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>pin<span class="br0">&#93;</span><span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>And I put the effects modes into an array. The first design looked like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> pattern<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">5</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="nu0">100</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">500</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">400</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>with the first parameter being the number of milliseconds to hold a specific display. You can see a version of code that uses that array format here: <a href="http://topdownview.com/arduino/glitch/Glitch_pattern_array">http://topdownview.com/arduino/glitch/Glitch_pattern_array</a></p>
<p>Then I realized I could use binary for the individual on/off LEDs (which scaled very easily for the 8 LEDs I needed) plus I needed a way to store the different effects modes. So I ended up with an array structure like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"> <span class="kw4">int</span> pattern<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="nu0">0</span><span class="sy0">,</span><span class="nu0">9000</span><span class="sy0">,</span> B00000000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 0: Everything off</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B10000000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 1: 2 LEDs run down the length of the line</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B11000000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B01100000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00110000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00010000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00001000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00001100<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000110<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000011<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000001<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B10001000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 2: 1 LED runs down the length of the line</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B01000100<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00100010<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00010001<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00100010<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B01000100<span class="br0">&#125;</span><span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>Here the first parameter of each row is the effects mode that this line refers to, the second parameter is the length of time to hold that display and the third parameter is a binary bit-field for the 8 LEDs. Now any time I want to add a new effects mode it&#8217;s as simple as adding new lines to the array &#8211; no new program logic required. The program code steps through the array after each timing period looking for the next line that applies to the current effects mode and, if it reaches the end of the array, loops back to the start.</p>
<p>I was able to decouple the program logic from the size of the arrays by having the program work out the array sizes for itself in setup():</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">    numSteps <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>pattern<span class="br0">&#41;</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>pattern<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    numLeds <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>ledPins<span class="br0">&#41;</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>Again, in an OO language I&#8217;d have just used foreach to step through the arrays, but here I had to work without that luxury.</p>
<p>At one point I had the button generating an interrupt to increment the effects mode. But, as I was wiring up the hardware, I thought &#8220;it&#8217;s damn awkward having this button floating around&#8230; I wish there was some way I could use the button that&#8217;s already on the Lilypad board&#8221;. That button&#8217;s the reset button&#8230; so <em>obviously</em> I couldn&#8217;t do that because everything&#8217;s erased when the board&#8217;s reset. Hmmm&#8230; except the microcontroller has some EEPROM for storage that <em>isn&#8217;t</em> erased on reset. So I changed the code to store the effects mode in the EEPROM and increment the mode each time it resets. Then I didn&#8217;t need the separate button at all &#8211; every time the reset button&#8217;s pressed the Lilypad starts up in the next sequential effects mode. This had another major benefit: if the board reset itself (and I was initially fearing possible power-drain related resets for modes that illuminated too many LEDs at the same time) then when it restarted it would magically skip over the problematic mode.</p>
<p>The only other oddity in the code was how to deal with detecting when we&#8217;d stepped through all the available effects modes and had to set the mode back down to zero. In hindsight, I probably should have run through the pattern array in setup() to determine the highest mode value and then compared against that whenever I incremented the current mode. What I actually did was: when I was about to go hunting for the next line that referred to the current pattern, the code memorizes where in the pattern array it&#8217;s starting its search and then if it steps all the way around and back to the same line without finding a match, that means the mode variable is now too high and has to be set back to zero. So my &#8220;find the next matching pattern line&#8221; code looks like:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> startStep <span class="sy0">=</span> currentStep<span class="sy0">;</span> <span class="co1">// Remember where we started from in the pattern array</span>
&nbsp;
<span class="co1">// Loop through the array looking for the next pattern line that matches our</span>
<span class="co1">// current effects mode</span>
<span class="kw1">while</span> <span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  currentStep<span class="sy0">++;</span> <span class="co1">// move to next step</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>currentStep <span class="sy0">&amp;</span>gt<span class="sy0">;=</span> numSteps<span class="br0">&#41;</span> currentStep<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> <span class="co1">// at end of array, loop back to start</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>pattern<span class="br0">&#91;</span>currentStep<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">==</span> modeGet<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span> <span class="co1">// this pattern line applies to this mode, so use it</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>currentStep <span class="sy0">==</span> startStep<span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// if been all the way around, we have nothing for this mode</span>
    modeSet<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// so reset the mode back to the first mode</span>
    currentStep <span class="sy0">=</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span> <span class="co1">// and start searching from the beginning of the pattern array</span>
    Serial.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&quot;Looped around - clearing mode&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>The full and final code can be seen here:  <a href=" http://topdownview.com/arduino/glitch/Glitch_final_code">http://topdownview.com/arduino/glitch/Glitch_final_code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; First Test</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 01:27:20 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=522</guid>
		<description><![CDATA[At this point I broke out the croc clips and the LEDs and started experimenting. Whenever you click &#8216;Upload&#8217; in the Arduino IDE it compiles your current code, transfers it to your Lilypad, reboots the Lilypad and starts the code running &#8211; so the feedback loop for trying out ideas &#38; seeing what works is [...]]]></description>
			<content:encoded><![CDATA[<p>At this point I broke out the croc clips and the LEDs and started experimenting. Whenever you click &#8216;Upload&#8217; in the Arduino IDE it compiles your current code, transfers it to your Lilypad, reboots the Lilypad and starts the code running &#8211; so the feedback loop for trying out ideas &amp; seeing what works is very fast.</p>
<p>My first test hardware involved connecting the button and 4 of the LEDs to pads on the Lilypad. I started from the basic Blink program and added more LEDs and more delays to give some visual effects. I also added the ability to detect button presses in order to change the pattern.</p>
<p><span id="more-522"></span>I defined a couple of constants in my code:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> pin1 <span class="sy0">=</span> <span class="nu0">9</span><span class="sy0">;</span>
<span class="kw4">int</span> pin2 <span class="sy0">=</span> <span class="nu0">10</span><span class="sy0">;</span>
<span class="kw4">int</span> pin3 <span class="sy0">=</span> <span class="nu0">11</span><span class="sy0">;</span>
<span class="kw4">int</span> pin4 <span class="sy0">=</span> <span class="nu0">3</span><span class="sy0">;</span>
<span class="kw4">int</span> pinButton <span class="sy0">=</span> <span class="nu0">12</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>then I needed to add code into setup() to tell the Lilypad how the hardware was configured:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">pinMode<span class="br0">&#40;</span>pin1<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin2<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin3<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin4<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pinButton<span class="sy0">,</span> INPUT<span class="br0">&#41;</span><span class="sy0">;</span>
digitalWrite<span class="br0">&#40;</span>pinButton<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>The digitalWrite() for a pin configured as an input might seem counter-intuitive but it&#8217;s an important step. It makes the Lilypad connect the input line to an internal pull-up resistor so that, when the line isn&#8217;t pulled down to 0v by the button being pressed, the line is at a solid 5v. Omit this line and you&#8217;ll get a lot of spurious signals from the button as the Lilypad tries to work out what the floating input line is doing.</p>
<p>Then in the main loop() code I can use</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>digitalRead<span class="br0">&#40;</span>pinButton<span class="br0">&#41;</span> <span class="sy0">==</span> LOW<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="co1">// code goes in here for when the button's pressed</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
  <span class="co1">// code goes in here for when the button's not pressed</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>to detect if the button is down and adjust the output accordingly. The first code block contains</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>  <span class="co1">// turn on the first LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the second LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the third LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the fourth LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// and turn them all off</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
&nbsp;
  delay<span class="br0">&#40;</span>speed2<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>and the second code block contains pretty much duplicated code but with the lit LED rotating in the opposite direction.</p>
<p>And yay &#8211; ugly but it worked!<br />
See the full source code for this test here: <a href="http://topdownview.com/arduino/glitch/Glitch_multimode">http://topdownview.com/arduino/glitch/Glitch_first_test</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Hello World</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 23:43:22 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=504</guid>
		<description><![CDATA[So now it&#8217;s time to plug things together and start programming. The Arduino development environment is super simple to work with. The tools are written in Java so they&#8217;re cross-platform. If you&#8217;re running Ubuntu then installation is simply a matter of visiting the Software Centre, typing in &#8216;Arduino&#8217; and clicking the install button for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.topdownview.com/wp-content/uploads/2011/11/Blink-Arduino-0022_079.png"><img class="alignright size-medium wp-image-505" title="Blink | Arduino 0022_079" src="http://www.topdownview.com/wp-content/uploads/2011/11/Blink-Arduino-0022_079-300x293.png" alt="" width="300" height="293" /></a>So now it&#8217;s time to plug things together and start programming.</p>
<p>The Arduino development environment is super simple to work with. The tools are written in Java so they&#8217;re cross-platform. If you&#8217;re running Ubuntu then installation is simply a matter of visiting the Software Centre, typing in &#8216;Arduino&#8217; and clicking the install button for the Arduino IDE program that pops up. If you&#8217;re on Windows or Mac then it&#8217;s not much more complicated than that either &#8211; download the software from the <a href="http://arduino.cc/en/Main/Software">Arduino website</a> and install.</p>
<p>Then plug one end of the programming cable into your Lilypad (be sure to get it the right way round &#8211; the board is marked B and G for the Black and Green wires in the cable) and the other end into your computer. At this point your computer discovers a new serial port provided by the USB cable &#8211; again if you&#8217;re running Ubuntu it just works but if you&#8217;re running Windows to Mac there&#8217;s help <a href="http://web.media.mit.edu/~leah/LilyPad/02_software.html">here</a> to guide you through installing the necessary device drivers.</p>
<p>Run the Arduino IDE and go to Tools-&gt;Board to select the correct board that you&#8217;re programming. In my case it&#8217;s the &#8220;Lilypad Arduino w/ATmega328&#8243;. Then click on Tools-&gt;SerialPort to check that your system&#8217;s detected and selected the correct serial port.</p>
<p><span id="more-504"></span>Now you&#8217;re ready to go! The IDE contains over a hundred simple program examples to get you started with whatever piece of code functionality or add-on hardware you&#8217;re trying to use. The Arduino equivalent of Hello World is called Blink and we can use it now to test out our Lilypad and workflow. The Lilypad contains an LED already mounted to the board so we can run the Blink program (File-&gt;Examples-&gt;Basics-&gt;Blink) without having to attach any extra hardware.</p>
<pre>/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/</pre>
<pre>void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH); // set the LED on
  delay(1000); // wait for a second
  digitalWrite(13, LOW); // set the LED off
  delay(1000); // wait for a second
}</pre>
<p>Arduino code is written in C so if you&#8217;ve got any programming experience it isn&#8217;t going to take long to pick up. The program that you write gets compiled on your computer and then transferred to the Arduino where it&#8217;s run by a boot loader program. The boot loader program expects to find two functions in your code:</p>
<ul>
<li><strong>setup()</strong> is called once when the program starts up. Use this for initializing variables and setting the mode (input or output) of the various I/O pins</li>
<li><strong>loop()</strong> is called repeatedly. Depending on your task and your personal programming style you can keep control within loop() or you can let the program flow fall out the bottom and have the boot loader call you again.</li>
</ul>
<p>The example Blink program flashes the Lilypad&#8217;s on-boad LED: one second on, one second off and repeat until you unplug it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED sneakers &#8211; The Parts</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 22:41:14 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=492</guid>
		<description><![CDATA[First things first&#8230; what&#8217;s the final design going to look like? My plan was for 4 LEDs along the outside edge of each shoe &#8211; 2 red and 2 yellow to match the colours of the Glitch shoes. Then run wires up inside each leg of my jeans to the Lilypad and power supply mounted [...]]]></description>
			<content:encoded><![CDATA[<p>First things first&#8230; what&#8217;s the final design going to look like? My plan was for 4 LEDs along the outside edge of each shoe &#8211; 2 red and 2 yellow to match the colours of the Glitch shoes. Then run wires up inside each leg of my jeans to the Lilypad and power supply mounted around my waist. Add a button to allow switching between different flashing modes and some connectors at the ankle and waist to allow things to be detached and we&#8217;re set.</p>
<p>So what hardware are we going to need?</p>
<p><span id="more-492"></span></p>
<p>We&#8217;ll need:<br />
<a style="float: right; margin: 10px;" title="Parts list by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6313271418/"><img src="http://farm7.static.flickr.com/6229/6313271418_88eede7851_m.jpg" alt="the components" width="340" /></a></p>
<ul>
<li>a <a href="http://arduino.cc/en/Main/ArduinoBoardLilyPad">Lilypad Arduino</a> &#8211; the programmable microcontroller that drives everything. It&#8217;s got 14 digital I/O pins that can drive LEDs directly</li>
<li>a <a href="http://www.sparkfun.com/products/8466">power supply</a> &#8211; this lovely little board takes a single 1.5v AAA cell and steps it up to 5v to drive the Lilypad. However I think I&#8217;d power it differently if I was doing things over again</li>
<li>a <a href="http://www.sparkfun.com/products/9717">cable</a> to connect it to a computer for programming. This is USB at one end and serial at the other with a connector that plugs directly onto the Lilypad for downloading programs, communication back to the computer and power</li>
<li>8 <a href="http://www.sparkfun.com/products/10044">LEDs</a> &#8211; I used LEDs specifically designed to complement Lilypad</li>
<li>a <a href="http://www.sparkfun.com/products/8776">button</a> for changing modes &#8211; again this is specifically designed for the Lilypad line, although I ended up not using it in the final design</li>
<li>lots of wire &amp; connectors</li>
</ul>
<p>For wiring, I need a signal line for each LED down each leg, plus a common 0v line &#8211; so 5 wires per leg. I visited <a href="http://www.leeselectronic.com/">Lee&#8217;s Electronics</a> on Main Street in Vancouver for parts (they&#8217;ve got loads of Arduino items but if you&#8217;re not local then <a href="http://www.sparkfun.com/">SparkFun</a> are a great online source for everything Arduino) and I took the brave decision to explain to the assistant exactly what I was planning to do with this hardware, rather than just swan in and give him my parts list. He was really helpful and suggested ribbon wire for the wiring. This was a smart move as it&#8217;s cheap, low bulk and meant I could use <a href="http://en.wikipedia.org/wiki/Insulation-displacement_connector">insulation displacement connectors</a> for one half of each connector, eliminating half the fiddly wiring. It also looks cool if you&#8217;re into the whole &#8216;visible electronics&#8217; thing. If you&#8217;re into e-textiles then you can actually buy <a href="http://www.sparkfun.com/categories/206">electrically conductive thread</a> and sew your circuit into your clothes. Pretty amazing but I was just looking for a temporary solution and I didn&#8217;t fancy the idea of sewing 5 lines down each pant leg.</p>
<p>I bought 9 foot of 10-way ribbon cable which, even allowing for lots of slack in the system, turned out to be about 2 foot too much (but I knew I was buying too much: it&#8217;s like <a href="http://www.flickr.com/photos/55055992@N00/sets/72157626282251139/">haircuts</a>&#8230; it&#8217;s much easier to take off a little more at the end than it is to add some back on). Another great thing with the ribbon cable: you can just tear it up the middle and suddenly, with no extra work, you&#8217;ve got a cable that&#8217;s 10-way at one end and splits into two 5-way cables at the other end!</p>
<p>One downside of the insulation displacement connectors is that the male side of the connector is usually soldered into a circuit board. Nobody ever uses them for in-line connectors (as I was trying to do) so the only option I had for the male connector was a PCB mount variant with exposed pins on the back side. This makes for rather fiddly soldering and a connector that&#8217;s far from ideal for wearing, so I added a length of heat-shrink tubing to my basket.</p>
<p>And finally, I also bought a pack of crocodile clip test leads for prototyping. I knew I had a set at home somewhere but you can never have enough crocodile clip leads &#8211; and actually, even having found the second set I had at home, I didn&#8217;t have enough leads to fully wire-up the 8 LED design with crocodile leads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Intro</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 21:25:17 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=480</guid>
		<description><![CDATA[I&#8217;ve been playing Tiny Speck&#8216;s Glitch for the last six months. I don&#8217;t play much in the way of computer games these days &#8211; I don&#8217;t play MMOs and I run Linux so I don&#8217;t exactly have a bundle of games at my disposal, but Glitch is different. The game is a lot of fun, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing <a href="http://tinyspeck.com/">Tiny Speck</a>&#8216;s <a href="http://www.glitch.com/">Glitch</a> for the last six months. I don&#8217;t play much in the way of computer games these days &#8211; I don&#8217;t play MMOs and I run Linux so I don&#8217;t exactly have a bundle of games at my disposal, but Glitch is different. The game is a lot of fun, the artwork is beautiful and the writing is consistently funny and quirky &#8211; but what really elevates the game are the people:</p>
<p><span id="more-480"></span></p>
<p>- the player community is very friendly&#8230; it&#8217;s not unusual to have strangers give you items or strike up conversations with you as you walk down the street. This is a game where there&#8217;s no player-player combat and very little opportunity to cause your fellow players grief so it maybe shouldn&#8217;t be surprising that it attracts a different type of player</p>
<p>- the developers are amazingly open and involved&#8230; it&#8217;s not unusual to see company founder Stewart Butterfield in the forums engaging in debate about a new game addition or to see a player suggestion appearing in the game</p>
<p>I don&#8217;t think I&#8217;ve ever seen a game that encouraged player-player interactions and the whole concept of &#8220;paying it forward&#8221; as much as this game. There&#8217;s a unique thrill to be got from helping out a less experienced player with some food or advice &#8211; it makes them feel valued within the game and you know that they&#8217;ll want to repay your kindnesses to others later on. Plus the players create stuff of their own to have fun with: lotteries, casinos, quests, challenges&#8230; almost universally group events.</p>
<p><a href="http://www.topdownview.com/wp-content/uploads/2011/11/glitch-me.png"><img class="alignright size-full wp-image-482" title="glitch-me" src="http://www.topdownview.com/wp-content/uploads/2011/11/glitch-me.png" alt="" width="172" height="248" /></a> Glitch came out of beta a month ago and the quiet world of the beta testers has been swamped by tens of thousands of new eager players discovering everything for the first time. The developers have done a great job surviving the onslaught and still introducing a whole raft of new features. To celebrate the launch, Tiny Speck put on a party here in Vancouver last night &amp; I was lucky enough to snag myself a ticket.</p>
<p>Hmmmmm&#8230; what to wear, what to wear? Well the invite made mention of dress-up and a tickle trunk so I think some sort of costume is called for. The obvious choice is to dress as my Glitch and fortunately that&#8217;s not too difficult or outrageous &#8211; he basically wears all black LOL. However he does have the most incredible pair of LED shoes with a row of lights that strobe down the sides. Hmmm&#8230; actually, you know what&#8230; I could absolutely make those. <a href="http://johnbiehler.com/">John Biehler</a> introduced me to the <a href="http://www.arduino.cc/">Arduino</a> microcontroller platform last year and I&#8217;ve been wanting a nice little project to implement with it. Even better, there&#8217;s an Arduino variant called <a href="http://arduino.cc/en/Main/ArduinoBoardLilyPad">Lilypad</a>, created by <a href="http://web.media.mit.edu/~leah/index.html">Leah Buechley</a> at the MIT Media Lab, specifically for wearable electronics.</p>
<p>So yeah &#8211; with a little bit of programming, some fairly cheap electronics, a visit to the thrift store and a lot of hot glue, I built myself a set of flashing light shoes. With multiple modes! The shoes were a big hit at the party and I lost count of the number of people who came up to me to comment on them.</p>
<p>Both the Arduino and Glitch communities are heavy on the concept of sharing, so I&#8217;ll be posting details of the shoes&#8217; construction and software here (in great detail!). If you&#8217;re interested in Arduino then you&#8217;ll probably find something of use in each of the posts. If your interest is purely Glitch and non-technical then you might want to skip the geekery and jump straight to the <a title="Glitch and the LED Sneakers – In Action!" href="http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/">demo video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vacuuming &#8211; Your Mum Was Right</title>
		<link>http://www.topdownview.com/2010/05/vacuuming-your-mum-was-right/</link>
		<comments>http://www.topdownview.com/2010/05/vacuuming-your-mum-was-right/#comments</comments>
		<pubDate>Wed, 26 May 2010 22:23:45 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computer hardware]]></category>
		<category><![CDATA[cooling]]></category>
		<category><![CDATA[dust]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[heatsink]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=353</guid>
		<description><![CDATA[Yes, it IS important to vacuum once in a while&#8230; who&#8217;d have guessed? The first computers I ever built (and then disassembled and then rebuilt) never seemed to gather any dust. But over the last 5 years I&#8217;ve seen an increasing amount of dust gathering inside my computers&#8217; cases. I have no idea why&#8230; it [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, it IS important to vacuum once in a while&#8230; who&#8217;d have guessed?</p>
<p>The first computers I ever built (and then disassembled and then rebuilt) never seemed to gather any dust. But over the last 5 years I&#8217;ve seen an increasing amount of dust gathering inside my computers&#8217; cases. I have no idea why&#8230; it seems to have corresponded roughly to when I moved from the UK to Canada so maybe Canada is a dustier country <img src='http://www.topdownview.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Over the last year I&#8217;ve seen the internal temperatures in my current desktop PC steadily rising:</p>
<div id="attachment_354" class="wp-caption aligncenter" style="width: 386px"><a href="http://www.topdownview.com/wp-content/uploads/2010/05/temps-before.png"><img class="size-full wp-image-354" title="temps-before" src="http://www.topdownview.com/wp-content/uploads/2010/05/temps-before.png" alt="Computer internal temperatures before cleaning" width="376" height="36" /></a><p class="wp-caption-text">Before cleaning</p></div>
<p>These are the Core0 &#8211; Core3 temps and two copies of the hard drive temp.</p>
<p>So last week I opened up the case and vacuumed it. I cleaned all the vents, sucked the dust off the fans, sucked all the dust bunnies out and cleaned the processor heatsink.</p>
<p>The heatsink was problematic. The PC has a Core2Quad processor (<a href="http://img.tomshardware.com/us/2008/03/03/cpu_cooler_charts_2008/cpu_cooler_charts_2008_part_iii___e6700_q6600_box.jpg" target="_blank">big heatsink</a>) in an Apevia X-QPack mATX case (<a href="http://shopper.cnet.com/cases/aspire-x-qpack/4014-3030_9-31533022.html" target="_blank">small case</a>). As a result there&#8217;s <a href="http://www.techpowerup.com/reviews/Aspire/XQpack/images/installed2.jpg" target="_blank">not much space</a> and the narrow nozzle of the vacuum cleaner was never going to get anywhere near the heatsink without me disassembling the case. Rather than do that, I used the poor man&#8217;s compressed air duster (ie I blew through a straw) and blew the dust out of the heatsink vanes then vacuumed everything up.</p>
<p>With everything reassembled and allowed to run for 24 hours, the temperatures dropped to:</p>
<div id="attachment_355" class="wp-caption aligncenter" style="width: 449px"><a href="http://www.topdownview.com/wp-content/uploads/2010/05/temps-after.png"><img class="size-full wp-image-355" title="temps-after" src="http://www.topdownview.com/wp-content/uploads/2010/05/temps-after.png" alt="Computer temperatures after vacuuming the case and motherboard" width="439" height="45" /></a><p class="wp-caption-text">Temperatures after cleaning</p></div>
<p>Those temperatures are Core0 &#8211; Core3, &#8220;CPU temp&#8221;, &#8220;motherboard temp&#8221; and the hard drive. [Actually, at time of writing, they're 5C below those numbers - but today's a much colder day]</p>
<p>Not sure where the &#8220;CPU temp&#8221; and &#8220;motherboard temp&#8221; sensors are being read from. The case has a front panel temperature LCD and two free-floating sensors which I&#8217;ve attached to the top of the hard drive and the chipset heatsink&#8230; but those are currently reading 26 and 47 degrees&#8230; so apparently not related.</p>
<p>To complicate things slightly, between taking the two sets of readings I also upgraded from Ubuntu 9.10 to Ubuntu 10.04 (more about that later). I&#8217;ve seen some reports on the internet from people who noticed the reported sensor temperatures dropping as a result of the upgrade. I did the upgrade a day before I cleaned and didn&#8217;t see any fall in reported temperatures afterwards so I don&#8217;t believe that that&#8217;s a factor in the improvement that I&#8217;m seeing.</p>
<p>So there you have it: a year&#8217;s worth of dust had clogged up my CPU heatsink and fans to elevate temperatures by approximately 15C. If it&#8217;s been over a year since you opened up YOUR computer&#8217;s case then maybe you should give it a spring cleaning too?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2010/05/vacuuming-your-mum-was-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple iPad first thoughts</title>
		<link>http://www.topdownview.com/2010/01/apple-ipad-first-thoughts/</link>
		<comments>http://www.topdownview.com/2010/01/apple-ipad-first-thoughts/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 00:24:46 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=273</guid>
		<description><![CDATA[I know it&#8217;s going to be a big success but at first glance it&#8217;s confusing as to where its market is. It&#8217;s not a replacement for a laptop: it has no USB ports for peripherals no multi-tasking (we think) limited opportunity to develop applications for it (developers have to work within the walled garden of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.topdownview.com/wp-content/uploads/2010/01/ipad.jpg"><img class="aligncenter size-medium wp-image-274" title="ipad" src="http://www.topdownview.com/wp-content/uploads/2010/01/ipad-300x174.jpg" alt="" width="300" height="174" /></a>I know it&#8217;s going to be a big success but at first glance it&#8217;s confusing as to where its market is.</p>
<p>It&#8217;s not a replacement for a laptop:</p>
<ul>
<li>it has no USB ports for peripherals</li>
<li>no multi-tasking (we think)</li>
<li>limited opportunity to develop applications for it (developers have to work within the walled garden of the AppStore and users have to sync through iTunes)</li>
</ul>
<p>But it&#8217;s too big to be pocketable so it&#8217;s not a replacement for a PDA like an iPod Touch.</p>
<p>If I wanted to actually &#8220;do&#8221; anything then I&#8217;d take a laptop along with me, if I wanted to read a book or a PDF then my gut feel is that I&#8217;d rather have an eReader (Engadget has a <a href="http://www.engadget.com/2010/01/27/ipad-or-kindle-will-our-wallets-decide/">great comparison with the Kindle</a>), if it&#8217;s just for casual internet access then a smartphone will do.</p>
<p>I think a major part of the market for the iPad is going to be iPhone users who are finding it too hard to read all the information that they&#8217;ve got access to on the screen of their phone.</p>
<p>Besides products, Apple are also great at making markets. Just because few people can see a need for a product today doesn&#8217;t mean that they couldn&#8217;t take advantage of it if they had one. Lots of Apple fans will buy them regardless, even if they already carry an iPhone and a MacBook around with them. And once they get the product out there in people&#8217;s hands in quantity, applications and use-cases will follow. It&#8217;s sure to be another winner.</p>
<p>I think most people considering the iPad will already have a smartphone and probably a laptop as well. I think we can also assume that these people carry their smartphone with them everywhere. So, if we&#8217;re assuming that technology purchases are made with the intention of simplifying our lives then will you be taking your iPad with you in situations where you previously took your laptop (which I see as a win)? Or will you now be carrying three devices (which I see as a fail)?</p>
<p>Continuing from that&#8230; if you&#8217;re already carrying your smartphone around with you everywhere, I see the 3G option as unnecessary for most people. Why not save the $130+$30/month (or Canadian equivalent) for iPad 3G access and tether the iPad to your phone? As far as I can see, there&#8217;s no definitive statement as to whether or not the iPad can be tethered. But you can bet that any lock-down that Apple put on it will be broken within a month or two and I&#8217;m sure tethering is one of the things that the community will enable.</p>
<p>Whilst thinking about phones, one of the features that interested me was the inclusion of a microphone. Whenever I see a microphone on a wireless device, my first thought is of <a href="http://www.skype.com/">Skype</a> (even though I&#8217;ve barely ever used Skype myself!). The lack of a camera might be an issue for some people but, especially now that Apple have graciously allowed VoIP applications to connect over 3G, you could actually use the iPad to make phone calls. It&#8217;s probably a little on the large side to replace your mobile phone and the lack of multi-tasking means that you couldn&#8217;t talk to someone whilst you get information for them from an email or a webpage but I think it&#8217;s an interesting use-case &#8211; especially when tied to an unlimited data plan.</p>
<p>Oh, and we can&#8217;t talk about the iPad without talking about the horendous name. Everyone seems to have agreed that it&#8217;s dreadful.. but then is it much more dreadful than iPod sounded when we first heard it? Heck, look at all the flack that Nintendo took for the Wii and that didn&#8217;t stop it flying off the shelves. I suspect in a few months we&#8217;ll have forgotten all the feminine hygiene wisecracks and moved on. Breaking out of the i{thing} naming pattern is long overdue for Apple. But the brand recognition of i{thing} is immense&#8230; I can&#8217;t see Apple having the guts to do it and, as a result, I think it&#8217;s actually becoming an Achilles heel of the brand as much as it&#8217;s a strength.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2010/01/apple-ipad-first-thoughts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

