<?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>semifluid.com</title>
	<atom:link href="http://semifluid.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://semifluid.com</link>
	<description>Intermediate in flow properties between solids and liquids; highly viscous.</description>
	<lastBuildDate>Tue, 10 Jan 2012 05:33:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Switching hosts</title>
		<link>http://semifluid.com/2012/01/04/switching-hosts/</link>
		<comments>http://semifluid.com/2012/01/04/switching-hosts/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 18:10:20 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://semifluid.com/?p=638</guid>
		<description><![CDATA[I&#8217;ve switched hosting providers, so I am currently transitioning my blog from the old provider to the new one. There are a number of broken links and a number of issues that I am trying to resolve (specifically with my old folder organization structure for JAL code), but hopefully this will all be cleaned up [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve switched hosting providers, so I am currently transitioning my blog from the old provider to the new one. There are a number of broken links and a number of issues that I am trying to resolve (specifically with my old folder organization structure for JAL code), but hopefully this will all be cleaned up soon!</p>
<p><a title="426 - Upgrade Required by GirlieMac, on Flickr" href="http://www.flickr.com/photos/girliemac/6509400771/"><img class="aligncenter" src="http://farm8.staticflickr.com/7167/6509400771_33a1f59890.jpg" alt="426 - Upgrade Required" width="500" height="400" /></a></p>
<p><strong>Update 01/09/2012</strong>: Still slowly transitioning the old posts to WordPress.  Unfortunately, there isn&#8217;t an easy way (that I am aware of) to convert my old static-page format into the dynamic WordPress format, meaning that I have to upload each image individually and fix the code in the posts.  So, unfortunately, it&#8217;s taking longer than I would prefer.  In addition, I have been transitioning from YouTube to locally hosted videos, but unfortunately, that has been a battle as well.  So, things are in a bit of disarray at this point, but will get better soon (I promise!).</p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2012/01/04/switching-hosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repel DEET Numbers Game</title>
		<link>http://semifluid.com/2011/08/17/repel-deet-numbers-game/</link>
		<comments>http://semifluid.com/2011/08/17/repel-deet-numbers-game/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 17:45:35 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Consumerism]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=608</guid>
		<description><![CDATA[Repel produces a number of DEET products intended to scare away those little flying buggers that seem to be everywhere on these warm summer nights. While walking through my local Target, I noticed that there were varying concentrations available for purchase at my local store (please excuse the hand-held photos): 23% DEET 40% DEET 100% [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.repel.com/" target="_blank">Repel</a> produces a number of <a href="https://secure.wikimedia.org/wikipedia/en/wiki/DEET" target="_blank">DEET</a> products intended to scare away those little flying buggers that seem to be everywhere on these warm summer nights. While walking through my local Target, I noticed that there were varying concentrations available for purchase at my local store (please excuse the hand-held photos):</p>
<table border="0" align="center">
<tbody>
<tr>
<td style="text-align: center;"><strong>23% DEET</strong></td>
<td style="text-align: center;"><strong>40% DEET</strong></td>
<td style="text-align: center;"><strong>100% DEET</strong></td>
</tr>
<tr>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET23.jpg"><img class="size-medium wp-image-609 aligncenter" title="RepelDEET23" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET23-179x300.jpg" alt="" width="179" height="300" /></a></td>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET40.jpg"><img class="size-medium wp-image-610 aligncenter" title="RepelDEET40" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET40-179x300.jpg" alt="" width="179" height="300" /></a></td>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET100.jpg"><img class="size-medium wp-image-611 aligncenter" title="RepelDEET100" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET100-179x300.jpg" alt="" width="179" height="300" /></a></td>
</tr>
</tbody>
</table>
<p>After looking a bit closer at the labels though, I noticed something peculiar in the &#8220;Active Ingredient&#8221; list&#8230;</p>
<p><span id="more-608"></span></p>
<p>Although the 23% and 40% concentrations included the proper percentages of DEET in their formulations, the 100% DEET repellent had only 98.11% DEET.  Here are crops from the above photos:</p>
<table border="0" align="center">
<tbody>
<tr>
<td style="text-align: center;"><strong>23% DEET <strong>Crop</strong><br />
</strong></td>
<td style="text-align: center;"><strong>40% DEET Crop<br />
</strong></td>
<td style="text-align: center;"><strong>100% DEET <strong>Crop</strong><br />
</strong></td>
</tr>
<tr>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET23crop.jpg"><img class="size-medium wp-image-613 aligncenter" title="RepelDEET23crop" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET23crop-300x225.jpg" alt="" width="180" height="135" /></a></td>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET40crop.jpg"><img class="size-medium wp-image-614 aligncenter" title="RepelDEET40crop" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET40crop-300x225.jpg" alt="" width="180" height="135" /></a></td>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET100crop.jpg"><img class="size-medium wp-image-615 aligncenter" title="RepelDEET100crop" src="http://www.semifluid.com/wp-content/uploads/2011/08/RepelDEET100crop-300x225.jpg" alt="" width="180" height="135" /></a></td>
</tr>
</tbody>
</table>
<p>All of the other variants include the labeled percentages of DEET, but Repel decided that the 100% variant would not. Instead, it contains 100% DEET* (where the asterisk notes that the percentage is now the &#8220;Relative % DEET&#8221;).  Hmm&#8230; so what exactly does &#8220;Relative % DEET&#8221; mean?  I could not find any information on the packaging (old or <a href="http://www.repel.com/~/media/Repel/Files/Labels/011423941085.ashx" target="_blank">new</a>) nor could I find information on the internet, so who knows?</p>
<p>I called Repel (1-888-880-1181), which is a subsidiary of United Industries Corporation, to find out why there were incongruities with the labeling.  The young woman I spoke with told me that although the 23% and 40% formulations include the percentage stated on the label, the 100% formulation (that only has 98.11% DEET) was marketed as such due to industry nomenclature.  She could not tell me what &#8220;Relative % DEET&#8221; meant.</p>
<p>It appears as though Repel has realized &#8220;Relative % DEET&#8221; could not be easily quantified or marketed without the asterisk, so they have removed the percentage sign from <a href="http://www.repel.com/~/media/Repel/Files/Labels/011423941085.ashx" target="_blank">newer packaging</a>, labeling the product as simply &#8220;Repel 100&#8243;.  However, many online stores are still marketing the Repel as containing 100% DEET:</p>
<table border="0" align="center">
<tbody>
<tr>
<td style="text-align: center;"><strong>Walmart.com: <a href="http://www.walmart.com/ip/Repel-100-Percent-Deet-Pump-4-oz/16561282" target="_blank">Repel 100 Percent Deet Pump, 4 oz</a></strong></td>
<td style="text-align: center;"><strong>Amazon.com: <a href="http://www.amazon.com/Repel-Insect-Repellent-Spray-402000/dp/B000LGN3Z2" target="_blank">Repel 100 1 oz Insect Repellent Pump Spray 100% DEET 402000</a><br />
</strong></td>
</tr>
<tr>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/Walmart.png"><img class="size-medium wp-image-617 aligncenter" title="Walmart" src="http://www.semifluid.com/wp-content/uploads/2011/08/Walmart-300x193.png" alt="" width="210" height="135" /></a></td>
<td><a href="http://www.semifluid.com/wp-content/uploads/2011/08/Walmart.png"><img class="size-medium wp-image-617 aligncenter" title="Walmart" src="http://www.semifluid.com/wp-content/uploads/2011/08/Walmart-300x193.png" alt="" width="210" height="135" /></a></td>
</tr>
</tbody>
</table>
<p>Although this is a minor example, some companies allow their marketing departments a bit too much freedom, so it is important to be a savvy consumer (e.g., see: <a href="http://consumerist.com/2011/01/lawsuit-says-taco-bell-ground-beef-is-really-just-taco-meat-filling.html" rel="bookmark">Lawsuit: Taco Bell Ground Beef Is Really Just &#8220;Meat Filling&#8221;</a>).  So, when looking at varying concentrations, <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Caveat_emptor" target="_blank">caveat emptor</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2011/08/17/repel-deet-numbers-game/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Calculating the COM of a Spherical Plot</title>
		<link>http://semifluid.com/2010/06/30/calculating-the-com-of-a-spherical-plot/</link>
		<comments>http://semifluid.com/2010/06/30/calculating-the-com-of-a-spherical-plot/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 21:15:39 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Mathematica]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Center of Gravity]]></category>
		<category><![CDATA[Center of Mass]]></category>
		<category><![CDATA[COG]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Coordinates]]></category>
		<category><![CDATA[Integral]]></category>
		<category><![CDATA[Spherical]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=319</guid>
		<description><![CDATA[What is everyone excited for??? More math! Ok, maybe not, but I&#8217;ll come back to the electronics projects later (including investigating the Parallax RFID reader, Arduino FIO, and heck, maybe even some more LED fun). In the meantime, let&#8217;s get back to math. What do the volume calculations look like, and how would one go [...]]]></description>
			<content:encoded><![CDATA[<p>What is everyone excited for??? More math! Ok, maybe not, but I&#8217;ll come back to the electronics projects later (including investigating the <a href="http://www.parallax.com/tabid/768/ProductID/114/Default.aspx">Parallax RFID reader</a>, <a href="http://arduino.cc/en/Main/ArduinoBoardFio">Arduino FIO</a>, and heck, maybe even some more <a href="http://www.semifluid.com/?p=213">LED fun</a>). In the meantime, let&#8217;s get back to math.</p>
<p><a href="http://www.semifluid.com/wp-content/uploads/2010/06/sphere.png"><img class="aligncenter size-full wp-image-326" title="sphere" src="http://www.semifluid.com/wp-content/uploads/2010/06/sphere.png" alt="" width="360" height="402" /></a></p>
<p>What do the volume calculations look like, and how would one go about calculating the center of mass/geometric centroid of a spherical plot? More after the break&#8230;<br />
<span id="more-319"></span><br />
So, using our good buddy, Wolfram Mathworld, we know that the spherical coordinate <a href="http://mathworld.wolfram.com/VolumeElement.html">volume element</a>, basically the volume we will be using when integrating the solid, is equal to:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=dV%20%3D%20%5Crho%5E2%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='dV = \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta' title='dV = \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta' class='latex' /></p>
<p><a href="http://www.spsu.edu/math/Dillon/VolumeElementSphericalCoordinates.htm" class="broken_link">This link</a> has a nice illustration of the spherical volume element. Note that we are going to use the <a href="https://secure.wikimedia.org/wikipedia/en/wiki/ISO_31-11">ISO 31-11 convention</a> for our coordinate system, meaning that <img src='http://s.wordpress.com/latex.php?latex=%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta' title='\theta' class='latex' /> is the &#8220;longitude&#8221; and ranges from <img src='http://s.wordpress.com/latex.php?latex=0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='0' title='0' class='latex' /> to <img src='http://s.wordpress.com/latex.php?latex=2%5Cpi&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2\pi' title='2\pi' class='latex' />, <img src='http://s.wordpress.com/latex.php?latex=%5Cphi&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\phi' title='\phi' class='latex' /> is the &#8220;latitude&#8221; and ranges from <img src='http://s.wordpress.com/latex.php?latex=0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='0' title='0' class='latex' /> to <img src='http://s.wordpress.com/latex.php?latex=%5Cpi&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\pi' title='\pi' class='latex' />, and <img src='http://s.wordpress.com/latex.php?latex=%5Crho&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\rho' title='\rho' class='latex' /> is the radius at any given point.</p>
<p>Integrating this around a sphere gives us the volume of the sphere:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5E2%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta' title='V = \int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cfrac%7B1%7D%7B3%7D%20r%5E3%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{2\pi} \! \int_o^{\pi} \! \frac{1}{3} r^3 \sin(\phi) \, d\phi \, d\theta' title='V = \int_0^{2\pi} \! \int_o^{\pi} \! \frac{1}{3} r^3 \sin(\phi) \, d\phi \, d\theta' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cfrac%7B2%7D%7B3%7D%20r%5E3%20%5C%2C%20d%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{2\pi} \! \frac{2}{3} r^3 \, d\theta' title='V = \int_0^{2\pi} \! \frac{2}{3} r^3 \, d\theta' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cfrac%7B4%7D%7B3%7D%20%5Cpi%20r%5E3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \frac{4}{3} \pi r^3' title='V = \frac{4}{3} \pi r^3' class='latex' /></p>
<p>To convert from spherical to Cartesian coordinates, we have to simply use the following:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=x%20%3D%20%5Crho%5Csin%28%5Cphi%29%5Ccos%28%5Ctheta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x = \rho\sin(\phi)\cos(\theta)' title='x = \rho\sin(\phi)\cos(\theta)' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=y%20%3D%20%5Crho%5Csin%28%5Cphi%29%5Csin%28%5Ctheta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y = \rho\sin(\phi)\sin(\theta)' title='y = \rho\sin(\phi)\sin(\theta)' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=z%20%3D%20%5Crho%5Ccos%28%5Cphi%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='z = \rho\cos(\phi)' title='z = \rho\cos(\phi)' class='latex' /></p>
<p>So, to solve for the x, y, and z centers of mass, we will need to convert from spherical cooridnates to Cartesian coordinates. We will do this while calculating the <a href="http://mathworld.wolfram.com/FunctionCentroid.html">function centroid</a> for each axis. The basic formula is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM%20%3D%20%5Cfrac%7B%5Cint%20%5C%21%20x%20f%28x%29%20%5C%2C%20dx%7D%7B%5Cint%20%5C%21%20f%28x%29%20%5C%2C%20dx%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM = \frac{\int \! x f(x) \, dx}{\int \! f(x) \, dx}' title='COM = \frac{\int \! x f(x) \, dx}{\int \! f(x) \, dx}' class='latex' /></p>
<p>Our <img src='http://s.wordpress.com/latex.php?latex=f%28x%29%20%5C%2C%20dx&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='f(x) \, dx' title='f(x) \, dx' class='latex' /> in this case is the <img src='http://s.wordpress.com/latex.php?latex=dV&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='dV' title='dV' class='latex' /> from above and so the basic forms for the COM for each of the three axes is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20x%20%5C%2C%20dV%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20dV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! x \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' title='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! x \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20y%20%5C%2C%20dV%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20dV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! y \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' title='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! y \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20z%20%5C%2C%20dV%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20dV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! z \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' title='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! z \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}' class='latex' /></p>
<p>So, substituting our Cartesian coordinate conversions and our <img src='http://s.wordpress.com/latex.php?latex=dV&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='dV' title='dV' class='latex' /> from above:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5Csin%28%5Cphi%29%5Ccos%28%5Ctheta%29%20%5Crho%5E2%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\cos(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' title='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\cos(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5Csin%28%5Cphi%29%5Csin%28%5Ctheta%29%20%5Crho%5E2%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\sin(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' title='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\sin(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5Ccos%28%5Cphi%29%20%5Crho%5E2%20%5Csin%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\cos(\phi) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' title='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\cos(\phi) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}' class='latex' /></p>
<p>Simplified:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5E3%20%5Csin%28%5Cphi%29%5E2%20%5Ccos%28%5Ctheta%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7BV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \cos(\theta) \, d\rho \, d\phi \, d\theta}{V}' title='COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \cos(\theta) \, d\rho \, d\phi \, d\theta}{V}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5E3%20%5Csin%28%5Cphi%29%5E2%20%5Csin%28%5Ctheta%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7BV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \sin(\theta) \, d\rho \, d\phi \, d\theta}{V}' title='COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \sin(\theta) \, d\rho \, d\phi \, d\theta}{V}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_o%5E%7B%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br%7D%20%5C%21%20%5Crho%5E3%20%5Csin%28%5Cphi%29%20%5Ccos%28%5Cphi%29%20%5C%2C%20d%5Crho%20%5C%2C%20d%5Cphi%20%5C%2C%20d%5Ctheta%7D%7BV%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi) \cos(\phi) \, d\rho \, d\phi \, d\theta}{V}' title='COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi) \cos(\phi) \, d\rho \, d\phi \, d\theta}{V}' class='latex' /></p>
<p>Solving these for a constant (i.e., <img src='http://s.wordpress.com/latex.php?latex=r&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r' title='r' class='latex' />) leads to:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = 0' title='COM_{x} = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = 0' title='COM_{y} = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = 0' title='COM_{z} = 0' class='latex' /></p>
<p>No big surprise, because, as we would assume, the center of mass for a sphere should be at the origin, <img src='http://s.wordpress.com/latex.php?latex=%280%2C0%2C0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(0,0,0)' title='(0,0,0)' class='latex' />.</p>
<p>Now, instead of a perfect circle, let&#8217;s try a different shape, say defined by:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=r%28%5Cphi%2C%5Ctheta%29%20%3D%201%2B%5Csin%28%5Cfrac%7B%5Ctheta%7D%7B2%7D%29%5Csin%28%5Cphi%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r(\phi,\theta) = 1+\sin(\frac{\theta}{2})\sin(\phi)' title='r(\phi,\theta) = 1+\sin(\frac{\theta}{2})\sin(\phi)' class='latex' /></p>
<p>A shape that looks somewhat like a peach and leads to COM values of:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B-%5Cfrac%7B784%7D%7B225%7D-%5Cfrac%7B41%5Cpi%5E2%7D%7B128%7D%7D%7B5%5Cpi%7D%20%5Capprox%20-0.423&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{-\frac{784}{225}-\frac{41\pi^2}{128}}{5\pi} \approx -0.423' title='COM_{x} = \frac{-\frac{784}{225}-\frac{41\pi^2}{128}}{5\pi} \approx -0.423' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = 0' title='COM_{y} = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = 0' title='COM_{z} = 0' class='latex' /></p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Peach1.png"><img class="size-medium wp-image-354 alignnone" title="Peach1" src="http://www.semifluid.com/wp-content/uploads/2010/06/Peach1-273x300.png" alt="" width="273" height="300" /></a><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Peach2.png"><img class="size-medium wp-image-354 alignnone" title="Peach2" src="http://www.semifluid.com/wp-content/uploads/2010/06/Peach2-273x300.png" alt="" width="273" height="300" /></a></p>
<p>Or a spiraling shell:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=r%28%5Cphi%2C%5Ctheta%29%20%3D%201%2B%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r(\phi,\theta) = 1+\theta' title='r(\phi,\theta) = 1+\theta' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B6%5Cpi%5E2%28-3%2B6%5Cpi%2B4%5Cpi%5E2%29%7D%7B-1%2B%281%2B2%5Cpi%29%5E4%7D%20%5Capprox%201.165&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{6\pi^2(-3+6\pi+4\pi^2)}{-1+(1+2\pi)^4} \approx 1.165' title='COM_{x} = \frac{6\pi^2(-3+6\pi+4\pi^2)}{-1+(1+2\pi)^4} \approx 1.165' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B6%5Cpi%5E2%281%2B%5Cpi%29%28-5%2B2%5Cpi%2B2%5Cpi%5E2%29%7D%7B-1%2B%281%2B2%5Cpi%29%5E4%7D%20%5Capprox%20-1.833&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{6\pi^2(1+\pi)(-5+2\pi+2\pi^2)}{-1+(1+2\pi)^4} \approx -1.833' title='COM_{y} = \frac{6\pi^2(1+\pi)(-5+2\pi+2\pi^2)}{-1+(1+2\pi)^4} \approx -1.833' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = 0' title='COM_{z} = 0' class='latex' /></p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Shell1.png"><img class="alignnone size-medium wp-image-361" title="Shell1" src="http://www.semifluid.com/wp-content/uploads/2010/06/Shell1-207x300.png" alt="" width="207" height="300" /></a><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Shell2.png"><img class="alignnone size-medium wp-image-360" title="Shell2" src="http://www.semifluid.com/wp-content/uploads/2010/06/Shell2-207x300.png" alt="" width="207" height="300" /></a></p>
<p>Or perhaps something really out there:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=r%28%5Cphi%2C%5Ctheta%29%20%3D%201%2B%5Csin%283%5Ctheta%29%5Csin%284%5Cphi%29%2B%5Csin%28%5Ctheta%29%5Csin%28%5Cfrac%7B%5Cphi%7D%7B3%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r(\phi,\theta) = 1+\sin(3\theta)\sin(4\phi)+\sin(\theta)\sin(\frac{\phi}{3})' title='r(\phi,\theta) = 1+\sin(3\theta)\sin(4\phi)+\sin(\theta)\sin(\frac{\phi}{3})' class='latex' /></p>
<p>With COM values of:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = 0' title='COM_{x} = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B32383290752127%7D%7B62456794017280%7D%20%5Capprox%200.518&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{32383290752127}{62456794017280} \approx 0.518' title='COM_{y} = \frac{32383290752127}{62456794017280} \approx 0.518' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20-%5Cfrac%7B359881023%7D%7B2416474112%7D%20%5Capprox%20-0.149&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = -\frac{359881023}{2416474112} \approx -0.149' title='COM_{z} = -\frac{359881023}{2416474112} \approx -0.149' class='latex' /></p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Weird1.png"><img class="alignnone size-medium wp-image-366" title="Weird1" src="http://www.semifluid.com/wp-content/uploads/2010/06/Weird1-251x300.png" alt="" width="251" height="300" /></a><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Weird2.png"><img class="alignnone size-medium wp-image-367" title="Weird2" src="http://www.semifluid.com/wp-content/uploads/2010/06/Weird2-251x300.png" alt="" width="251" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2010/06/30/calculating-the-com-of-a-spherical-plot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating the COM of a 3D Surface of Revolution</title>
		<link>http://semifluid.com/2010/06/29/calculating-the-com-of-a-3d-surface-of-revolution/</link>
		<comments>http://semifluid.com/2010/06/29/calculating-the-com-of-a-3d-surface-of-revolution/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 20:10:53 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Mathematica]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=242</guid>
		<description><![CDATA[My current research at Rutgers focuses on identifying the cognitive mechanisms that are employed when perceiving the shape and structure of 3D objects. One of the little problems that I had to overcome was finding out how to calculate the center of mass/gravity of a 3D surface of revolution analytically. Specifically, I needed to calculate [...]]]></description>
			<content:encoded><![CDATA[<p>My current research at Rutgers focuses on identifying the cognitive mechanisms that are employed when perceiving the shape and structure of 3D objects. One of the little problems that I had to overcome was finding out how to calculate the center of mass/gravity of a 3D <a href="http://mathworld.wolfram.com/SurfaceofRevolution.html">surface of revolution</a> analytically. Specifically, I needed to calculate the COM for <a href="http://mathworld.wolfram.com/ConicalFrustum.html">conical frustums</a> with and without an attached part (which was also analytically generated).</p>
<p><a href="http://www.semifluid.com/wp-content/uploads/2010/06/Cylinders-with-Parts-COM-Calculate-v9-Low-Salience.png"><img class="aligncenter size-full wp-image-245" title="Cylinders with Parts COM Calculate v9 - Low Salience" src="http://www.semifluid.com/wp-content/uploads/2010/06/Cylinders-with-Parts-COM-Calculate-v9-Low-Salience.png" alt="" width="362" height="353" /></a></p>
<p>Unfortunately, it wasn&#8217;t as easy to derive as I assumed, but the steps toward that end are pretty straightforward.  After the break you can see the general equation I ultimately derived for calculating the COM in 3D-space.<br />
<span id="more-242"></span><br />
A conical frustum will be defined with attributes <img src='http://s.wordpress.com/latex.php?latex=R_%7B1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='R_{1}' title='R_{1}' class='latex' /> (the top radius), <img src='http://s.wordpress.com/latex.php?latex=R_%7B2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='R_{2}' title='R_{2}' class='latex' /> (the bottom radius), and <img src='http://s.wordpress.com/latex.php?latex=h&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='h' title='h' class='latex' /> (the height of the truncated cone).</p>
<p>The radius of the frustum at any given height <img src='http://s.wordpress.com/latex.php?latex=z&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='z' title='z' class='latex' /> is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=r_%7Bfr%7D%28z%29%3D%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r_{fr}(z)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2}' title='r_{fr}(z)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2}' class='latex' /></p>
<p>The area of this slice at any given height <img src='http://s.wordpress.com/latex.php?latex=z&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='z' title='z' class='latex' /> is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=A%28z%29%20%3D%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%3D%20%5Cpi%20r_%7Bfr%7D%28z%29%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A(z) = \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r \, dr \, d\theta = \pi r_{fr}(z)^2' title='A(z) = \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r \, dr \, d\theta = \pi r_{fr}(z)^2' class='latex' /></p>
<p>Then the volume can be calculated by integrating across all heights:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7Bh%7D%20%5C%21%20A%28z%29%20%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{h} \! A(z) , dz' title='V = \int_0^{h} \! A(z) , dz' class='latex' /></p>
<p>Combine these three equations together and we have:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7Bh%7D%20%5C%21%20%5Cpi%20%28%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%29%5E2%20%5C%2C%20dz%20%3D%20%5Cfrac%7B1%7D%7B3%7D%20h%20%5Cpi%20%28R_%7B1%7D%5E2%20%2B%20R_%7B1%7D%20R_%7B2%7D%20%2B%20R_%7B2%7D%5E2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{h} \! \pi (\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2})^2 \, dz = \frac{1}{3} h \pi (R_{1}^2 + R_{1} R_{2} + R_{2}^2)' title='V = \int_0^{h} \! \pi (\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2})^2 \, dz = \frac{1}{3} h \pi (R_{1}^2 + R_{1} R_{2} + R_{2}^2)' class='latex' /></p>
<p>Ok, so now we have the radius, area, and volume of the conical frustum. Using this information, we can now calculate the center of mass.</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%29%7D%20%5C%21%20r%5E2%20%5Ccos%28%5Ctheta%29%20A%28z%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r^2 \cos(\theta) A(z) \, dr \, d\theta \, dz = 0' title='COM_{x} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r^2 \cos(\theta) A(z) \, dr \, d\theta \, dz = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%29%7D%20%5C%21%20r%5E2%20%5Csin%28%5Ctheta%29%20A%28z%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%20%3D%200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r^2 \sin(\theta) A(z) \, dr \, d\theta \, dz = 0' title='COM_{y} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z)} \! r^2 \sin(\theta) A(z) \, dr \, d\theta \, dz = 0' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20z%20A%28z%29%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{1}{V} \int_0^h \! z A(z) \, dz' title='COM_{z} = \frac{1}{V} \int_0^h \! z A(z) \, dz' class='latex' /></p>
<p>Doing a little substitution with <img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z}' title='COM_{z}' class='latex' />:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5E%7Bh%7D%20%5C%21%20z%20%5Cpi%20%28%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%29%5E2%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{1}{V} \int_0^{h} \! z \pi (\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2})^2 \, dz' title='COM_{z} = \frac{1}{V} \int_0^{h} \! z \pi (\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2})^2 \, dz' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cfrac%7Bh%5E2%20%5Cpi%20%28R_%7B1%7D%5E2%20%2B%202%20R_%7B1%7D%20R_%7B2%7D%20%2B%203%20R_%7B2%7D%5E2%29%7D%7B12%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='= \frac{1}{V} \frac{h^2 \pi (R_{1}^2 + 2 R_{1} R_{2} + 3 R_{2}^2)}{12}' title='= \frac{1}{V} \frac{h^2 \pi (R_{1}^2 + 2 R_{1} R_{2} + 3 R_{2}^2)}{12}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=%3D%20%5Cfrac%7Bh%20%28R_%7B1%7D%5E2%20%2B%202%20R_%7B1%7D%20R_%7B2%7D%20%2B%203%20R_%7B2%7D%5E2%29%7D%7B4%28R_%7B1%7D%5E2%20%2B%20R_%7B1%7D%20R_%7B2%7D%20%2B%20R_%7B2%7D%5E2%29%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='= \frac{h (R_{1}^2 + 2 R_{1} R_{2} + 3 R_{2}^2)}{4(R_{1}^2 + R_{1} R_{2} + R_{2}^2)}' title='= \frac{h (R_{1}^2 + 2 R_{1} R_{2} + 3 R_{2}^2)}{4(R_{1}^2 + R_{1} R_{2} + R_{2}^2)}' class='latex' /></p>
<p>Note that because the conical frustum is radially symmetric around the z-axis, the COM for both x and y will be 0. This obviously will not be the case for shapes with more complex surfaces of revolution, but is a nice little proof.</p>
<p>Complex, you want complex??</p>
<p>So, we will add a simple part onto the shape (like the one in the image above), defined using both a radial function, <img src='http://s.wordpress.com/latex.php?latex=f_%7Brad%7D%28%5Ctheta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='f_{rad}(\theta)' title='f_{rad}(\theta)' class='latex' />, and a vertical function, <img src='http://s.wordpress.com/latex.php?latex=f_%7Bvert%7D%28z%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='f_{vert}(z)' title='f_{vert}(z)' class='latex' />. The functions themselves can be any analytical functions, as long as they are continuous. And frankly, it doesn&#8217;t matter for this proof, so we&#8217;ll leave them undefined for the time being.</p>
<p>Remember how simple the radius at any given height was? (Just to remind you: <img src='http://s.wordpress.com/latex.php?latex=r_%7Bfr%7D%28z%29%3D%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r_{fr}(z)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2}' title='r_{fr}(z)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2}' class='latex' />). Now we need to add our radial and vertical functions, making the function dependent upon not only height, but also angle:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=r_%7Bfr%7D%28z%2C%5Ctheta%29%3D%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28theta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r_{fr}(z,\theta)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(theta)' title='r_{fr}(z,\theta)=\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(theta)' class='latex' /></p>
<p>Given that the radius is now a bit more complex, the area of this slice at any given height <img src='http://s.wordpress.com/latex.php?latex=z&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='z' title='z' class='latex' /> is now:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=A%28z%29%20%3D%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='A(z) = \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta' title='A(z) = \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta' class='latex' /></p>
<p>Then the volume is now a bit more complicated:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=V%20%3D%20%5Cint_0%5E%7Bh%7D%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='V = \int_0^{h} \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta \, dz' title='V = \int_0^{h} \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta \, dz' class='latex' /></p>
<p>And now we can calculate the COMs:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%5E2%20%5Ccos%28%5Ctheta%29%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r^2 \cos(\theta) (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz' title='COM_{x} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r^2 \cos(\theta) (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%5E2%20%5Csin%28%5Ctheta%29%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r^2 \sin(\theta) (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz' title='COM_{y} = \frac{1}{V} \int_0^h \! \int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r^2 \sin(\theta) (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B1%7D%7BV%7D%20%5Cint_0%5Eh%20%5C%21%20z%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7Br_%7Bfr%7D%28z%2C%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dz&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{1}{V} \int_0^h \! z (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dz' title='COM_{z} = \frac{1}{V} \int_0^h \! z (\int_0^{2\pi} \! \int_0^{r_{fr}(z,\theta)} \! r \, dr \, d\theta) \, dz' class='latex' /></p>
<p>The good news, all you really need to define is <img src='http://s.wordpress.com/latex.php?latex=r_%7Bfr%7D%28z%2Ctheta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r_{fr}(z,theta)' title='r_{fr}(z,theta)' class='latex' /> and h. The bad news, pentuple integrals. Substituting all of the necessary equations, we get these monstrosities:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bx%7D%20%3D%20%5Cfrac%7B%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%5E2%20%5Ccos%28%5Ctheta%29%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%7D%7B%5Cint_0%5E%7Bh%7D%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{x} = \frac{\int_0^h \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r^2 \cos(\theta) (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' title='COM_{x} = \frac{\int_0^h \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r^2 \cos(\theta) (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7By%7D%20%3D%20%5Cfrac%7B%5Cint_0%5Eh%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%5E2%20%5Csin%28%5Ctheta%29%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%7D%7B%5Cint_0%5E%7Bh%7D%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{y} = \frac{\int_0^h \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r^2 \sin(\theta) (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' title='COM_{y} = \frac{\int_0^h \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r^2 \sin(\theta) (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dr \, d\theta \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=COM_%7Bz%7D%20%3D%20%5Cfrac%7B%5Cint_0%5Eh%20%5C%21%20z%20%28%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%29%20%5C%2C%20dz%7D%7B%5Cint_0%5E%7Bh%7D%20%5C%21%20%5Cint_0%5E%7B2%5Cpi%7D%20%5C%21%20%5Cint_0%5E%7B%5Cfrac%7Bh-z%7D%7Bh%7D%20R_%7B1%7D%20%2B%20%5Cfrac%7Bz%7D%7Bh%7D%20R_%7B2%7D%20%2B%20f_%7Bvert%7D%28z%29%20f_%7Brad%7D%28%5Ctheta%29%7D%20%5C%21%20r%20%5C%2C%20dr%20%5C%2C%20d%5Ctheta%20%5C%2C%20dz%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='COM_{z} = \frac{\int_0^h \! z (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' title='COM_{z} = \frac{\int_0^h \! z (\int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta) \, dz}{\int_0^{h} \! \int_0^{2\pi} \! \int_0^{\frac{h-z}{h} R_{1} + \frac{z}{h} R_{2} + f_{vert}(z) f_{rad}(\theta)} \! r \, dr \, d\theta \, dz}' class='latex' /></p>
<p>Not very pretty, ehh? Well, in the meantime, I&#8217;ll leave the final calculations for you to work on. Suffice to say, it is a pain in the butt.</p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2010/06/29/calculating-the-com-of-a-3d-surface-of-revolution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8&#215;8 RGB LED Display</title>
		<link>http://semifluid.com/2010/06/28/8x8-rgb-led-display/</link>
		<comments>http://semifluid.com/2010/06/28/8x8-rgb-led-display/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 02:21:23 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[C Projects]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[PIC Projects]]></category>
		<category><![CDATA[PIC16F628]]></category>
		<category><![CDATA[Controller]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[RGB]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=213</guid>
		<description><![CDATA[So, this project was sidelined until I had to make another BatchPCB purchase.  Thankfully it wasn&#8217;t too long until I had the opportunity to work on it again! The current setup is basically 4 of the original 4 RGB LED Controller boards and 12 of the updated DR1r3 boards. All 16 are wired in parallel [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">So, this project was sidelined until I had to make another <a href="http://www.batchpcb.com" target="_blank">BatchPCB</a> purchase.  Thankfully it wasn&#8217;t too long until I had the opportunity to work on it again!  The current setup is basically 4 of the <a href="http://www.semifluid.com/?p=147">original 4 RGB LED Controller boards</a> and 12 of the <a href="http://www.semifluid.com/?p=191">updated DR1r3 boards</a>.  All 16 are wired in parallel and being controlled by my desktop machine.  You can see an extended version of this RGB test sequence after the break and I&#8217;m also including the (uncommented, sorry!) <a href="http://processing.org/" target="_blank">Processing 1.1</a> code that I used to control the boards.</p>
<div align="center">
	<video id="wp_mep_1"   width="480" height="270" poster="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.png" controls="controls" preload="none"  >
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.mp4" type="video/mp4" />
		
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.webm" type="video/webm" />
		
		
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.ogv" type="video/ogg" />
		
		<object width="480" height="270" type="application/x-shockwave-flash" data="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf">
			<param name="movie" value="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf" />
			<param name="flashvars" value="controls=true&amp;file=http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.mp4" />			
		</object>		
	</video>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#wp_mep_1').mediaelementplayer({
		m:1
		
		,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']
		
	});
});
</script>

</div>
<div style="height: 16px;">
</div>
<p><span id="more-213"></span></p>
<p>Here&#8217;s an extended cut of the video display (which is displaying an RGB Test Sequence).  Note that the current maximum throughput is approximately 12-13 frames per second due to the RS-232 baud rate bottleneck, but I&#8217;m looking for ways to speed up the data transfer without requiring a faster oscillator.:</p>
<div align="center">
	<video id="wp_mep_2"   width="480" height="270" poster="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.png" controls="controls" preload="none"  >
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.mp4" type="video/mp4" />
		
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.webm" type="video/webm" />
		
		
		<source src="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.ogv" type="video/ogg" />
		
		<object width="480" height="270" type="application/x-shockwave-flash" data="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf">
			<param name="movie" value="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf" />
			<param name="flashvars" value="controls=true&amp;file=http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.mp4" />			
		</object>		
	</video>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#wp_mep_2').mediaelementplayer({
		m:1
		
		,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']
		
	});
});
</script>

</div>
<div style="height: 16px;">
</div>
<p>The <a href="http://processing.org/" target="_blank">Processing 1.1</a> code:<br />
<a href="http://www.semifluid.com/wp-content/uploads/2010/06/VideoDisplay.zip">VideoDisplay</a> (includes the .pde file and the video used)</p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2010/06/28/8x8-rgb-led-display/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.ogv" length="12262276" type="video/ogg" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.ogv" length="60536842" type="video/ogg" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.mp4" length="23686891" type="video/mp4" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.mp4" length="5766496" type="video/mp4" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplayCloseup.webm" length="1646625" type="video/webm" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/06/8x8PIC16F628RGBLEDdisplay.webm" length="6849338" type="video/webm" />
		</item>
		<item>
		<title>4 RGB LED Controller Update</title>
		<link>http://semifluid.com/2010/02/16/4-rgb-led-controller-update/</link>
		<comments>http://semifluid.com/2010/02/16/4-rgb-led-controller-update/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 17:44:18 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[C Projects]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[PIC Projects]]></category>
		<category><![CDATA[PIC16F628]]></category>
		<category><![CDATA[Controller]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Lights]]></category>
		<category><![CDATA[RGB]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=191</guid>
		<description><![CDATA[I recently began working on a consulting project that required the creation of some PCBs.  Since I have had such great success with BatchPCB.com in the past, I decided to use them again to fab the custom PCBs.  The BatchPCB purchasing system adds a few static fees (set-up, handling, and shipping), so I felt that [...]]]></description>
			<content:encoded><![CDATA[<p>I recently began working on a consulting project that required the creation of some PCBs.  Since I have had such great success with <a href="http://www.BatchPCB.com" target="_blank">BatchPCB.com</a> in the <a href="http://www.semifluid.com/?p=147" target="_self">past</a>, I decided to use them again to fab the custom PCBs.  The BatchPCB purchasing system adds a few static fees (set-up, handling, and shipping), so I felt that this was as good a time as any to make some additional of my <a href="http://www.semifluid.com/?p=147" target="_self">PIC16F628 4 RGB LED PWM Controller</a> boards with a couple of modifications.</p>
<p><a href="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1877.jpg"><img class="aligncenter size-medium wp-image-197" title="4 RGB LED Controller Boards" src="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1877-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p><span id="more-191"></span>As I noted in the previous post, there was an error on the first revision of the board and a pull-up resistor on RA5 (pin 4 in the schematic above) was necessary.  I added the MCLR resistor to the board along with a couple of other modifications:</p>
<ul>
<li>Removed the extraneous capacitors, we only need one.</li>
<li>Added a breakout for the one remaining I/O pin.</li>
<li>Added a small perfboard to the PCB with +5V and ground lines.</li>
<li>Relocated the resistors to make them <em>much easier </em>to solder.  I may use a SIL resistor array in the future.</li>
</ul>
<p>I kept the LED locations exactly the same because, hey, if I put all of the time and effort into the 4 boards that I previously ordered, then I might as well keep the same form factor.  My scheme for the short-term is to create a 4&#215;4 array of the 4 RGB LED Controller boards, which will give me a 20cmx20cm 8&#215;8 RGB LED display.</p>
<p>Here are some pictures of the boards:</p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1874.jpg"><img class="size-thumbnail wp-image-196 alignnone" title="4 RGB LED Controller Board Front" src="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1874-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1872.jpg"><img class="size-thumbnail wp-image-195 alignnone" title="4 RGB LED Controller Board Back" src="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1872-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1871.jpg"><img class="size-thumbnail wp-image-194 alignnone" title="4 RGB LED Controller Board Front and Back" src="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1871-150x150.jpg" alt="" width="150" height="150" /></a><a href="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1868.jpg"> <img class="alignnone size-thumbnail wp-image-193" title="4 RGB LED Controller Boards Group" src="http://www.semifluid.com/wp-content/uploads/2010/02/DSC_1868-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p style="text-align: left;">Here is the updated schematic and board (note, you can open the BRD and SCH files in <a href="http://www.cadsoft.de/" target="_blank">Eagle Layout Editor</a>):</p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3-Eagle-Schematic.png"><img class="alignnone size-thumbnail wp-image-206" title="PIC16F628 4 RGB LED DR1r3 Eagle Schematic" src="http://www.semifluid.com/wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3-Eagle-Schematic-150x150.png" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3-Eagle-Board.png"><img class="alignnone size-thumbnail wp-image-205" title="PIC16F628 4 RGB LED DR1r3 Eagle Board" src="http://www.semifluid.com/wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3-Eagle-Board-150x150.png" alt="" width="150" height="150" /></a></p>
<ul>
<li><a href="../wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3.sch">PIC16F628 4 RGB LED DR1r3 Eagle Schematic</a></li>
<li><a href="http://www.semifluid.com/wp-content/uploads/2010/02/PIC16F628-4-RGB-LED-DR1r3.brd">PIC16F628 4 RGB LED DR1r3 Eagle Board</a></li>
</ul>
<p style="text-align: left;">And finally, here is an updated firmware that improves the PWM performance:</p>
<ul>
<li><a href="http://www.semifluid.com/wp-content/uploads/2010/02/16F628-Serial-4-LED-PWM-4-bit-exp-DR1r8.c">16F628 Serial 4 LED PWM &#8211; 4-bit exp DR1r8.c</a></li>
<li><a href="http://www.semifluid.com/wp-content/uploads/2010/02/16F628-Serial-4-LED-PWM-4-bit-exp-DR1r8.hex">16F628 Serial 4 LED PWM &#8211; 4-bit exp DR1r8.hex</a></li>
</ul>
<p>I will make sure to post when I have the full array put together (I currently only have 12 of the 16 boards I need for the 4&#215;4 array).</p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2010/02/16/4-rgb-led-controller-update/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Life of a Graduate Student</title>
		<link>http://semifluid.com/2010/02/15/life-of-a-graduate-student/</link>
		<comments>http://semifluid.com/2010/02/15/life-of-a-graduate-student/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 01:07:07 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Visual Illusion Sensation Perception Aftereffect Afterimage]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=186</guid>
		<description><![CDATA[I have been neglecting semifluid.com for sometime now, but fear not! I will post new projects shortly as I try to dig through the comments.  My time has been split between coursework (which is diminishing), research, and teaching.  As I send revisions of papers back and forth with my advisor, I will devote time to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been neglecting <a href="http://www.semifluid.com">semifluid.com</a> for sometime now, but fear not!  I will post new projects shortly as I try to dig through the comments.  My time has been split between coursework (which is diminishing), research, and teaching.  As I send revisions of papers back and forth with my advisor, I will devote time to updating the site.  In the meantime, here are 3 videos demonstrating aftereffects that I created for my sensation and perception lab:</p>
<div align="center">
	<video id="wp_mep_3"   width="480" height="270" poster="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.png" controls="controls" preload="none"  >
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.mp4" type="video/mp4" />
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.webm" type="video/webm" />
		
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.ogv" type="video/ogg" />
		
		<object width="480" height="270" type="application/x-shockwave-flash" data="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf">
			<param name="movie" value="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf" />
			<param name="flashvars" value="controls=true&amp;file=http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.mp4" />			
		</object>		
	</video>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#wp_mep_3').mediaelementplayer({
		m:1
		
		,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']
		
	});
});
</script>

</div>
<div style="height: 16px;">
</div>
<p><span id="more-186"></span></p>
<div align="center">
	<video id="wp_mep_4"   width="480" height="270" poster="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.png" controls="controls" preload="none"  >
		<source src="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.mp4" type="video/mp4" />
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.webm" type="video/webm" />
		
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.ogv" type="video/ogg" />
		
		<object width="480" height="270" type="application/x-shockwave-flash" data="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf">
			<param name="movie" value="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf" />
			<param name="flashvars" value="controls=true&amp;file=http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.mp4" />			
		</object>		
	</video>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#wp_mep_4').mediaelementplayer({
		m:1
		
		,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']
		
	});
});
</script>

</div>
<div style="height: 16px;">
</div>
<div align="center">
	<video id="wp_mep_5"   width="480" height="270" poster="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.png" controls="controls" preload="none"  >
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.mp4" type="video/mp4" />
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.webm" type="video/webm" />
		
		
		<source src="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.ogv" type="video/ogg" />
		
		<object width="480" height="270" type="application/x-shockwave-flash" data="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf">
			<param name="movie" value="http://semifluid.com/wp-content/plugins/media-element-html5-video-and-audio-player/mediaelement/flashmediaelement.swf" />
			<param name="flashvars" value="controls=true&amp;file=http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.mp4" />			
		</object>		
	</video>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#wp_mep_5').mediaelementplayer({
		m:1
		
		,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']
		
	});
});
</script>

</div>
<div style="height: 16px;">
</div>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2010/02/15/life-of-a-graduate-student/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.mp4" length="0" type="video/mp4" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.ogv" length="0" type="video/ogg" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.mp4" length="15589879" type="video/mp4" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.ogv" length="2128466" type="video/ogg" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/OpponentAftereffect.webm" length="899211" type="video/webm" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.mp4" length="0" type="video/mp4" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.ogv" length="0" type="video/ogg" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectSpiral.webm" length="2525911" type="video/webm" />
<enclosure url="http://semifluid.com/wp-content/uploads/2010/02/MotionAftereffectWaterfall.webm" length="1717958" type="video/webm" />
		</item>
		<item>
		<title>PIC16F628 4 RGB LED PWM Controller</title>
		<link>http://semifluid.com/2009/01/06/pic16f628-4-rgb-led-pwm-controller/</link>
		<comments>http://semifluid.com/2009/01/06/pic16f628-4-rgb-led-pwm-controller/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 19:36:53 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[C Projects]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[PIC Projects]]></category>

		<guid isPermaLink="false">http://www.semifluid.com/?p=147</guid>
		<description><![CDATA[I am a big fan of LEDs.  Bright, colorful, flashing LEDs.  So, given my affinity for LEDs, I decided to work on a controller that me and a few of my friends could use as an art project/passive information display.  I have posted videos from the first prototypes (here and here), but it has been [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big fan of <a href="http://en.wikipedia.org/wiki/LED" target="_blank">LEDs</a>.  Bright, colorful, flashing LEDs.  So, given <a href="http://www.semifluid.com/?cat=6" target="_self">my affinity</a> for LEDs, I decided to work on a controller that me and a few of my friends could use as an art project/passive information display.  I have posted videos from the first prototypes (<a href="http://www.semifluid.com/?p=127" target="_self">here</a> and <a href="http://www.semifluid.com/?p=139" target="_self">here</a>), but it has been tough to dedicate time to further development given my research, so I thought I would post the information so that anyone can take the design and modify it to their liking!</p>
<p><a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-rainbow.jpg" target="_blank"><img class="aligncenter size-full wp-image-152" title="4rgbled-angle-rainbow_thumb" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-rainbow_thumb.jpg" alt="" width="500" height="334" /><span id="more-147"></span></a></p>
<p>Some insipration came from the <a href="http://thingm.com/products/blinkm.html" target="_blank">BlinkM</a> &#8220;smart LED&#8221; and the <a href="http://www.macetech.com/blog/node/54" target="_blank">ShiftBrite</a> RGB LED Module, but I was interested in using RS232 serial control.  Therefore, I chose one of my favorite simple-to-use microcontrollers, the <a href="http://www.semifluid.com/?cat=5" target="_self">PIC16F628</a>.  The advantages include the built-in 4MHz oscillator, hardware USART, and ease of reprogramming.  A couple of features I had in mind during the design:</p>
<ol>
<li>Multiple intensities for each color (using PWM)</li>
<li>Multiple individually controllable RGB LEDs</li>
<li>High-speed update rate</li>
<li>Daisy-chainable and addressable</li>
<li>Simple serial control</li>
</ol>
<p style="text-align: left;"><strong>Schematic</strong><a href="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r1-schematic.png" target="_blank"><br />
Here</a> is the full schematic for the driver.  I chose to use a <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010209" target="_blank">PIC16F628</a> as the microcontroller because it is cheap, has a internal oscillator (4 MHz) and an internal USART. NOTE: There is an error in this schematic and a pull-up resistor on RA5 (pin 4 in the schematic) is necessary.  See the bottom of the post for an updated schematic and board.</p>
<p style="text-align: left;"><a href="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r1-schematic.png" target="_blank"><img class="size-thumbnail wp-image-164 aligncenter" title="pic16f628-4-rgb-led-dr1r1-schematic" src="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r1-schematic-150x150.png" alt="" width="150" height="150" /></a></p>
<p><strong>Board<br />
</strong>I decided I would try getting a PCB printed for the first time, so I got boards created at <a href="http://www.batchpcb.com" target="_blank">BatchPCB.com</a> for $5 each.  The total for 4 boards shipped was $32.36 (4 x $5 for the boards and $12.36 for shipping and handling).  They took a long time to arrive, but the quality was well worth the wait.  NOTE: There is an error on the first revision of the board and a pull-up resistor on RA5 (pin 4 in the schematic above) is necessary.  You can see how I compensated for the mistake in the <a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-off.jpg" target="_blank">second picture</a> below (look on the back of the upper-left board).  This will be corrected in future revisions.  See the bottom of the post for an updated schematic and board.</p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r1-board.png"><img class="alignnone size-thumbnail wp-image-165" title="pic16f628-4-rgb-led-dr1r1-board" src="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r1-board-150x150.png" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-off.jpg"><img class="alignnone size-thumbnail wp-image-157" title="4rgbled-front-off" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-off-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-off.jpg"><img class="alignnone size-thumbnail wp-image-153" title="4rgbled-angle-off" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-off-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p><strong>Control Format<br />
</strong>The current firmware has 8 commands (the 9th, self-test was removed to save space).  See the source code for the firmware for how the commands are implemented, but here is some example usage:</p>
<ul>
<li>Turn off all LEDs: 0h2000FF</li>
<li>Make all LEDs full-intensity red: 0h2F00FF</li>
<li>Make all LEDs full-intensity red: 0h1F00F00F00F00FF</li>
<li>Make all LEDs at address 1 half-intensity green: 0h207001</li>
<li>Make LED 2 at address 1 half-intensity green: 0h100007000000001</li>
<li>Load start-up settings for all controllers: 0h40FF</li>
</ul>
<p>Commands:</p>
<ol>
<li>Update individual LEDs using 4-bit exponential update<br />
Byte 1, Nibble 1 = led1Red;   Byte 1, Nibble 2 = led1Green<br />
Byte 2, Nibble 1 = led1Blue;  Byte 2, Nibble 2 = led2Red<br />
Byte 3, Nibble 1 = led2Green; Byte 3, Nibble 2 = led2Blue<br />
Byte 4, Nibble 1 = led3Red;   Byte 4, Nibble 2 = led3Green<br />
Byte 5, Nibble 1 = led3Blue;  Byte 5, Nibble 2 = led4Red<br />
Byte 6, Nibble 1 = led4Green; Byte 6, Nibble 2 = led4Blue<br />
Byte 7 = theAddress</li>
<li>Update all LEDs using 4-bit exponential update<br />
Byte 0, Nibble 2 = led1Red = led2Red = led3Red = led4Red<br />
Byte 1, Nibble 1 = led1Green = led2Green = led3Green = led4Green<br />
Byte 1, Nibble 2 = led1Blue = led2Blue = led3Blue = led4Blue<br />
Byte 2 = theAddress</li>
<li>Save start-up settings<br />
Byte 1 = theAddress</li>
<li>Load start-up settings<br />
Byte 1 = theAddress</li>
<li>Get address<br />
Byte 1 = theAddress</li>
<li>Set address (one-time set)<br />
Byte 1 = theAddress to save<br />
Byte 2 = theAddress</li>
<li><strong><em>Disabled in this release.<br />
</em></strong>Self test<br />
Byte 1 = theAddress</li>
<li>Update individual LEDs using 6-bit update<br />
Byte 1 = led1Red;    Byte 2 = led1Green<br />
Byte 3 = led1Blue;   Byte 4 = led2Red<br />
Byte 5 = led2Green;  Byte 6 = led2Blue<br />
Byte 7 = led3Red;    Byte 8 = led3Green<br />
Byte 9 = led3Blue;   Byte 10 = led4Red<br />
Byte 11 = led4Green; Byte 12 = led4Blue<br />
Byte 13 = theAddress</li>
<li>Update all LEDs using 6-bit update<br />
Byte 1 = led1Red = led2Red = led3Red = led4Red<br />
Byte 2 = led1Green = led2Green = led3Green = led4Green<br />
Byte 3 = led1Blue = led2Blue = led3Blue = led4Blue<br />
Byte 4 = theAddress</li>
</ol>
<p><strong>Source Code<br />
</strong>The PIC16F628 needs to be programmed with the firmware below.  The Windows application is included as an example of how one could control a 2&#215;2 array of the PIC16F628 4 RGB LED PWM Controller boards (4&#215;4 LEDs).</p>
<ul>
<li><a href="http://www.semifluid.com/wp-content/uploads/2009/01/16f628-serial-4-led-pwm-4-bit-exp-dr1r7.c">16f628-serial-4-led-pwm-4-bit-exp-dr1r7.c</a> (<a href="http://www.semifluid.com/wp-content/uploads/2009/01/16f628-serial-4-led-pwm-4-bit-exp-dr1r7.hex">hex</a>)</li>
<li><a href="http://www.semifluid.com/wp-content/uploads/2009/01/16-led-sequencer-dr1r2.zip">16 Led Sequencer DR1r2</a></li>
</ul>
<p>The first couple of prototypes have worked well, but I am still working on refining the PCB, circuit, firmware, and software design.  Here are a few pictures of the boards:</p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-rainbow.jpg"><img class="alignnone size-thumbnail wp-image-163" title="4rgbled-angle-rainbow" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-rainbow-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-rainbow.jpg"><img class="alignnone size-thumbnail wp-image-159" title="4rgbled-front-rainbow" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-rainbow-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-white.jpg"><img class="alignnone size-thumbnail wp-image-151" title="4rgbled-angle-white" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-angle-white-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-white.jpg"><img class="alignnone size-thumbnail wp-image-161" title="4rgbled-front-white" src="http://www.semifluid.com/wp-content/uploads/2009/01/4rgbled-front-white-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p style="text-align: left;"><strong><em>Update (01/06/2008)</em><br />
</strong>Here is an updated schematic and board with the corrected MCLR pullup:</p>
<p style="text-align: center;"><a href="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r2-schematic.png"><img class="alignnone size-thumbnail wp-image-175" title="pic16f628-4-rgb-led-dr1r2-schematic" src="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r2-schematic-150x150.png" alt="" width="150" height="150" /></a> <a href="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r2-board.png"><img class="alignnone size-thumbnail wp-image-176" title="pic16f628-4-rgb-led-dr1r2-board" src="http://www.semifluid.com/wp-content/uploads/2009/01/pic16f628-4-rgb-led-dr1r2-board-150x150.png" alt="" width="150" height="150" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://semifluid.com/2009/01/06/pic16f628-4-rgb-led-pwm-controller/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>

