<?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>10Dogs.net</title>
	<atom:link href="http://www.10dogs.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.10dogs.net</link>
	<description>Talk techie to me...</description>
	<lastBuildDate>Tue, 30 Aug 2011 10:54:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Model Boom-Gate &#8211; the sequel (or &#8220;More Spaghetti than an Italian Restaurant&#8221;)</title>
		<link>http://www.10dogs.net/2011/08/30/model-boom-gate-the-sequel/</link>
		<comments>http://www.10dogs.net/2011/08/30/model-boom-gate-the-sequel/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 10:54:14 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Boom-gate]]></category>
		<category><![CDATA[Control System]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[State Machine]]></category>
		<category><![CDATA[Statechart]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=28</guid>
		<description><![CDATA[My little boom-gate has made it to work now and been hooked up to the test automation harness. This pic should explain the spaghetti reference in the post title&#8230; This may all look a very unsophisticated , but the systems behind this are industrial strength and pretty comlex. It&#8217;s kind of humbling to think of [...]]]></description>
			<content:encoded><![CDATA[<p>My little boom-gate has made it to work now and been hooked up to the test automation harness.</p>
<p>This pic should explain the <em>spaghetti</em> reference in the post title&#8230;</p>
<div id="attachment_29" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/2011-08-30-12.58.19.jpg"><img class="size-medium wp-image-29" title="More Spaghetti than an Italian Restaurant" src="http://www.10dogs.net/wp-content/uploads/2011/08/2011-08-30-12.58.19-300x225.jpg" alt="More Spaghetti than an Italian Restaurant" width="300" height="225" /></a><p class="wp-caption-text">More Spaghetti than an Italian Restaurant</p></div>
<p><iframe src="http://www.youtube.com/embed/0-rlruwhJBw" frameborder="0" width="420" height="345"></iframe></p>
<p>This may all look a very unsophisticated , but the systems behind this are industrial strength and pretty comlex.</p>
<div id="attachment_31" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/TAMS1.jpg"><img class="size-medium wp-image-31" title="Physical Access Management System" src="http://www.10dogs.net/wp-content/uploads/2011/08/TAMS1-300x222.jpg" alt="Physical Access Management System" width="300" height="222" /></a><p class="wp-caption-text">Physical Access Management System</p></div>
<p>It&#8217;s kind of humbling to think of the millions of $&#8217;s worth of system and the size of the team that has toiled for well over a year putting the system together that is controlling my dinky boom-gate here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2011/08/30/model-boom-gate-the-sequel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Model Boom-Gate</title>
		<link>http://www.10dogs.net/2011/08/28/model-boom-gate/</link>
		<comments>http://www.10dogs.net/2011/08/28/model-boom-gate/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 02:13:10 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Boom-gate]]></category>
		<category><![CDATA[Control System]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[State Machine]]></category>
		<category><![CDATA[Statechart]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=21</guid>
		<description><![CDATA[My project at work at the moment is a large Physical Access Control System (PACS). We have automated some of the testing of physical devices with an I/O interface and API into the control devices. As a bit of fun I built this to hang off the controller rather than watching events and status updates [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<p>My project at work at the moment is a large <a title="Wikipedia Link" href="http://en.wikipedia.org/wiki/Access_control">Physical Access Control System</a> (PACS). We have automated some of the testing of physical devices with an I/O interface and API into the control devices.</p>
<p>As a bit of fun I built this to hang off the controller rather than watching events and status updates at a computer console. The code very accurately simulates the behaviour programmed into the PLCs of the <a title="Magnetic Autocontrol MIB30" href="http://www2.ac-magnetic.com/products-Vehicle_Access_Access_Control_Barriers/1-1-1-345-5-E.html">actual boom-gates</a> that are controlling access on several mine-sites and ports all across Queensland.</p>
<div id="attachment_23" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5326-1.jpg"><img class="size-medium wp-image-23" title="Model Boom-Gate" src="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5326-1-300x200.jpg" alt="Model Boom-Gate" width="300" height="200" /></a><p class="wp-caption-text">Model Boom-Gate</p></div>
<h1>Implementation</h1>
<div id="attachment_24" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/boomgate_bb.jpg"><img class="size-medium wp-image-24 " title="Breadboard Wiring" src="http://www.10dogs.net/wp-content/uploads/2011/08/boomgate_bb-300x260.jpg" alt="Breadboard Wiring" width="300" height="260" /></a><p class="wp-caption-text">Breadboard Wiring</p></div>
<p style="text-align: left;">The implementation of this project is very simple. (Though the application is a little novel, I think.)</p>
<h2>Inputs</h2>
<ul>
<li><strong>Open Request:</strong> I have a push-button switch with a pull-down on the breadboard to test (play) with the application, but in reality this digital input is connected to a (normally-open) relay output of the PACS controller board that takes its direction from the overall system after assessing things like: driver ID (RFID); vehicle ID (RFID); qulaifications; fitness for work; fatigue (external systems).</li>
<li><strong>Reed Switch:</strong> This is to simulate the operation of an induction / safety loop as the vehicle passes over it. (This is a <em>very</em> noisy device and really should be debounced through code or hardware.)</li>
</ul>
<h2>Outputs</h2>
<ul>
<li><strong>Open State:</strong> The boom-gate is considered open the moment it starts to move upward and closed the moment it starts to move down. This is used in monitoring to know whether the gate is open without the &#8220;consent&#8221; of the control system, which will then raise an alert.</li>
<li><strong>Safety:</strong> This prevents the boom-gate (locally in its PLC / control) from closing while there is a vehicle under it. This is exposed as an output so the system can determine if the vehicle granted access actually drove through the gate or not.</li>
<li><strong>Servo Position:</strong> To open / close the boom arm.</li>
</ul>
<h2>Control</h2>
<ul>
<li><strong>State Machine:</strong> IMHO, this concept sits really well with embedded or control system software. In my application there are only four states and simple rules / actions on the transitions. There are *way* more complex implementations for this out there and, what appears to be, a pretty solid library available for Arduino. All of this seemed a huge overkill for my little application, so I managed my states and transitions via a simple <em>Switch / Case</em> control structure in my code.</li>
</ul>
<div id="attachment_22" class="wp-caption aligncenter" style="width: 528px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/boomgate_states.jpg"><img class="size-full wp-image-22  " title="boomgate_states" src="http://www.10dogs.net/wp-content/uploads/2011/08/boomgate_states.jpg" alt="UML Statechart" width="518" height="274" /></a><p class="wp-caption-text">UML Statechart</p></div>
<p><iframe src="http://www.youtube.com/embed/ESmDdIQRuko" frameborder="0" width="560" height="345"></iframe></p>
<p><pre class="brush: cpp">  // incredibly simple state machine
  // check for vslid transitions from the current state
  switch(_state)
  {
    case OPENING:
      // current state: Opening
      // transition to: Open
      // guard: Position &gt;= Upper Limit
      // action: none
      if (_position &gt;= INCREMENTS)
      {
        _state = OPEN;
      }
      // current state: Opening
      // transition to: Closing
      // guard: Open Request = false  AND Safety = false
      // action: set Closed
      else if (_openRequest == false &amp;&amp; _safety == false)
      {
        _state = CLOSING;
        _openState = false;
      }
      // open boom-gate
      else
      {
        // increment position and set servo
        setServoPosition(++_position);
      }   
      break;
  
    case OPEN:
      // current state: Open
      // transition to: Closing
      // guard: Open Request = false AND Safety = false
      // action: set Closed
      if (_openRequest == false &amp;&amp; _safety == false)
      {
        _state = CLOSING;
        _openState = false;
      }
      break;
  
    case CLOSING:
      // current state: Closing
      // transition to: Closed
      // guard: Position &lt;= Lower Limit
      // action: none
      if(_position &lt;= 0)
      {
        _state = CLOSED;
      }
      // current state: Closing
      // transition to: Opening
      // guard: Open Request = true OR Safety = true
      // action: set Open
      else if(_openRequest == true || _safety == true)
      {
        _state = OPENING;
        _openState = true;
      }
      // internal state activity: close boom-gate
      else
      {
        // decrement position and set servo
        setServoPosition(--_position);
      }
      break;
  
    default:
      // current state: Closed
      // transition to: Opening
      // guard: Open Request = true
      // action: set Open
      if (_openRequest)
      {
        _state = OPENING;
        _openState = true;
      }
  }</pre></p>
<h2>Construction</h2>
<p>This was pretty simple.</p>
<ul>
<li>A small project case with a slot cutout to mount the servo motor</li>
<li>A length of balsa bolted on to a servo horn for the boom</li>
<li>Cutout in the wood base for the Reed Switch</li>
<li>Fabricate a metal bracket for the Vehicle to mount the magnet</li>
</ul>
<div id="attachment_25" class="wp-caption aligncenter" style="width: 210px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5329.jpg"><img class="size-medium wp-image-25" title="Boom-Gate" src="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5329-200x300.jpg" alt="Boom-Gate" width="200" height="300" /></a><p class="wp-caption-text">Boom-Gate</p></div>
<div id="attachment_26" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5334.jpg"><img class="size-medium wp-image-26" title="Truck" src="http://www.10dogs.net/wp-content/uploads/2011/08/IMG_5334-300x200.jpg" alt="Truck" width="300" height="200" /></a><p class="wp-caption-text">Truck</p></div>
<h1>Links</h1>
<ul>
<li><a title="Fritzig" href="http://fritzing.org/projects/model-boom-gate/">Fritzing Project</a>: This is the host site for a great app for wiring up your breadboard circuit and moving through to PCB design. Fantastic piece of software too!</li>
<li><a href="http://www.10dogs.net/wp-content/uploads/2011/08/boomgate.pde">Arduino Code</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2011/08/28/model-boom-gate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visio Stencil and Template for UML 2.2</title>
		<link>http://www.10dogs.net/2010/03/04/visio-stencil-for-uml/</link>
		<comments>http://www.10dogs.net/2010/03/04/visio-stencil-for-uml/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 01:55:37 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=18</guid>
		<description><![CDATA[I am a simple creature! It made my morning this morning when I discovered a stencil download that added some of the UML 2.2 features to visio (which is floundering somewhere around UML 1.x out of the box&#8230;). &#8220;The UML stencil for Microsoft Visio supports all symbols of the UML 2.2, specified in OMG UML [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<p>I am a simple creature! It made my morning this morning when I discovered a <a title="Visio Stencil and Template for UML 2.2" href="http://softwarestencils.com/uml/index.html">stencil download</a> that added some of the <a title="Unified Modelling Language" href="http://en.wikipedia.org/wiki/Unified_Modeling_Language">UML</a> 2.2 features to visio (which is floundering somewhere around UML 1.x out of the box&#8230;).</p>
<blockquote><p>&#8220;<em>The UML stencil for  Microsoft Visio supports all symbols of the UML 2.2, specified in OMG UML Superstructure Specification, formal/2009-02-02, as well as all previous versions, UML 2.1, UML 2.0, UML 1.5, UML 1.4, UML 1.3 and UML 1.1.</em>&#8220;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2010/03/04/visio-stencil-for-uml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRACK; FLASH; F*CK!</title>
		<link>http://www.10dogs.net/2010/02/07/crack-flash-fck/</link>
		<comments>http://www.10dogs.net/2010/02/07/crack-flash-fck/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 00:15:04 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[embeddedSPARK]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=14</guid>
		<description><![CDATA[With the delay from lightening to thunder, the small flash inside my CE device actually came first; followed by me wondering &#8220;what the hell was that?&#8221;; then the thunder and pretty shortly after was my realisation of what had just happened; followed by my expletive of choice. I am SO glad that I forked out [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<p>With the delay from lightening to thunder, the small flash inside my CE device actually came first; followed by me wondering &#8220;what the hell was that?&#8221;; then the thunder and pretty shortly after was my realisation of what had just happened; followed by my expletive of choice.</p>
<p>I am <em><strong>SO</strong></em> glad that I forked out the extra $&#8217;s to get the AUS/US power adapter with the surge protector&#8230; Thank you very f*cking much <a title="Don't Do It!" href="http://www.ji.com.au/products/PTA878/">Jackson</a>!!! I should have know better and sent the power through my real surge protector as well. Thankfully all of my equipment attached to my <a title="Buy this one!" href="http://www.powersmart.net.au/">Powersmart</a> board didn&#8217;t even shut down.</p>
<p>Two days of relatively solid work to get the build process working, I had just successfully deployed my OS image to the device for the first time and I am never going to see if it actually bloody worked!</p>
<p>I have put too much effort into this in the last few weeks to walk away. I will get on to the competition organisers and see what my options are from here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2010/02/07/crack-flash-fck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows CE Installation</title>
		<link>http://www.10dogs.net/2010/02/06/windows-ce-installation/</link>
		<comments>http://www.10dogs.net/2010/02/06/windows-ce-installation/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 07:00:10 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[embeddedSPARK]]></category>
		<category><![CDATA[Windows CE]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=12</guid>
		<description><![CDATA[Up to this point, for my embedded SPARK entry, I have been playing with the embedded sensors, actuators and micro-controllers for the Control Stations and RC Cars. Time to get serious about the core code for the Control System (which, incidentally, is what I will largely be assessed on). Before I can start developing in [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<p>Up to this point, for my embedded SPARK entry, I have been playing with the embedded <em>sensors</em>, <em>actuators </em>and <em>micro-controllers </em>for the <em>Control Stations </em>and <em>RC Cars</em>.</p>
<p>Time to get serious about the core code for the <em>Control System</em> (which, incidentally, is what I will largely be assessed on).</p>
<p>Before I can start developing in anger, I will need an IDE and tool chain to build the Windows CE OS for the device that I won. Being a novice with CE, I&#8217;m not too proud to RTFM. The manual provided with the hardware from the competition is very comprehensive and well written. A few pages in, I am confronted with the following:</p>
<blockquote><p><strong>Recommended Software Installation Sequence</strong>.<br />
It’s important to install the software in their proper sequences. Here is the recommended software installation sequence, in numeric order.</p>
<ol>
<li>Visual Studio 2005</li>
<li>Visual Studio 2005 SP1</li>
<li>Visual Studio 2005 SP1 update for Vista</li>
<li>Windows Embedded CE 6.0<strong><em> &lt;&#8211; this wasn&#8217;t a &#8220;next, next&#8230;&#8221; install, there was a custom step to select the x86 BSP for my device (I missed that the first time and had to return to here and reinstall everything down the line! <img src='http://www.10dogs.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> )<br />
</em></strong></li>
<li>Windows Embedded CE 6.0 SP1</li>
<li>Windows Embedded CE 6.0 R2</li>
<li>Windows Embedded CE 6.0 R3    <em><strong>&lt;&#8211; this wasn&#8217;t included in the <a title="embeddedSPARK" href="http://www.microsoft.com/windowsembedded/en-us/community/spark/default.mspx">SPARK your Imagination</a> kit supplied by MS. No biggie, except that I live in <a title="Wikipedia" href="http://en.wiktionary.org/wiki/the_sticks">the sticks</a> and get 75kB/sec download speed&#8230;</strong></em></li>
<li>Windows Embedded CE 6.0 R3 Update Rollup    <em><strong>&lt;&#8211; this was omitted from the instructions that came with my embedded device<br />
</strong></em></li>
<li>ICOP_VDX6326_60B_BSP.msi</li>
<li>VDX6326_WINCE600_SDK.msi</li>
<li>CoreCon_v200_x86_WinCE600.msi</li>
<li>AutoLaunch_v200_x86_WinCE600.msi</li>
<li>RegFlushApp_v100_x86_WinCE600.msi</li>
</ol>
</blockquote>
<p>Long story short: 1.5 days later, I have the OS building successfully.I <em>do</em> have 12 warning(s). But hey, if they were serious they&#8217;d make them <strong>error(s)</strong>.</p>
<p>Thankfully, now that this is sorted, it is not something that I will likely have to go through again in a hurry. I am thinking about building a virtual instance of a Win 7 machine solely for developing in CE so that I don&#8217;t have to have Visual Studio 2005 living along side VS 2008+.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2010/02/06/windows-ce-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quadrature Encoder</title>
		<link>http://www.10dogs.net/2010/02/02/quadrature-encoder/</link>
		<comments>http://www.10dogs.net/2010/02/02/quadrature-encoder/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:26:23 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[embeddedSPARK]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=8</guid>
		<description><![CDATA[Physical Setup The hardware to build a quadrature encoder is pretty simple. For the sensors, you need a couple of photo-interrupters and something to do some very lightweight logic and timing calculations (in my case the Arduino). The encoder is a slotted disk, with equal length and spacing of &#8220;light&#8221; and &#8220;dark&#8221;, which rotates through [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<h3>Physical Setup</h3>
<p>The hardware to build a quadrature encoder is pretty simple. For the sensors, you need a couple of photo-interrupters and something to do some very lightweight logic and timing calculations (in my case the Arduino). The encoder is a slotted disk, with equal length and spacing of &#8220;light&#8221; and &#8220;dark&#8221;, which rotates through the slot of the photo-interrupters (I will post the circuit that I used in a follow-up). The photo-interrupters need to be spaced at a quarter of a wavelength (1 wavelength = the total length of one light and dark section of the slotted disk.)</p>
<p>For my proof of concept, I bread-boarded the components and used a piece of card, cut to mimic the slotted disk.</p>
<div class="wp-caption aligncenter" style="width: 250px"><a title="Quadrature Encoder Setup" href="http://www.flickr.com/photos/41078582@N06/4321746335/"><img title="High-Tech Encoder Simulator" src="http://farm5.static.flickr.com/4032/4321746335_39ace990de_m.jpg" alt="Quadrature Encoder Setup" width="240" height="160" /></a><p class="wp-caption-text">High-Tech Encoder Simulator</p></div>
<div class="wp-caption aligncenter" style="width: 250px"><a title="Circuit and Arduino" href="http://www.flickr.com/photos/41078582@N06/4322480488/"><img title="Spaghetti" src="http://farm3.static.flickr.com/2724/4322480488_51b81a1f59_m.jpg" alt="Circuit and Arduino" width="240" height="160" /></a><p class="wp-caption-text">Spaghetti</p></div>
<h3>The Logic</h3>
<p>Below is a table and sequential images showing the sensor outputs. Note that the reference sensor is the left one. (The phase number printed on the card when aligned with this sensor corresponds to the phase in the table.)</p>
<table border="1">
<tbody>
<tr style="text-align: center;">
<th>Phase</th>
<th>Sensor A</th>
<th>Sensor B</th>
<th>Image</th>
</tr>
<tr>
<th>1</th>
<td style="text-align: center;">0</td>
<td style="text-align: center;">0</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4322480858/"><img src="http://farm3.static.flickr.com/2746/4322480858_db5fdab502_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr>
<th>2</th>
<td style="text-align: center;">0</td>
<td style="text-align: center;">1</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4321747713/"><img src="http://farm5.static.flickr.com/4014/4321747713_55e90a92f8_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr>
<th>3</th>
<td style="text-align: center;">1</td>
<td style="text-align: center;">1</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4322481594/"><img src="http://farm3.static.flickr.com/2766/4322481594_7a7a30a620_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr style="text-align: center;">
<th>4</th>
<td>1</td>
<td>0</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4322481984/"><img src="http://farm5.static.flickr.com/4053/4322481984_d504ee957c_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr>
<th>1</th>
<td style="text-align: center;">0</td>
<td style="text-align: center;">0</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4322480858/"><img src="http://farm3.static.flickr.com/2746/4322480858_db5fdab502_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr>
<th>2</th>
<td style="text-align: center;">0</td>
<td style="text-align: center;">1</td>
<td><a title="Quadrature Encoder by sishea, on Flickr" href="http://www.flickr.com/photos/41078582@N06/4321747713/"><img src="http://farm5.static.flickr.com/4014/4321747713_55e90a92f8_t.jpg" alt="Quadrature Encoder" width="100" height="67" /></a></td>
</tr>
<tr>
<th>etc&#8230;</th>
<td style="text-align: center;">etc&#8230;</td>
<td style="text-align: center;">etc&#8230;</td>
<td>*<a href="http://en.wikipedia.org/wiki/Mongkut">Mongkut</a></td>
</tr>
</tbody>
</table>
<p>By only looking at the outputs each time <em>Sensor A</em> changes state, we can tell which direction the encoder is travelling.</p>
<p>If we step through the table rows above, when the state of <em>Sensor A</em> changes from 0 to 1 (phase 2 &#8211;&gt; 3), the sensor values are both 1. When <em>Sensor A</em> changes from 1 to 0 (phase 4 &#8211;&gt; 1), the values are 0 and 0.</p>
<h4>Forward Direction</h4>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/3gMTMDdnC0Y&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/3gMTMDdnC0Y&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>If we now go from bottom to top. When the state of <em>Sensor A</em> changes from 0 to 1 (phase 1 &#8211;&gt; 4), the sensor values are 1 and 0. When the state of <em>Sensor A</em> changes from 1 to 0 (phase 3 &#8211;&gt; 2), the sensor values are 0 and 1.</p>
<h4>Reverse Direction</h4>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/LJx89bxv9YE&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/LJx89bxv9YE&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>In simpler terms: when <em>Sensor A</em> is triggered, if both of the sensor outputs are the same, our encoder is travelling forward; if the sensor outputs are different, the encoder is travelling in the reverse direction.</p>
<p>Give or take a <em>negation</em>, this is the exact behaviour of the <em>exclusive disjunction</em> (or <em>exclusive or</em> ; &#8220;XOR&#8221;) logical connective.</p>
<table border="1" cellpadding="10">
<tbody>
<tr>
<th colspan="2" rowspan="2">P XOR Q</th>
<th colspan="2">Q</th>
</tr>
<tr>
<th>T</th>
<th>F</th>
</tr>
<tr>
<th rowspan="2">P</th>
<th>T</th>
<td>F</td>
<td>T</td>
</tr>
<tr>
<th>F</th>
<td>T</td>
<td>F</td>
</tr>
</tbody>
</table>
<p>Restructured to look more similar to my sensor output table:</p>
<table border="1" cellpadding="10">
<tbody>
<tr>
<th>P</th>
<th>Q</th>
<th>P XOR Q</th>
</tr>
<tr>
<td style="text-align: center;">T</td>
<td style="text-align: center;">T</td>
<td style="text-align: center;">F</td>
</tr>
<tr>
<td style="text-align: center;">T</td>
<td style="text-align: center;">F</td>
<td style="text-align: center;">T</td>
</tr>
<tr>
<td style="text-align: center;">F</td>
<td style="text-align: center;">T</td>
<td style="text-align: center;">T</td>
</tr>
<tr>
<td style="text-align: center;">F</td>
<td style="text-align: center;">F</td>
<td style="text-align: center;">F</td>
</tr>
</tbody>
</table>
<p>So, this very long-winded look at the sensor outputs and comparison to the &#8220;XOR&#8221; logic table gives us the following pseudo-code:</p>
<blockquote><p>When <em>Sensor A</em> changes</p>
<p style="padding-left: 30px;">if <em>Sensor A </em>XOR <em>Sensor B </em>then</p>
<p style="padding-left: 60px;"><em>direction </em>= reverse</p>
<p style="padding-left: 30px;">else</p>
<p style="padding-left: 60px;"><em>direction </em>= forward</p>
</blockquote>
<p>All that&#8217;s left to do is to time how long between interrupts on <em>Sensor A</em>; count the number of notches on your disk and calculate RPM to give you the shaft speed. Easy!</p>
<p>I will do another post shortly with the Arduino specifics and code. (TODO: insert link here)</p>
<p><strong>NB: </strong>The <em>forward</em> and <em>reverse</em> directions of the encoder, the reference sensor and the <em>logical states</em> represented in each phase are entirely arbitrary. I am sure many examples will have made different assumptions around these conditions and will therefore show variations of the output tables etc. The concepts remain the same, it&#8217;s just the detail that changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2010/02/02/quadrature-encoder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedded Spark</title>
		<link>http://www.10dogs.net/2010/01/25/embedded-spark/</link>
		<comments>http://www.10dogs.net/2010/01/25/embedded-spark/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 20:55:54 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[embeddedSPARK]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Windows CE]]></category>

		<guid isPermaLink="false">http://www.10dogs.net/?p=5</guid>
		<description><![CDATA[One of my feeds recently popped up a post on a competition run by the Microsoft embedded group to develop a Windows CE device with a project that encompasses their theme of &#8220;Fun and Games.&#8221; The format of the comp is: Round 1 - Write a three page proposal for your project idea. Round 2 [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://www.10dogs.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCpp.js"></script>
<p><a href="http://www.embeddedspark.com/"><img class="alignnone" title="embeddedSPARK" src="http://www.embeddedspark.com/images/int_header_register.png" alt="embeddedSPARK" width="771" height="168" /></a></p>
<p>One of my feeds recently popped up a post on a <a title="embedded SPARK 2010 Challenge" href="http://www.embeddedspark.com/Default.aspx">competition</a> run by the Microsoft embedded group to develop a Windows CE device with a project that encompasses their theme of &#8220;Fun and Games.&#8221;</p>
<p>The format of the comp is:</p>
<ul>
<li> <strong>Round 1 </strong>- Write a three page proposal for your project idea.</li>
</ul>
<ul>
<li> <strong>Round 2 </strong>- With the <a title="Vortex86DX-SPARK Windows CE Embedded 6.0 JumpStart Kit" href="http://www.embeddedpc.net/Vortex86SPARK/tabid/202/Default.aspx">hardware</a> you won for getting through Round 1, build out the proof of concept in around 8 weeks and submit a video of the working prototype and your design documentation.</li>
</ul>
<ul>
<li> <strong>Round 3 </strong>- Once it&#8217;s sunk in that you&#8217;re going to present in a keynote at a <a title="ESC Silicon Valley" href="http://esc-sv09.techinsightsevents.com/">conference</a> in Silicon Valley and the <em>happy dancing</em> has ceased; start to prepare your notes (with associated freaking out, of course!) At this stage you&#8217;re also looking at a pocket-full of cash and the respect and adulation of adoring fans! (okay, the pocket-full of cash at least&#8230;)</li>
</ul>
<p>I already had <a title="Embedded Grand Prix" href="http://www.embeddedspark.com/submissions/Detail.aspx?eid=251">an idea</a> that had been simmering for a while, that fitted the theme really well and this seemed like the opportunity to see if anyone else thought it a worthwhile pursuit.</p>
<p>Well, someone liked it and I&#8217;m through to Round 2. The dev kit that&#8217;s core to the project is on it&#8217;s way from the US of A at this very moment.</p>
<p>I decided to get a bit of a jump start and have spent the last week or so madly building out the micro-controller and sensor parts. Things are actually going way better than expected and and I will blog about some of the adventures with Arduino, XBee and other assortments, shortly.</p>
<p>I can&#8217;t wait to start tying all the disparate pieces together. (Nor can my wife, who commented this morning on the &#8220;bomb&#8221; of electronics components and scribbled notes that had gone off in the study.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.10dogs.net/2010/01/25/embedded-spark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

