<?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>C i b o M a h t o . c o m &#187; tech</title>
	<atom:link href="http://www.cibomahto.com/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cibomahto.com</link>
	<description>building making designing dreaming</description>
	<lastBuildDate>Fri, 27 Aug 2010 16:38:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>LoL + Processing</title>
		<link>http://www.cibomahto.com/2010/08/lol-processing/</link>
		<comments>http://www.cibomahto.com/2010/08/lol-processing/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 16:28:02 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1385</guid>
		<description><![CDATA[On the train back from NYC to Pittsburgh, I got the idea to hook up the LoL Shield directly to my computer, so that I could develop animations for it using a desktop graphics program. Using Jay Clegg&#8217;s Video Peggy &#8230; <a href="http://www.cibomahto.com/2010/08/lol-processing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cibomahto.com/2010/08/lol-processing/lol_framebuffer/" rel="attachment wp-att-1389"><img src="http://www.cibomahto.com/wp-content/uploads/2010/08/lol_framebuffer.jpg" alt="" title="lol_framebuffer" width="600" height="378" class="alignnone size-full wp-image-1389" /></a></p>
<p>On the train back from NYC to Pittsburgh, I got the idea to hook up the <a href="http://jimmieprodgers.com/kits/lolshield/">LoL Shield</a> directly to my computer, so that I could develop animations for it using a desktop graphics program. Using Jay Clegg&#8217;s <a href="http://www.planetclegg.com/projects/QC-Peggy.html">Video Peggy</a> project as a starting point, I wrote up a little framebuffer sketch for the Arduino, along with some <a href="http://processing.org/">Processing</a> code to grab a region of the computer screen, scale it, and send it over to the LoL Shield for display. Pretty simple, but could be useful. Source code is after the break. A version of this project might be included with the next LoL Shield library release.<span id="more-1385"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">processing.serial.*</span><span style="color: #339933;">;</span>
&nbsp;
LolShieldBuffer lolShield<span style="color: #339933;">;</span>
PFont fontA<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  size<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">14</span>, <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Load the font. Fonts must be placed within the data </span>
  <span style="color: #666666; font-style: italic;">// directory of your sketch. A font must first be created</span>
  <span style="color: #666666; font-style: italic;">// using the 'Create Font...' option in the Tools menu.</span>
  fontA <span style="color: #339933;">=</span> loadFont<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;LucidaSans-9.vlw&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Set the font and its size (in units of pixels)</span>
  textFont<span style="color: #009900;">&#40;</span>fontA, <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// I know that the first port in the serial list on my mac</span>
  <span style="color: #666666; font-style: italic;">// is always my  FTDI adaptor, so I open Serial.list()[0].</span>
  <span style="color: #666666; font-style: italic;">// On Windows machines, this generally opens COM1.</span>
  <span style="color: #666666; font-style: italic;">// Open whatever port is the one you're using.</span>
  <span style="color: #003399;">String</span> portName <span style="color: #339933;">=</span> Serial.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  print<span style="color: #009900;">&#40;</span>portName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lolShield <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LolShieldBuffer<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, portName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> draw<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  background<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  fill<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  text<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The time is now &quot;</span> <span style="color: #339933;">+</span> hour<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;:&quot;</span> <span style="color: #339933;">+</span> minute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, i, <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  lolShield.sendWindow(mouseX,mouseY, 14, 9);</span>
  lolShield.<span style="color: #006633;">sendWindow</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">14</span>, <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  i<span style="color: #339933;">--;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&lt;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">130</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">14</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You want to put this code on your Arduino:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;Charliplexing.h&quot;</span>
<span style="color: #339933;">#include &quot;Font.h&quot;</span>
<span style="color: #339933;">#include &quot;WProgram.h&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Inspired by Video Peggy:</span>
<span style="color: #666666; font-style: italic;">// http://www.planetclegg.com/projects/QC-Peggy.html</span>
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>                    <span style="color: #666666; font-style: italic;">// run once, when the sketch starts</span>
<span style="color: #009900;">&#123;</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">115200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  LedSign<span style="color: #339933;">::</span><span style="color: #202020;">Init</span><span style="color: #009900;">&#40;</span>DOUBLE_BUFFER<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//  LedSign::Init();</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> state <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> 
<span style="color: #993333;">int</span> counter <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> uint8_t DISP_BUFFER_SIZE <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">*</span><span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>                     <span style="color: #666666; font-style: italic;">// run over and over again</span>
<span style="color: #009900;">&#123;</span> 
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
  uint8_t c <span style="color: #339933;">=</span> Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// very simple state machine to look for 6 byte start of frame</span>
  <span style="color: #666666; font-style: italic;">// marker and copy bytes that follow into buffer</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">6</span><span style="color: #009900;">&#41;</span> 
  <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// must wait for 0xdeadbeef to start frame.</span>
    <span style="color: #666666; font-style: italic;">// note, I look for two more bytes after that, but</span>
    <span style="color: #666666; font-style: italic;">// they are reserved for future use. </span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> c <span style="color: #339933;">==</span> <span style="color: #208080;">0x12</span><span style="color: #009900;">&#41;</span> state<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">&amp;&amp;</span> c <span style="color: #339933;">==</span> <span style="color: #208080;">0x34</span><span style="color: #009900;">&#41;</span> state<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span><span style="color: #0000dd;">2</span> <span style="color: #339933;">&amp;&amp;</span> c <span style="color: #339933;">==</span> <span style="color: #208080;">0x56</span><span style="color: #009900;">&#41;</span> state<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span><span style="color: #0000dd;">3</span> <span style="color: #339933;">&amp;&amp;</span> c <span style="color: #339933;">==</span> <span style="color: #208080;">0x78</span><span style="color: #009900;">&#41;</span> state<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span><span style="color: #0000dd;">4</span> <span style="color: #339933;">&amp;&amp;</span> c <span style="color: #339933;">==</span> <span style="color: #208080;">0x1</span><span style="color: #009900;">&#41;</span> state<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>state <span style="color: #339933;">==</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span>  <span style="color: #666666; font-style: italic;">// dont care what 6th byte is </span>
    <span style="color: #009900;">&#123;</span>
      state<span style="color: #339933;">++;</span>
      counter <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> state <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// error: reset to look for start of frame</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> 
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// inside of a frame, so write to the buffer</span>
    uint8_t row <span style="color: #339933;">=</span> counter <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
    uint8_t col <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>counter <span style="color: #339933;">%</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #0000dd;">8</span><span style="color: #339933;">;</span>
    uint8_t length <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>col<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #339933;">?</span><span style="color: #0000dd;">8</span><span style="color: #339933;">:</span><span style="color: #0000dd;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>uint8_t colOffset <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>  colOffset <span style="color: #339933;">&lt;</span> length <span style="color: #339933;">;</span> colOffset<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      LedSign<span style="color: #339933;">::</span><span style="color: #202020;">Set</span><span style="color: #009900;">&#40;</span>col<span style="color: #339933;">+</span>colOffset<span style="color: #339933;">,</span> row<span style="color: #339933;">,</span> c <span style="color: #339933;">&gt;&gt;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">7</span> <span style="color: #339933;">-</span> colOffset<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    counter<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>counter <span style="color: #339933;">&gt;=</span> DISP_BUFFER_SIZE<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// buffer filled, so reset everything to wait for next frame</span>
      state <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
      LedSign<span style="color: #339933;">::</span><span style="color: #202020;">Flip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Put this code in a new tab in your Processing project, called LolShieldBuffer:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">processing.serial.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> LolShieldBuffer
<span style="color: #009900;">&#123;</span>
  Serial serial<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">int</span> ledWidth <span style="color: #339933;">=</span> <span style="color: #cc66cc;">14</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">int</span> ledHeight <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">int</span> ledFrameSize <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
  LolShieldBuffer<span style="color: #009900;">&#40;</span>PApplet parent, <span style="color: #003399;">String</span> portName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    serial <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Serial<span style="color: #009900;">&#40;</span>parent, portName, <span style="color: #cc66cc;">115200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">void</span> sendWindow<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x, <span style="color: #000066; font-weight: bold;">int</span> y, <span style="color: #000066; font-weight: bold;">int</span> w, <span style="color: #000066; font-weight: bold;">int</span> h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    PImage img <span style="color: #339933;">=</span> get<span style="color: #009900;">&#40;</span>x, y, w, h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//    img.resize(ledWidth, ledHeight);</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> frame <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#91;</span>ledFrameSize<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Grab a 14x9 window</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> row <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> row <span style="color: #339933;">&lt;</span> ledHeight<span style="color: #339933;">;</span> row<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">char</span> buf <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> col <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> col <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span> col<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        buf <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>buf <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        buf <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span>brightness<span style="color: #009900;">&#40;</span>img.<span style="color: #006633;">pixels</span><span style="color: #009900;">&#91;</span>row<span style="color: #339933;">*</span>ledWidth<span style="color: #339933;">+</span>col<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">127</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      frame<span style="color: #009900;">&#91;</span>row<span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> buf<span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> col <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> col <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span> col<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        buf <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>buf <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        buf <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span>brightness<span style="color: #009900;">&#40;</span>img.<span style="color: #006633;">pixels</span><span style="color: #009900;">&#91;</span>row<span style="color: #339933;">*</span>ledWidth<span style="color: #339933;">+</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">+</span>col<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">127</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      buf <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>buf <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      frame<span style="color: #009900;">&#91;</span>row<span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> buf<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    sendFrame<span style="color: #009900;">&#40;</span>frame<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
  <span style="color: #000066; font-weight: bold;">void</span> sendFrame<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> frame<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> magicNumber <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>0x12, 0x34, 0x56, 0x78, 0x1, 0x0<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    serial.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>magicNumber<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// TODO: Drop 9*2 magic number</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> index <span style="color: #339933;">&lt;</span> ledFrameSize<span style="color: #339933;">;</span> index<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      serial.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>frame<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/08/lol-processing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programming the LoL Shield using animated GIFs</title>
		<link>http://www.cibomahto.com/2010/08/programming-the-lol-shield-using-animated-gifs/</link>
		<comments>http://www.cibomahto.com/2010/08/programming-the-lol-shield-using-animated-gifs/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 05:07:12 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1369</guid>
		<description><![CDATA[A couple of weeks ago, I was hacking on the LoL Shield with Nathan Rosenquist, when we realized that it was really time consuming to use the spreadsheet program to build animations. Never fear, a quick python script later and &#8230; <a href="http://www.cibomahto.com/2010/08/programming-the-lol-shield-using-animated-gifs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><object width="600" height="406"><param name="movie" value="http://www.youtube.com/v/YJX4p--a90E?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YJX4p--a90E?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="406"></embed></object><br />
A couple of weeks ago, I was hacking on the <a href="http://jimmieprodgers.com/kits/lolshield/">LoL Shield</a> with <a href="http://twitter.com/freeradicalx">Nathan Rosenquist</a>, when we realized that it was really time consuming to use the spreadsheet program to build animations. Never fear, a quick python script later and we could generate animations automatically from animated gifs.<br />
Using the program, you can take black &#038; white 14&#215;9 GIF animations of (probably) any length, such as the following one by Nathan:<br />
<a href="http://www.cibomahto.com/2010/08/programming-the-lol-shield-using-animated-gifs/ripple/" rel="attachment wp-att-1370"><img src="http://www.cibomahto.com/wp-content/uploads/2010/08/ripple.gif" alt="" title="ripple" width="14" height="9" class="alignnone size-full wp-image-1370" /></a></p>
<p>and get some code ready for the LoLing:</p>
<pre>
uint16_t ripple[][9] PROGMEM = {
 { 520 , 1028 , 2050 , 2050 , 2114 , 2050 , 2050 , 1028 , 520 , },
 { 2050 , 4097 , 4097 , 8256 , 8352 , 8256 , 4097 , 4097 , 2050 , },
 { 8192 , 8192 , 224 , 272 , 272 , 272 , 224 , 8192 , 8192 , },
 { 0 , 224 , 272 , 520 , 520 , 520 , 272 , 224 , 0 , },
 { 224 , 272 , 520 , 1028 , 1028 , 1028 , 520 , 272 , 224 , },
};
</pre>
<p>Here&#8217;s the python source, have fun! It requires Python and the Python Imaging Library (PIL):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># Python script to convert a 14x9 pixel animated gif into a format that can</span>
<span style="color: #808080; font-style: italic;"># be displayed on the LoLShield.</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Requires Python and the Python Imaging Library (PIL)</span>
<span style="color: #808080; font-style: italic;"># It would be nice if this was available using a more common language.</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">os</span>, Image
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> ImageSequence:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, im<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">im</span> = im
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__getitem__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, ix<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> ix:
                <span style="color: #008000;">self</span>.<span style="color: black;">im</span>.<span style="color: black;">seek</span><span style="color: black;">&#40;</span>ix<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">im</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">EOFError</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">IndexError</span> <span style="color: #808080; font-style: italic;"># end of sequence</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Open image</span>
filename = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
filenameBase = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">splitext</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
im = Image.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Print the variable declaration</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;uint16_t &quot;</span> + filenameBase + <span style="color: #483d8b;">&quot;[][9] PROGMEM = {&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># For each frame in the image, convert it to black &amp; white, then into the</span>
<span style="color: #808080; font-style: italic;"># LoLShield format</span>
<span style="color: #ff7700;font-weight:bold;">for</span> frame <span style="color: #ff7700;font-weight:bold;">in</span> ImageSequence<span style="color: black;">&#40;</span>im<span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># Convert to black and white</span>
    converted = frame.<span style="color: black;">convert</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;1&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot; {&quot;</span>,
    frameString = converted.<span style="color: black;">tostring</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># For each row in the image</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">9</span><span style="color: black;">&#41;</span>:
        charA = <span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>frameString<span style="color: black;">&#91;</span>row<span style="color: #66cc66;">*</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        charB = <span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>frameString<span style="color: black;">&#91;</span>row<span style="color: #66cc66;">*</span><span style="color: #ff4500;">2</span> + <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
        rowTotal = <span style="color: #ff4500;">0</span>
        <span style="color: #808080; font-style: italic;"># Handle the first 8 bits</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> col <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>:
            shiftAmount = <span style="color: #ff4500;">7</span>-col
            rowTotal += <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>charA <span style="color: #66cc66;">&gt;&gt;</span> shiftAmount<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span> <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">2</span><span style="color: #66cc66;">**</span>col
        <span style="color: #808080; font-style: italic;"># Then the next 6</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> col <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">6</span><span style="color: black;">&#41;</span>:
            shiftAmount = <span style="color: #ff4500;">7</span>-col
            rowTotal += <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>charB <span style="color: #66cc66;">&gt;&gt;</span> shiftAmount<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span> <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">2</span><span style="color: #66cc66;">**</span><span style="color: black;">&#40;</span>col+<span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;"># And output the total for this row</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> rowTotal, <span style="color: #483d8b;">&quot;,&quot;</span>,
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;},&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;};&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/08/programming-the-lol-shield-using-animated-gifs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Meggy Jr Sr progress</title>
		<link>http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/</link>
		<comments>http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 00:28:37 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1329</guid>
		<description><![CDATA[Over the past few days, I&#8217;ve been working on completing a project thats been on my mind for a while. The idea was to build a giant version of a MeggyJr RGB pixel game kit by Evil Mad Scientists, like &#8230; <a href="http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/meggy_jr_sr_led_test/" rel="attachment wp-att-1330"><img src="http://www.cibomahto.com/wp-content/uploads/2010/07/meggy_jr_sr_LED_test-600x399.jpg" alt="" title="meggy_jr_sr_LED_test" width="600" height="399" class="alignnone size-medium wp-image-1330" /></a></p>
<p>Over the past few days, I&#8217;ve been working on completing a project thats been on my mind for a while. The idea was to build a giant version of a <a href="http://www.evilmadscientist.com/article.php/meggyjr">MeggyJr RGB</a> pixel game kit by Evil Mad Scientists, like what a big box store might use as a display unit in an alternate future where they sell cool electronics kits. The project has morphed a bit over time- originally, it was to be just a scaled up version of the handheld, complete with giant buttons and buzzer. I may still attempt that in the future, but for now the project consists of a large LED grid that works as a drop-in replacement for the regular-sized screen.</p>
<p>There&#8217; still a reasonable amount of work to do on the project, but it&#8217;s getting closer, and this morning I was finally able to play the MeggyBrite program on a large grid <img src='http://www.cibomahto.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . I still have to finish the enclosure and add a diffuser screen, however this seems like a good time to put up some documentation, so here goes:</p>
<p>There are three main components to the project: the RGB pixels, the laser cut enclosure, and the Meggy adapter board. Here&#8217;s an <a href='http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/meggyjrsr/' rel='attachment wp-att-1333'>archive of all of the design material</a> needed to make the board, and a short description of each component of the project.</p>
<p><strong>RGB pixels</strong><br />
<a href="http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/meggy_jr_sr_pixel/" rel="attachment wp-att-1334"><img src="http://www.cibomahto.com/wp-content/uploads/2010/07/meggy_jr_sr_pixel.jpg" alt="" title="meggy_jr_sr_pixel" width="600" height="399" class="alignnone size-full wp-image-1334" /></a><br />
For whatever reason, I envisioned the display as being made up of a bunch of discrete pixel units, which would then be wired in a grid. Looking back, this is a pretty foolish way to build it (better would be to use larger breadboards, or pre-made modules like the <a href="http://macetech.com/blog/node/54">ShiftBrite</a>). Anyway, I had a whole bunch of 10mm LEDs, so I decided to design up a board to fix 3 each of the red, green and blue LEDs, forming a single RGB pixel. You need 64 of these for the whole array. I made them by hand using pre-sensitized PCBs, as explained in Collin Cunningham&#8217;s <a href="http://blog.makezine.com/archive/2010/02/circuit_skills_circuit_board_etchin.html">Circuit Board Etching</a> tutorial. Thanks to <a href="http://www.gierard.com/">Issac</a> for helping me solder them together!</p>
<p><strong>Adaptor Board</strong><br />
<a href="http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/meggy_jr_sr_adaptor/" rel="attachment wp-att-1331"><img src="http://www.cibomahto.com/wp-content/uploads/2010/07/meggy_jr_sr_adaptor-600x399.jpg" alt="" title="meggy_jr_sr_adaptor" width="600" height="399" class="alignnone size-medium wp-image-1331" /></a><br />
The adapter board is designed to plug into an unmodified MeggyJr, so that you can use it in portable mode with the regular screen, or go for the large screen edition at home. It has pass-through connections for each of the 24 column connectors, and a step-up driver on each of the 8 row drivers, allowing the Meggy drive hardware to control the higher voltage required to run the sign. Finally, it has an LM7805 chip to provide power to the Meggy. I didn&#8217;t draw up a schematic though, so you are on your own for this one <img src='http://www.cibomahto.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p><strong>Enclosure</strong><br />
<a href="http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/meggy_jr_sr_enclosure/" rel="attachment wp-att-1332"><img src="http://www.cibomahto.com/wp-content/uploads/2010/07/meggy_jr_sr_enclosure-600x399.jpg" alt="" title="meggy_jr_sr_enclosure" width="600" height="399" class="alignnone size-medium wp-image-1332" /></a><br />
The enclosure is meant to look like a large version of the 8&#215;8 RGB display. I drew up a design in Inkscape, and my friend Brandon Barber laser cut it for me in hardboard. The basic form is right, but I had to make a bunch of modifications, so I&#8217;d suggest using the design files as inspiration only.</p>
<p>I&#8217;m planning to have the display set up at our Hack Pittsburgh table at <a href="http://makerfaire.com/detroit/2010/">Maker Faire Detroit</a>, so you should stop by and check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/07/meggy-jr-sr-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cicada flyover</title>
		<link>http://www.cibomahto.com/2010/07/cicada-flyover/</link>
		<comments>http://www.cibomahto.com/2010/07/cicada-flyover/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 20:04:54 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1089</guid>
		<description><![CDATA[Bam! High-def version of the video is available here. The system looks like this:]]></description>
			<content:encoded><![CDATA[<p><object width="600" height="361"><param name="movie" value="http://www.youtube.com/v/jnkGOc2nlVs&#038;hl=en&#038;start=0&#038;fs=1&#038;rel=0&#038;showinfo=0&#038;ap=%2526fmt%3D22 "></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/jnkGOc2nlVs&#038;hl=en&#038;start=0&#038;fs=1&#038;rel=0&#038;showinfo=0&#038;ap=%2526fmt%3D22" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="361"></embed></object></p>
<p>Bam! High-def version of the video is available <a href="http://www.cibomahto.com/wp-content/uploads/2010/07/cicada.avi">here</a>. The system looks like this:</p>
<p><a href="http://www.cibomahto.com/wp-content/uploads/2010/07/DSC_9926.jpg"><img src="http://www.cibomahto.com/wp-content/uploads/2010/07/DSC_9926.jpg" alt="" title="DSC_9926" width="600" height="399" class="alignnone size-full wp-image-1090" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/07/cicada-flyover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.cibomahto.com/wp-content/uploads/2010/07/cicada.avi" length="6574600" type="video/avi" />
		</item>
		<item>
		<title>Motion test on the camera rig</title>
		<link>http://www.cibomahto.com/2010/06/motion-test-on-the-camera-rig/</link>
		<comments>http://www.cibomahto.com/2010/06/motion-test-on-the-camera-rig/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 14:51:08 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1083</guid>
		<description><![CDATA[So this is what we&#8217;ve been working towards this past week. The above video is a nonsense trajectory with all four axis moving at the same time, just to show that they work. The system itself seems to be functional, &#8230; <a href="http://www.cibomahto.com/2010/06/motion-test-on-the-camera-rig/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><object type="application/x-shockwave-flash" width="600" height="338" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=22fbd2e160&#038;photo_id=4744596512&#038;hd_default=false"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></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=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=22fbd2e160&#038;photo_id=4744596512&#038;hd_default=false" height="338" width="600"></embed></object></p>
<p>So this is what we&#8217;ve been working towards this past week. The above video is a nonsense trajectory with all four axis moving at the same time, just to show that they work. The system itself seems to be functional, there are just a few more tasks- repeatability testing, retrofitting some optical end-stops, and putting the electronics in a nice box.</p>
<p>I think I might build another one of the xy tables to do machining with <img src='http://www.cibomahto.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/motion-test-on-the-camera-rig/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Makin&#8217; stuff with machines</title>
		<link>http://www.cibomahto.com/2010/06/makin-stuff-with-machines/</link>
		<comments>http://www.cibomahto.com/2010/06/makin-stuff-with-machines/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 05:37:39 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1053</guid>
		<description><![CDATA[This is what I&#8217;ve been up to for the past few days. Making some stepper motor mounts to retrofit a manual xy table into a stepper motor version. It&#8217;s basically just some machined aluminum standoffs, with an aluminum mounting plate &#8230; <a href="http://www.cibomahto.com/2010/06/makin-stuff-with-machines/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><object width="600" height="361"><param name="movie" value="http://www.youtube.com/v/6Z4Gvl_fkzw&#038;hl=en&#038;start=0&#038;fs=1&#038;rel=0&#038;showinfo=0&#038;ap=%2526fmt%3D18"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6Z4Gvl_fkzw&#038;hl=en&#038;start=0&#038;fs=1&#038;rel=0&#038;showinfo=0&#038;ap=%2526fmt%3D18" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="361"></embed></object></p>
<p>This is what I&#8217;ve been up to for the past few days. Making some stepper motor mounts to retrofit a manual <a href="http://littlemachineshop.com/products/product_focus.php?Focus=X-Y+Tables">xy table</a> into a stepper motor version. It&#8217;s basically just some machined aluminum standoffs, with an aluminum mounting plate to mate the unit to the table, and a shaft coupler made of (guess!) more aluminum! Unfortunately, the motors that I had weren&#8217;t up to the task, so we put in an express order with <a href="http://www.phidgets.com/products.php?category=23&#038;product_id=3303">Phidgets</a> to get some steppers The project is stating to come together! More photos to come after I get my battery recharged.</p>
<p><strong>Update:</strong> The timelapse video was captured at a rate of 1 frame per 3 seconds, and plays back at 30 FPS, so the ~1 minute video represents about 2 hours of work. Whew!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/makin-stuff-with-machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mendel Progress!</title>
		<link>http://www.cibomahto.com/2010/06/mendel-progress/</link>
		<comments>http://www.cibomahto.com/2010/06/mendel-progress/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 09:05:55 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1049</guid>
		<description><![CDATA[I&#8217;m building a RepRap Mendel 3d printer, using parts printed for me by my friend Marty on Makerbot 131, and hardware from ultimachine. Tonight&#8217;s project was to assemble all of the pieces that I could. I was able to get &#8230; <a href="http://www.cibomahto.com/2010/06/mendel-progress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cibomahto.com/wp-content/uploads/2010/06/DSC_7132.jpg"><img src="http://www.cibomahto.com/wp-content/uploads/2010/06/DSC_7132.jpg" alt="" title="DSC_7132" width="600" height="450" class="alignnone size-full wp-image-1048" /></a></p>
<p>I&#8217;m building a <a href="http://reprap.org/wiki/Mendel">RepRap Mendel</a> 3d printer, using parts printed for me by my friend <a href="http://creatingwithcode.com/">Marty</a> on <a href="http://creatingwithcode.com/makerbot_131/">Makerbot 131</a>, and hardware from <a href="http://ultimachine.com/">ultimachine</a>. Tonight&#8217;s project was to assemble all of the pieces that I could. I was able to get the X and Z stages built, mounted together, and roughly calibrated. The next steps are to get a build platform laser cut so that I can complete the Y stage, finish up the electronics so that I can control the machine, and decide on an extruder design so that I can actually use it to print. It&#8217;s starting to get exciting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/mendel-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotation test</title>
		<link>http://www.cibomahto.com/2010/06/rotation-test/</link>
		<comments>http://www.cibomahto.com/2010/06/rotation-test/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 05:05:02 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Photo]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1043</guid>
		<description><![CDATA[I made this little video to test the performance of the stepper drivers and rotary stage. The results are encouraging, except that I probably need attach the sample to the stage (it looked like it was vibrating around), and my &#8230; <a href="http://www.cibomahto.com/2010/06/rotation-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><object type="application/x-shockwave-flash" width="600" height="337" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=1b0bd1faef&#038;photo_id=4689510073&#038;hd_default=false"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></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=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=1b0bd1faef&#038;photo_id=4689510073&#038;hd_default=false" height="337" width="600"></embed></object></p>
<p>I made this little video to test the performance of the <a href="http://www.cibomahto.com/2010/06/one-shield-to-fit-them-all-and-in-the-darkness-bind-them/">stepper drivers and rotary stage</a>. The results are encouraging, except that I probably need attach the sample to the stage (it looked like it was vibrating around), and my flash ran out of batteries at the end (that&#8217;s why it gets darker). On the positive side, it was pretty easy to do- I just set the stepper to rotate at a constant speed on one direction, then put the camera into time lapse mode. I&#8217;ll try again tomorrow after recharging the flash batteries. The bit of glitchiness at the end is because the flash couldn&#8217;t recycle fast enough to fire on a few frames, so I showed the previous image twice to keep the motion constant.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/rotation-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One shield to fit them all, and in the darkness bind them</title>
		<link>http://www.cibomahto.com/2010/06/one-shield-to-fit-them-all-and-in-the-darkness-bind-them/</link>
		<comments>http://www.cibomahto.com/2010/06/one-shield-to-fit-them-all-and-in-the-darkness-bind-them/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 14:37:57 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1031</guid>
		<description><![CDATA[I&#8217;m working on a project which involves mechanizing some machining tables. I decided to use some surplus stepper motors and A4983 stepper motor breakout boards from Pololu to control them. Getting them to work on a protoboard was no problem, &#8230; <a href="http://www.cibomahto.com/2010/06/one-shield-to-fit-them-all-and-in-the-darkness-bind-them/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cibomahto.com/wp-content/uploads/2010/06/stepper_motor_driver_shield.jpg"><img src="http://www.cibomahto.com/wp-content/uploads/2010/06/stepper_motor_driver_shield.jpg" alt="" title="stepper_motor_driver_shield" width="600" height="400" class="alignnone size-full wp-image-1032" /></a></p>
<p><object type="application/x-shockwave-flash" width="600" height="338" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=e42048c0a2&#038;photo_id=4688187750&#038;hd_default=false"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></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=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=e42048c0a2&#038;photo_id=4688187750&#038;hd_default=false" height="338" width="600"></embed></object></p>
<p>I&#8217;m working on a project which involves mechanizing some machining tables. I decided to use some surplus stepper motors and <a href="http://www.pololu.com/catalog/product/1201">A4983 stepper motor breakout boards</a> from Pololu to control them. Getting them to work on a protoboard was no problem, so I decided to see if I could design and build a PCB to connect them in a more organized and robust fashion. Well, some hours and some chemical sniffing later, I had a board!</p>
<p><a href="http://www.cibomahto.com/wp-content/uploads/2010/06/stepper_motor_driver_shield_belly.jpg"><img src="http://www.cibomahto.com/wp-content/uploads/2010/06/stepper_motor_driver_shield_belly.jpg" alt="" title="stepper_motor_driver_shield_belly" width="600" height="400" class="alignnone size-full wp-image-1033" /></a></p>
<p>It has space to populate up to 4 of the Pololu stepper carriers, with a few pins left over. It&#8217;s in need of some bypass caps and input filtering, but there should be ample room between the power and ground circuit rails to add them.</p>
<p>Want to make one yourself? Grab the <a href='http://www.cibomahto.com/wp-content/uploads/2010/06/stepper_shield.zip'>board artwork and design files</a>, and the software from after the break.</p>
<p>Arduino board layout thanks to <a href="http://www.macetech.com/blog/node/69">Garrett at Macetech</a>.</p>
<p><strong>UPDATE</strong>: Fixed a small bug in the code (can&#8217;t call delay() from an initialization function)<br />
<span id="more-1031"></span></p>
<pre lang="c++">
class stepper {
  uint8_t resetPin;
  uint8_t stepPin;
  uint8_t directionPin;

  long position;

 public:
  stepper(uint8_t resetPin_, uint8_t stepPin_, uint8_t directionPin_)
    {
      resetPin = resetPin_;
      stepPin = stepPin_;
      directionPin = directionPin_;

      pinMode(resetPin, OUTPUT);
      pinMode(stepPin, OUTPUT);
      pinMode(directionPin, OUTPUT);

      doReset();
    }

    void doReset() {
      position = 0;

      digitalWrite(directionPin, LOW);
      digitalWrite(stepPin, LOW);

      digitalWrite(resetPin, LOW);
      digitalWrite(resetPin, HIGH);
    }

    void moveAbsolute(long newPosition) {
      moveRelative(newPosition - position);
    }

    void moveRelative(long counts) {
      if ( counts > 0) {
        digitalWrite(directionPin, HIGH);
      }
      else {
        digitalWrite(directionPin, LOW);
      }

      unsigned long absCounts = abs(counts);

      for ( unsigned long absCounts = abs(counts); absCounts > 0; absCounts--) {
        digitalWrite(stepPin, HIGH);
        digitalWrite(stepPin, LOW);
        delayMicroseconds(1000);
      }

      position += counts;
    }

    long getPosition() {return position;}
};

stepper stepperA(10, 11, 12);
stepper stepperB(14, 15, 16);
stepper stepperC(7, 8, 9);
stepper stepperD(17, 18, 19);

void setup() {
}

void loop() {
  // Move one whole rotation and back
  stepperA.moveRelative((long)-200*16*36);
  delay(200);
  stepperA.moveRelative((long)200*16*36);
  delay(200);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/one-shield-to-fit-them-all-and-in-the-darkness-bind-them/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu rocks so hard, it goes to 11</title>
		<link>http://www.cibomahto.com/2010/06/ubuntu-rocks-so-hard-it-goes-to-11/</link>
		<comments>http://www.cibomahto.com/2010/06/ubuntu-rocks-so-hard-it-goes-to-11/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 03:25:23 +0000</pubDate>
		<dc:creator>mahto</dc:creator>
				<category><![CDATA[Ridiculous]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cibomahto.com/?p=1019</guid>
		<description><![CDATA[Well, it allows you to set the sound volume amplification at over 100%. Which is really handy when you are trying to listen to a quiet video on underpowered speakers. To get to this dialog, hit up System->Preferences->Sound.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cibomahto.com/wp-content/uploads/2010/06/ubuntu_goes_to_111.jpg"><img src="http://www.cibomahto.com/wp-content/uploads/2010/06/ubuntu_goes_to_111.jpg" alt="" title="ubuntu_goes_to_11" width="592" height="517" class="alignnone size-full wp-image-1023" /></a><br />
Well, it allows you to set the sound volume amplification at over 100%. Which is <em>really</em> handy when you are trying to listen to a quiet video on underpowered speakers.<br />
To get to this dialog, hit up System->Preferences->Sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cibomahto.com/2010/06/ubuntu-rocks-so-hard-it-goes-to-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
