<?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>Plumbing for the Arduino</title>
	<atom:link href="http://www.rockalypse.org/blogs/plumbing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rockalypse.org/blogs/plumbing</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 19 Oct 2009 05:13:16 +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>Exploration: PWM in Software &#8211; Part II</title>
		<link>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-ii/</link>
		<comments>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-ii/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 05:13:16 +0000</pubDate>
		<dc:creator>Radu</dc:creator>
				<category><![CDATA[PWM]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[occam-pi]]></category>

		<guid isPermaLink="false">http://baseplate.org/blogs/plumbing/?p=42</guid>
		<description><![CDATA[The last implementation proved to be very slow, so an obvious improvement was to eliminate the ticker; i.e. the dependence on the clock for synchronization. By removing the ticker process we ensure that PWM will run as fast as the virtual machine is. Here is the updated diagram: When tested, this implementation runs quite a [...]]]></description>
			<content:encoded><![CDATA[<p>The last implementation proved to be very slow, so an obvious improvement was to eliminate the <strong><em>ticker</em></strong>; i.e. the dependence on the clock for synchronization. By removing the <strong><em>ticker</em></strong> process we ensure that PWM will run as fast as the virtual machine is. Here is the updated diagram:</p>
<p style="text-align: center">
<div id="attachment_43" class="wp-caption aligncenter" style="width: 550px"><img class="size-full wp-image-43 " src="http://www.rockalypse.org/blogs/plumbing/wp-content/uploads/2009/10/pwm-sofware-no-ticker.jpg" alt="PWM in Software (No Clock)" width="540" height="164" /><p class="wp-caption-text">PWM in Software (No Clock)</p></div>
<p style="text-align: left">When tested, this implementation runs quite a bit faster &#8211; the LED actually gives an impression of dimming. But upon plugging a speaker into the same pin we get a definite &#8220;buzzing&#8221; noice, when the desired effect is more like a nice sound. Hence, still not fast enough. It is therefore time to read the <em>Arduino</em> data sheet and find out how to do it in hardware.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploration: PWM in Software &#8211; Part I</title>
		<link>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-i/</link>
		<comments>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-i/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:59:40 +0000</pubDate>
		<dc:creator>Radu</dc:creator>
				<category><![CDATA[PWM]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[occam-pi]]></category>

		<guid isPermaLink="false">http://baseplate.org/blogs/plumbing/?p=30</guid>
		<description><![CDATA[In this post I will be referring to Pulse Width Modulation as PWM, which you can read about more here. Since before I started working on this project I did not know anything about PWM, I did a bit of reading on-line and without getting into too much technical detail I started coding it as [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will be referring to Pulse Width Modulation as PWM, which you can read about more <a title="here" href="http://en.wikipedia.org/wiki/Pulse-width_modulation" target="_blank">here</a>.</p>
<p>Since before I started working on this project I did not know anything about PWM, I did a bit of reading on-line and without getting into too much technical detail I started coding it as it first came to mind. The graph below is what I came up with.</p>
<p style="text-align: center">
<div id="attachment_36" class="wp-caption aligncenter" style="width: 550px"><img class="size-full wp-image-36 " src="http://www.rockalypse.org/blogs/plumbing/wp-content/uploads/2009/10/pwm-sofware-small.jpg" alt="PWM in Software" width="540" height="157" /><p class="wp-caption-text">PWM in Software</p></div>
<p>The diagram abobe shows five parallel processes:</p>
<ul>
<li><em><strong>ticker</strong></em> controls the rate at which <em><strong>sine</strong></em>, and<strong><em> saw</em></strong> and <strong><em>control</em></strong> operate. It also dictates the rate at which <strong><em>control</em></strong> operates, although not necessary;</li>
<li><strong><em>saw</em></strong> and <strong><em>sine</em></strong> are just two oscillating functions, the difference being that <strong><em>sine</em></strong> has a constant increment, while <em><strong>saw</strong></em> has its increment dependent on the level you want to do PWM; since they have different increment / decrement rates, they intersect at rates dependent on the level you pass to <strong><em>saw</em></strong>;</li>
<li><strong><em>control</em></strong> reads the values from <strong><em>saw</em></strong> and <strong><em>sine</em></strong> and if they crossed sends a signal to <strong><em>switch</em></strong>;</li>
<li><strong><em>switch</em></strong> upon receiving a signal flips the power on or off.</li>
</ul>
<p>This implementation, even though very ugly, does what it is supposed to do, almost. By almost I mean it modulates the pulse, but the modulation is not fast enough to give an impression of dimming an LED. That is, the LED appears to just blink at a fast rate, but to actually achieve PWM as it is supposed to be, we would need a much faster virtual machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockalypse.org/blogs/plumbing/2009/10/19/exploration-pwm-in-software-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stepping Onto The Platform</title>
		<link>http://www.rockalypse.org/blogs/plumbing/2009/09/28/intro/</link>
		<comments>http://www.rockalypse.org/blogs/plumbing/2009/09/28/intro/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 16:30:00 +0000</pubDate>
		<dc:creator>Radu</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[occam-pi]]></category>

		<guid isPermaLink="false">http://baseplate.org/blogs/plumbing/?p=21</guid>
		<description><![CDATA[As the title might suggest, this post is about me getting familiar with the Occam concurrent programming language and the Arduino. Occam runs on the Arduino by means of the Transterpreter VM. So my first little project was to get the development environment set up, get the code to cross-compile, and write a little blink program that would [...]]]></description>
			<content:encoded><![CDATA[<p>As the title might suggest, this post is about <a href="http://www.rdcrng.net" target="_blank">me</a> getting familiar with the <em>Occam</em> concurrent programming language and the <em>Arduino</em>.</p>
<p><em>Occam </em>runs on the <em>Arduino </em>by means of the <em>Transterpreter </em>VM. So my first little project was to get the development environment set up, get the code to cross-compile, and write a little <em>blink </em>program that would cause an LED to&#8230;, well, blink. Here is a process diagram:</p>
<p><img class="aligncenter size-full wp-image-26" src="http://www.rockalypse.org/blogs/plumbing/wp-content/uploads/2009/09/blink.jpg" alt="PROC blink" width="816" height="149" />Not a terribly complicated exercise, but got my feet wet. So, <em><strong>tick</strong></em> is being awakened by the system every <em>ms </em>milliseconds at which point it sends a <em>signal </em>to toggle. Upon receiving it&#8217;s <em>signal</em>, <em><strong>toggle </strong></em>flips the <em>level </em>it has on record and sends it to <em><strong>led</strong></em>. Then <em><strong>led</strong> </em>just does a digital write on the <em>pin </em>it monitors. This is the magic of <em><strong>blink</strong></em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockalypse.org/blogs/plumbing/2009/09/28/intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
