<?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 &#187; PWM</title>
	<atom:link href="http://www.rockalypse.org/blogs/plumbing/category/pwm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rockalypse.org/blogs/plumbing</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 12 Sep 2011 19:23:40 +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>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[arduino]]></category>
		<category><![CDATA[occam-pi]]></category>
		<category><![CDATA[PWM]]></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[arduino]]></category>
		<category><![CDATA[occam-pi]]></category>
		<category><![CDATA[PWM]]></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>
	</channel>
</rss>

