<?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 &#187; Programming</title>
	<atom:link href="http://www.10dogs.net/category/code/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</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>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>
	</channel>
</rss>

