<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Deathpod 3000 by Team Mookemobile</title>
	<atom:link href="http://deathpod3000.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://deathpod3000.wordpress.com</link>
	<description>Documenting the construction and programming of an autonomous r/c car</description>
	<lastBuildDate>Thu, 18 Jun 2009 20:15:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='deathpod3000.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/c6dfec476ddc1cce1638eb4bfcba831c?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Deathpod 3000 by Team Mookemobile</title>
		<link>http://deathpod3000.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://deathpod3000.wordpress.com/osd.xml" title="Deathpod 3000 by Team Mookemobile" />
	<atom:link rel='hub' href='http://deathpod3000.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to Calculate Distance and Bearing to a Latitude Longitude Waypoint in Excel</title>
		<link>http://deathpod3000.wordpress.com/2009/04/30/how-to-calculate-distance-and-bearing-to-a-latitude-longitude-waypoint-in-excel/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/30/how-to-calculate-distance-and-bearing-to-a-latitude-longitude-waypoint-in-excel/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 17:45:43 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=192</guid>
		<description><![CDATA[In testing code for Deathpod3000, I found it very valuable to have a quick and easy way to calculate correct distance and bearing to a latitude longitude waypoint to compare to results I was getting from my Atmega32 C code.  In this article, I will explain a little about the formulas, show them working in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=192&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In testing code for Deathpod3000, I found it very valuable to have a quick and easy way to calculate correct distance and bearing to a latitude longitude waypoint to compare to results I was getting from my Atmega32 C code.  In this article, I will explain a little about the formulas, show them working in Excel and at the end of the article you can download a spreadsheet and play with them yourself.</p>
<p><span id="more-192"></span>For modern microprocessors with 8 byte IEEE floating point numbers, the spherical law of cosines can be used to compute distance between 2 latitude longitude points.  The law of cosines can be expressed in Excel as:</p>
<p>=ACOS((COS(LAT1)*COS(LAT2)*COS((-1*LON2)-(-1*CLON2)))+(SIN(LAT1)*SIN(LAT2)))*r</p>
<p>Whatever units you use for r, the radius of the earth,  will be the units of the returned value.  So, for example, if you want the returned distance in miles, you would use the value 3,959, the mean radius of the earth in miles.  You can also use 6,371 for kilometers or 20,903,520 for feet.  For Deathpod3000, since we are only dealing with small distances and need smallish scale, I used feet.   To play with in Excel, miles is nice because you can run some simple and easy sanity checks.</p>
<p>All of the latitude and longitude values in the formula must be in radians.  It is easy to convert degrees to radians with: =Degrees*PI()/180.  Substitute any cell for Degrees and you&#8217;ll get back radians.  Similarly, you can convert back from radians to degrees with:  =Radians*180/PI().  Substitute any cell for Radians to convert to degrees.</p>
<p>I created columns in my spreadsheet for Degrees and Radians since I&#8217;m used to dealing with latitude and longitude in degrees, but the formulas need radians.  I also created rows for each of the latitude and longitude values and a cell for the value r so I could easily change from miles to feet and back.  The result looks like this:</p>
<div id="attachment_195" class="wp-caption aligncenter" style="width: 345px"><a href="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-28-36.jpg"><img class="size-full wp-image-195" title="Latitude Longitude Degrees Radians Convert" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-28-36.jpg?w=460" alt="Latitude Longitude Degrees Radians Convert"   /></a><p class="wp-caption-text">Latitude Longitude Degrees Radians Convert</p></div>
<p>You can see one of the radians to degrees conversion formulas just above the spreadsheet.</p>
<p>OK, now we&#8217;re ready to do the distance calculation.  As I said before, 1 degree of latitude is 60 nautical miles or roughly 69 statute miles.  Let&#8217;s change lat2 to be 1 degree less than lat1 and make lon1 and lon2 the same.  This should be 2 points directly north/south of each other and about 69 miles apart.  Now, let&#8217;s put in the law of cosines distance formula.  You can see the formula just above the sheet.</p>
<div id="attachment_197" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-40-01.jpg"><img class="size-full wp-image-197" title="Law of Cosines Distance" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-40-01.jpg?w=460&#038;h=174" alt="Law of Cosines Distance" width="460" height="174" /></a><p class="wp-caption-text">Law of Cosines Distance</p></div>
<p>69 miles!  Just what we were expecting.  So that works great for Excel, javascript etc.  For 8 bit microcontrollers with 4 byte floats, however, the formula breaks down for small distances.  The precision of 4 byte floats causes too much error.  There is a slightly more complex formula that does work well at small distances called the haversine formula.  It takes a bit more work, but we should get the same distance we got for the spherical law of cosines.  Here is the haversine formula:</p>
<p>r is the same radius of the earth.<br />
dLat = lat2 &#8211; lat1<br />
dLon = lon2 = lon1<br />
a =  (sin(dlat/2))^2+cos(lat1)*cos(lat2)*(sin(dlon/2))^2<br />
c=2*(atan2(sqrt(1-a), sqrt(a))  (Note that parameters are reversed from the &#8220;normal&#8221; atan2 function)<br />
distance = r * c</p>
<p>So, let&#8217;s add each of these to the spreadsheet and see if we get the same distance value we got before.</p>
<div id="attachment_201" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-41-14.jpg"><img class="size-full wp-image-201" title="Excel Haversine Formula Distance" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-41-14.jpg?w=460&#038;h=291" alt="Excel Haversine Formula Distance" width="460" height="291" /></a><p class="wp-caption-text">Excel Haversine Formula Distance</p></div>
<p>Bingo!  The distance reported by the spherical law of cosines formula and the haversine formula are the same.  If you&#8217;re just using excel or writing in C# on a modern computer, you can use the spherical law of cosines formula and be done.  If you&#8217;re using something like an atmega8, atmega32, pic or similar, it takes a bit more work, but the haversine formula will be more accurate for the short distances you&#8217;ll probably be navigating so go with that.</p>
<p>Ok, so now we know how far away from our waypoint we are, but we don&#8217;t yet know what direction to head.  The formula for determining bearing to a waypoint is:</p>
<p>=MOD(ATAN2((COS(lat1)*SIN(lat2))-(SIN(lat1)*COS(lat1)*COS(lon2-lon1)), SIN(lon2-lon1)*COS(lat2)),2*PI())</p>
<p>First, remember that Excel has the atan2 parameters reversed so this is the Excel formula, but the atmega32 C code I&#8217;ll show in the next post will have the parameters the other way around.  I don&#8217;t know why the Excel atan2 function is different from the way everyone else implemented the function, but we have to live with it.  Second, notice the MOD() function with 2*pi().  The reason for this is we want our heading to be between 0-360 degrees or between 0 and 2 pi radians.  What this does is divide the result by 2 pi (360 degrees) and give us back the remainder.  If the result of the atan2 function is less than 2 pi it simply returns the number.  If it is greater, it divides and gives the remainder, which will always then be between 0 and 2 pi (0-360 degrees).   Here is a simple example using degrees.  Let&#8217;s say the atan2 function returns 380 degrees.  Dividing by 360 degrees gives a value of 1 with a remainder of 20.  The mod function discards the 1 and return 20.  380 degrees on a compass is the same as 20 degrees (20 degrees past 360).  So, the mod fuction wrapped around the atan2 function makes sure that the bearing is always between 0-360 degrees.</p>
<p>Now, all the trig functions in Excel use radians and atan2 is no exception so the formula above gives us the bearing in radians.  To convert to degrees we use the same formula shown above for lat/long:</p>
<p>Radians*180/PI()</p>
<p>So, let&#8217;s add this to our spreadsheet.  Now, point 2, our waypoint, has the same longitude as point 1 so these 2 points are directly north/south of each other.  Latitudes start at the equator and grow larger the farther north or south from the equator you go.  In this case, the latitude is near Denver, Colorado in the northern hemisphere, so larger values mean farther north and smaller values mean farther south.  Point 2, the waypoint, is 1 degree of latitude less than point 1, current position.  This means that the waypoint should be due south of current location at a distance of 69 miles.  Let&#8217;s look at the spreadsheet and see what we get.</p>
<div id="attachment_203" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-58-54.jpg"><img class="size-full wp-image-203" title="Bearing in Excel" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-58-54.jpg?w=460&#038;h=347" alt="Bearing in Excel" width="460" height="347" /></a><p class="wp-caption-text">Bearing in Excel</p></div>
<p>The bearing in radians was pi, which when converted to degrees is 180 degrees.  Perfect.  We can try some other simple tests to make sure it works in other cases as well.  Due east would have latitude the same, but smaller longitude.  Let&#8217;s try that.</p>
<div id="attachment_205" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_11-01-251.jpg"><img class="size-full wp-image-205" title="Due East" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_11-01-251.jpg?w=460&#038;h=348" alt="Due East" width="460" height="348" /></a><p class="wp-caption-text">Due East</p></div>
<p>Rounding the result gives 90 degrees, what we expected.  You can try some other tests, for example put in the lat/lon of Los Angeles and New York City and see if the bearing makes sense.</p>
<p>You can download the Excel spreadsheet I used in the examples here:  <a title="DistanceAndBearingToWaypoint.xls" href="https://s3.amazonaws.com/deathpod3000/DistanceAndBearingToWaypoint.xls" target="_blank">DistanceAndBearingToWaypoint.xls</a></p>
<p>Deathpod3000 uses an Atmel AVR Atmega32 and is programmed with the free gcc C compiler.  The code is very similar, but there are some differences, like swapping parameter order for atan2.  I also created a relative bearing function to compute a -180 to 180 degree &#8220;steering angle&#8221; using current heading and bearing to waypoint.  This allows fairly easily proportional steering.  In the next post I&#8217;ll show and explain the code for doing all of this in C.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=192&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/30/how-to-calculate-distance-and-bearing-to-a-latitude-longitude-waypoint-in-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-28-36.jpg" medium="image">
			<media:title type="html">Latitude Longitude Degrees Radians Convert</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-29_14-40-01.jpg" medium="image">
			<media:title type="html">Law of Cosines Distance</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-41-14.jpg" medium="image">
			<media:title type="html">Excel Haversine Formula Distance</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_10-58-54.jpg" medium="image">
			<media:title type="html">Bearing in Excel</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-30_11-01-251.jpg" medium="image">
			<media:title type="html">Due East</media:title>
		</media:content>
	</item>
		<item>
		<title>Video of First Deathpod3000 Run</title>
		<link>http://deathpod3000.wordpress.com/2009/04/21/video-of-first-deathpod3000-run/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/21/video-of-first-deathpod3000-run/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 21:47:13 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=181</guid>
		<description><![CDATA[Someone shot video of 2 of the first round trials at the Sparkfun Autonomous Vehicle Competition including the first run of Deathpod3000.  The video is from a cell phone so it is a little grainy, but it&#8217;s fun to watch.  I especially like his comments while he&#8217;s shooting.  :-)  The first bot is RAD and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=181&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Someone shot video of 2 of the first round trials at the Sparkfun Autonomous Vehicle Competition including the first run of Deathpod3000.  The video is from a cell phone so it is a little grainy, but it&#8217;s fun to watch.  I especially like his comments while he&#8217;s shooting.  :-)  The first bot is RAD and then at about 2:30 remaining Deathpod&#8217;s run starts.  Thanks to Robert for shooting this!  Click either the pic or the link to view the video&#8230;</p>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 424px"><a href="http://qik.com/video/1463869"><img class="size-full wp-image-182 " title="Deathpod3000 taking off at the start line" src="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-21_15-37-52.jpg?w=460" alt="Deathpod3000 taking off at the start line"   /></a><p class="wp-caption-text">Deathpod3000 taking off at the start line</p></div>
<p><a title="Rad and Deathpod3000 first round runs at Sparkfun Autononmous Vehicle Competition" href="http://qik.com/video/1463869" target="_blank">RAD and Deathpod3000 (at 2:30 remaining)  first round runs at Sparkfun Autonomous Vehicle Competition</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=181&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/21/video-of-first-deathpod3000-run/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/greenshot_2009-04-21_15-37-52.jpg" medium="image">
			<media:title type="html">Deathpod3000 taking off at the start line</media:title>
		</media:content>
	</item>
		<item>
		<title>Deathpod3000 Specs</title>
		<link>http://deathpod3000.wordpress.com/2009/04/19/deathpod3000-specs/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/19/deathpod3000-specs/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 19:48:01 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=168</guid>
		<description><![CDATA[There were some requests on the Sparkfun site for the specs of the vehicles so I thought I&#8217;d list them.  All the info is in the build posts, but the design changed along the way so here is what we ended up with: (Click More&#8230;) Duratrax Evader EXT electric r/c car Atmel AVR Atmega32 running [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=168&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_173" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0381.jpg"><img class="size-full wp-image-173" title="Deathpod3000 Top View" src="http://deathpod3000.files.wordpress.com/2009/04/img_0381.jpg?w=460&#038;h=613" alt="Deathpod3000 Top View" width="460" height="613" /></a><p class="wp-caption-text">Deathpod3000 Top View</p></div>
<p>There were some requests on the Sparkfun site for the specs of the vehicles so I thought I&#8217;d list them.  All the info is in the build posts, but the design changed along the way so here is what we ended up with: (Click More&#8230;)</p>
<p><span id="more-168"></span></p>
<ul>
<li><a title="Duratrax Evader EXT" href="http://www.duratrax.com/cars/dtxd29-evader-ext/" target="_blank">Duratrax Evader EXT</a> electric r/c car</li>
<li><a title="Atmel AVR Atmega32" href="http://www.sparkfun.com/commerce/product_info.php?products_id=209" target="_blank">Atmel AVR Atmega32</a> running at 8mhz</li>
<li><a title="40 pin AVR development board" href="http://www.sparkfun.com/commerce/product_info.php?products_id=31" target="_blank">40 pin AVR development board</a></li>
<li><a title="16X2 character LCD" href="http://www.futurlec.com/LCDDisp.shtml" target="_blank">16X2 character LCD</a></li>
<li><a title="Locosys 20031 GPS" href="http://www.sparkfun.com/commerce/product_info.php?products_id=8975" target="_blank">Locosys 20031 3.3v 5hz GPS</a> (running at 2 only 2hz)</li>
<li><a title="5v to 3.3v Logic Level Converter" href="http://www.sparkfun.com/commerce/product_info.php?products_id=8745" target="_blank">5v to 3.3v Logic Level Converter</a></li>
<li><a title="Honywell HMC6352 i2c compass" href="http://www.sparkfun.com/commerce/product_info.php?products_id=7915" target="_blank">Honeywell HMC6352</a> i2c compass</li>
<li><a title="Atmel AVR Atmega8" href="http://www.sparkfun.com/commerce/product_info.php?products_id=210" target="_blank">Atmel AVR Atmega8</a></li>
<li><a title="Sharp GP2Y0A710YK0F IR Sensor" href="http://www.acroname.com/robotics/parts/R316-GP2Y0A710YK.html" target="_blank">Sharp GP2Y0A710YK0F</a> infrared distance sensor</li>
<li>Breadboard</li>
<li>Plywood and hardware</li>
</ul>
<p>I only added the Atmega8 because I used all the a2d pins of the Atmega32 to connect the LCD and then, at the last minute, added the ir distance sensors that needed a2d pins.  I also used the breadboard because I added the Atmega8 for the ir sensors so late.</p>
<div id="attachment_177" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0382c.jpg"><img class="size-full wp-image-177" title="Deathpod3000 Front View" src="http://deathpod3000.files.wordpress.com/2009/04/img_0382c.jpg?w=460&#038;h=613" alt="Deathpod3000 Front View" width="460" height="613" /></a><p class="wp-caption-text">Deathpod3000 Front View</p></div>
<p>I used the free <a title="Atmel AVR Studio" href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725" target="_blank">Atmel AVR Studio</a> IDE  with the open source gcc <a title="Winavr" href="http://winavr.sourceforge.net/" target="_blank">WinAVR</a> C compiler for development and an <a title="STK500" href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2735" target="_blank">STK500</a> for prototyping and AVR programming.  I used Pascal Stang&#8217;s free <a title="AVRLib" href="http://hubbard.engr.scu.edu/embedded/avr/avrlib/index.html" target="_blank">AVRLib</a> for much of the low-level interfacing such as uart, buffers, nmea parsing, i2c and a2d.  There&#8217;s a lot more in AVRlib than what I used as well.  It&#8217;s a fantastic library for getting a jumpstart on virtually any AVR project, though it does add some bloat so it isn&#8217;t well suited to the smaller AVRs.  I wrote the navigation, servo and UI software from scratch with help from internet research for timing, distance and bearing formulas, and inturrupt pin and i2c examples.</p>
<p>I learned a lot during this build.  The navigation stuff was pretty interesting.  Learning how to use AVRs as both i2c master and slave was really worthwhile.  The smaller AVRs are limited in terms of things like number of pins and peripherals, but they have all the processing horsepower of the bigger AVRs.  With an ATTINY or Atmega8 costing $2-4, a cheap and powerful approach to many projects would be to use 1 AVR as main processor to handle UI and higher level functions and 1 or more AVRs as i2c or spi slaves to read sensors, parse gps data, drive servos, etc.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/168/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=168&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/19/deathpod3000-specs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0381.jpg" medium="image">
			<media:title type="html">Deathpod3000 Top View</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0382c.jpg" medium="image">
			<media:title type="html">Deathpod3000 Front View</media:title>
		</media:content>
	</item>
		<item>
		<title>Race Day</title>
		<link>http://deathpod3000.wordpress.com/2009/04/16/race-day/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/16/race-day/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:39:45 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=140</guid>
		<description><![CDATA[Race day finally arrived.  To be honest, I had been spending so much time on the car, I was happy that spending every spare minute on the build was finally over.  The ir sensors that we added in the last post were working well for avoiding obstacles and curbs so it looked like we had [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=140&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Race day finally arrived.  To be honest, I had been spending so much time on the car, I was happy that spending every spare minute on the build was finally over.  The ir sensors that we added in the last post were working well for avoiding obstacles and curbs so it looked like we had a really good shot to at least complete the course.  It was a really fun day.  Click &#8220;More&#8230;&#8221; for lots of pics of the vehicles and some video of our runs.</p>
<div id="attachment_141" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0383.jpg"><img class="size-full wp-image-141" title="Deathpod3000 at the finish line" src="http://deathpod3000.files.wordpress.com/2009/04/img_0383.jpg?w=460&#038;h=613" alt="Deathpod3000 at the finish line" width="460" height="613" /></a><p class="wp-caption-text">Deathpod3000 at the finish line</p></div>
<p><span id="more-140"></span>There were 20 teams &#8211; 17 rovers and 3 planes.  The rovers were going first and the planes last.  Each team got 3 tries with the fastest time winning.  There was a pit area inside for prepping the vehicles.  Here is a pic of us getting ready in the pits.</p>
<div id="attachment_142" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1543.jpg"><img class="size-full wp-image-142" title="In the pits" src="http://deathpod3000.files.wordpress.com/2009/04/img_1543.jpg?w=460" alt="In the pits"   /></a><p class="wp-caption-text">In the pits</p></div>
<p>Unfortunately, we didn&#8217;t get video of the first run, but here is a video of our practice run.  The real run was very similar.</p>
<span style="text-align:center; display: block;"><a href="http://deathpod3000.wordpress.com/2009/04/16/race-day/"><img src="http://img.youtube.com/vi/He7MOS41_TI/2.jpg" alt="" /></a></span>
<p>I decided to try to just make it around the first try.  I set the program to go 30% throttle all the way.  30% is somewhere between a walk and a jog.  There was immediate drama in trial 1.  It headed too far to the right because of gps error and it started following the curb in the wrong direction.  There were gasps from the crowd.  But, after about 3 or 4 feet, it turned around and headed down the course.  The crowd cheered!  It had to steer to follow along the curb by the pond, again because of gps error, but it  made all the way around and crossed the finish line without any other problems.  Our time was just over 2 minutes.</p>
<p>Here are a few pics of some of the other vehicles.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1582.jpg"><img class="aligncenter size-full wp-image-143" title="img_1582" src="http://deathpod3000.files.wordpress.com/2009/04/img_1582.jpg?w=460" alt="img_1582"   /></a><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1575.jpg"><img class="aligncenter size-full wp-image-144" title="img_1575" src="http://deathpod3000.files.wordpress.com/2009/04/img_1575.jpg?w=460" alt="img_1575"   /></a><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1580.jpg"><img class="aligncenter size-full wp-image-145" title="img_1580" src="http://deathpod3000.files.wordpress.com/2009/04/img_1580.jpg?w=460&#038;h=689" alt="img_1580" width="460" height="689" /></a><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1579.jpg"><img class="aligncenter size-full wp-image-146" title="img_1579" src="http://deathpod3000.files.wordpress.com/2009/04/img_1579.jpg?w=460" alt="img_1579"   /></a></p>
<p>Most of round 1 ended up like this:</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1584.jpg"><img class="aligncenter size-full wp-image-147" title="img_1584" src="http://deathpod3000.files.wordpress.com/2009/04/img_1584.jpg?w=460" alt="img_1584"   /></a></p>
<p>The big &#8220;tank&#8221; decided to go off-roading:</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1577.jpg"><img class="aligncenter size-full wp-image-148" title="img_1577" src="http://deathpod3000.files.wordpress.com/2009/04/img_1577.jpg?w=460" alt="img_1577"   /></a></p>
<p>One of the planes ended up in a tree and the fire department had to come get the plane down.</p>
<div id="attachment_152" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1619.jpg"><img class="size-full wp-image-152" title="Plane stuck in a tree" src="http://deathpod3000.files.wordpress.com/2009/04/img_1619.jpg?w=460&#038;h=689" alt="Plane stuck in a tree" width="460" height="689" /></a><p class="wp-caption-text">Plane stuck in a tree</p></div>
<p>Through round 1 we were the only vehicle to successfully make it around the course.  Round 2 started and it was going pretty much like round 1.  I decided to crank up the speed to 50% throttle, which is basically like a medium run.  It cuts the speed down as it approaches a waypoint or if it detect an obstacle.</p>
<p>Here we are at the start line for trial 2:</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1563.jpg"><img class="aligncenter size-full wp-image-149" title="img_1563" src="http://deathpod3000.files.wordpress.com/2009/04/img_1563.jpg?w=460&#038;h=689" alt="img_1563" width="460" height="689" /></a></p>
<p>We shot video of the second run, but because we had to run to keep up, it is really shaky.  Here is video of the beginning.  You can see the start, the first turn and you can see it avoiding the curb.</p>
<span style="text-align:center; display: block;"><a href="http://deathpod3000.wordpress.com/2009/04/16/race-day/"><img src="http://img.youtube.com/vi/o23akF7p-dA/2.jpg" alt="" /></a></span>
<p>The drama in run 2 came at the pond.  The car headed straight at the pond at full speed.  Because it was going faster, it came within 3 inches of smashing into the curb before it detected the curb, cut the wheels hard left, did a 180 spin and stopped.  Then it started up again headed down the course.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1548.jpg"><img class="aligncenter size-full wp-image-150" title="img_1548" src="http://deathpod3000.files.wordpress.com/2009/04/img_1548.jpg?w=460" alt="img_1548"   /></a></p>
<p>It  completed the course and shaved 30 seconds off our first run at 1 minute 28 seconds.</p>
<div id="attachment_151" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1566.jpg"><img class="size-full wp-image-151" title="Deathpod3000 crossing the finish line" src="http://deathpod3000.files.wordpress.com/2009/04/img_1566.jpg?w=460" alt="Deathpod3000 crossing the finish line"   /></a><p class="wp-caption-text">Deathpod3000 crossing the finish line</p></div>
<p>The editor in chief of <a title="Make Magazine" href="http://makezine.com/" target="_blank">Make magazine</a> came out for the event and he interviewed us after round 2.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1612.jpg"><img class="aligncenter size-full wp-image-153" title="Interviewed by Make magazine" src="http://deathpod3000.files.wordpress.com/2009/04/img_1612.jpg?w=460" alt="Interviewed by Make magazine"   /></a></p>
<p>Through round 2 we were still the only vehicle to complete the course.  In round 3 we upped the speed to 70% throttle and unfortunately that was too fast.  It couldn&#8217;t turn in time after detecting the curb and we smashed head-first.</p>
<p>The final run of the final vehicle &#8211; an airplane &#8211; was the only other successful run.  They had a time of 39 seconds, much faster than our 1:28 and they took first place.  Here is a pic of the winning team.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1636.jpg"><img class="aligncenter size-full wp-image-154" title="img_1636" src="http://deathpod3000.files.wordpress.com/2009/04/img_1636.jpg?w=460" alt="img_1636"   /></a></p>
<p>We got 2nd place and also won the Engineer&#8217;s Choice award, voted on by Sparkfun&#8217;s engineers.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_1634.jpg"><img class="aligncenter size-full wp-image-155" title="img_1634" src="http://deathpod3000.files.wordpress.com/2009/04/img_1634.jpg?w=460&#038;h=689" alt="img_1634" width="460" height="689" /></a></p>
<p>The whole day was a blast.  Thanks to <a title="Sparkfun" href="http://www.sparkfun.com" target="_blank">Sparkfun</a> for sponsoring such a fun competition.  They are planning to make this an annual event so get planning for next year.  I&#8217;m sure they&#8217;ll make some changes to make it even better.  (Hopefully put air and ground vehicles in separate divisions&#8230;)</p>
<p>If you&#8217;ve enjoyed reading the blog, please leave a comment.  Right now I need a few days to recover!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=140&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/16/race-day/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0383.jpg" medium="image">
			<media:title type="html">Deathpod3000 at the finish line</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1543.jpg" medium="image">
			<media:title type="html">In the pits</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1582.jpg" medium="image">
			<media:title type="html">img_1582</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1575.jpg" medium="image">
			<media:title type="html">img_1575</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1580.jpg" medium="image">
			<media:title type="html">img_1580</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1579.jpg" medium="image">
			<media:title type="html">img_1579</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1584.jpg" medium="image">
			<media:title type="html">img_1584</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1577.jpg" medium="image">
			<media:title type="html">img_1577</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1619.jpg" medium="image">
			<media:title type="html">Plane stuck in a tree</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1563.jpg" medium="image">
			<media:title type="html">img_1563</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1548.jpg" medium="image">
			<media:title type="html">img_1548</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1566.jpg" medium="image">
			<media:title type="html">Deathpod3000 crossing the finish line</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1612.jpg" medium="image">
			<media:title type="html">Interviewed by Make magazine</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1636.jpg" medium="image">
			<media:title type="html">img_1636</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_1634.jpg" medium="image">
			<media:title type="html">img_1634</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding Infrared Distance Sensors to an AVR Atmega32</title>
		<link>http://deathpod3000.wordpress.com/2009/04/16/adding-infrared-distance-sensors-to-an-avr-atmega32/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/16/adding-infrared-distance-sensors-to-an-avr-atmega32/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 16:22:09 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=134</guid>
		<description><![CDATA[After the test run on the actual race course, it was clear that GPS was not going to be accurate enough to keep the car out of the pond.  I tried sonar, which is great for general obstacle avoidance because it will detect basically anything in a 45 degree cone, but it didn&#8217;t work well [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=134&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After the test run on the actual race course, it was clear that GPS was not going to be accurate enough to keep the car out of the pond.  I tried sonar, which is great for general obstacle avoidance because it will detect basically anything in a 45 degree cone, but it didn&#8217;t work well for this specific case.  Infrared distance sensors turned out to be perfect, but I had one other problem to overcome.</p>
<p><span id="more-134"></span>I connected <a title="Sonar" href="http://www.acroname.com/robotics/parts/R145-SRF08.html" target="_self">this sonar</a> to the i2c bus I was already using for the compass.  One of the cool things about i2c is you can connect many devices to just 2 wires on the microcontroller and communicate with each device based on its address.  I was getting distance readings in inches and it was perfect down to 1&#8243; distance.  Max range was about 4 feet.</p>
<p>Unfortunately, the 45 degree cone of the sonar is both left and right and up and down.  When I put the sonar on the car, it was detecting the ground.  I tried tilting it up and I even tried building a shield to block the sonar reflections from the ground.</p>
<div id="attachment_135" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_03711.jpg"><img class="size-full wp-image-135" title="Sonar Shield" src="http://deathpod3000.files.wordpress.com/2009/04/img_03711.jpg?w=460" alt="Sonar Shield"   /></a><p class="wp-caption-text">Sonar Shield</p></div>
<p>The shield extended the range of the sonar, but it still had trouble detecting the curb and the car couldn&#8217;t turn fast enough to avoid objects.  The range was only 18-24&#8243; being so low to the ground and by the time the car turned the wheels, it had already hit the object.  I decided sonar wasn&#8217;t going to work.</p>
<p>The other option for object detection (other than a $3,000 laser, which I felt violated the spirit of the competition) is infrared.  I&#8217;ve used ir detectors in the past, and they are very accurate, but usually don&#8217;t have the range of sonar and they detect objects in a straight, pencil beam line.  The main obstacle to avoid in the race is the curb, which is a linear obstacle extending out basically to infinity so the almost laser-like detection probably won&#8217;t be a problem for the race.  I found some newer, long-range ir sensors I hadn&#8217;t seen before.  The<a title="Sharp IR Sensor" href="http://www.acroname.com/robotics/parts/R316-GP2Y0A710YK.html" target="_self"> Sharp GP2Y0A710YK0F</a> ir sensor claims to detect objects from 40&#8243; to 200&#8243;.</p>
<p>I bought a couple and did some testing.  I was getting maybe 4-5 feet of real-world range and putting it right next to the ground was no problem since the ir light beam is so narrow.  Now for the problem.  I needed a full 8 bit port for the LCD and the only port I wasn&#8217;t using at least one pin in was port A, the port that has all the analog-to-digital conversion pins.  The ir sensor outputs an analog voltage, higher voltage means close object.  So, my choices were to try to totally rewire the LCD (14 wires &#8211; ugh) or figure out another way to connect the sensors.</p>
<p>I had a spare Atmega8 laying around and I knew AVRs could be i2c slaves as well as master so I decided to try to program the Atmega8 to read the sensors and report back the analog voltage values to the main chip through i2c.  I initially had some problems, but was eventually able to get it working using AVRLib.  Here is the code in the Atmega8 to read the Sharp ir distance sensors:</p>
<blockquote><p><span> </span>DDRC = 0&#215;00; //Set a2d port as input<br />
PORTC &amp;= 0&#215;00;  //turn off pull-up resistors<br />
a2dInit();  //Initialize AVRLib A2d<br />
a2dSetPrescaler(ADC_PRESCALE_DIV128); //most precise<br />
a2dSetReference(ADC_REFERENCE_AVCC); //Use 5v ref<br />
ir[0] = a2dConvert10bit(0);  //Read a2d pin 0</p></blockquote>
<p>That&#8217;s it.  I actually have 2 sensors so I read both values.  Now I had to make the Atmega8 return the readings from the 2 sensors whenever the master asked for them.</p>
<p>First in the main function, you have to set things up.</p>
<blockquote><p>i2cInit(); // Initialize i2c AVRlib<br />
//Set slave address to 2<br />
i2cSetLocalDeviceAddr(2, TRUE);<br />
//Set slave receive function to our function<br />
//We don&#8217;t actually use this<br />
i2cSetSlaveReceiveHandler( i2cSlaveReceiveService );<br />
//This function will be called when a master requests data<br />
i2cSetSlaveTransmitHandler( i2cSlaveTransmitService );</p></blockquote>
<p>When the master sends a &#8220;get data&#8221; request to device 2, our i2cSlaveTransmitService function will be called and that will send data back to the master.  Here is the code in the transmit function.</p>
<blockquote><p>u08 i2cSlaveTransmitService(u08 transmitDataLengthMax, u08* transmitData)<br />
{<br />
transmitData[0] = ir[0] &gt;&gt; 8;<br />
outBuffer[0] = transmitData[0];<br />
transmitData[1] = ir[0] &amp; 0x00FF;<br />
outBuffer[1] = transmitData[1];<br />
transmitData[2] = ir[1] &gt;&gt; 8;<br />
outBuffer[2] = transmitData[2];<br />
transmitData[3] = ir[1] &amp; 0x00FF;<br />
outBuffer[3] = transmitData[3];<br />
sent = 1;<br />
return 4;<br />
}</p></blockquote>
<p>I decided to go most significant byte first, so it strips that out of the int and puts it into the transmit buffer, then puts the least signifigant byte in the transmit buffer.  It repeats the operation for the 2nd sensor reading and then return that there are 4 bytes to send to the master.</p>
<p>On the master side, the code is very similar to the compass reading code.</p>
<blockquote><p>void GetIR()<br />
{<br />
u08 in[4];<br />
i2cMasterReceive(2, 4, &amp;in[0]);<br />
ir1 = in[0];<br />
ir1 = ir1 &lt;&lt; 8;<br />
ir1 += in[1];<br />
ir2 = in[2];<br />
ir2 = ir2 &lt;&lt; 8;<br />
ir2 += in[3];<br />
}</p></blockquote>
<p>It reads from device 2 and basically does the reverse of what is in the slave to re-build the int from the MSB and LSB.  So, now I can read the ir sensors in the main program by calling this function.</p>
<p>Unfortunately, the front of the rc car where I can mount sensors is angled so I had to build a platform for the sensors.  I used a hinge and some screws to make it adjustable so I could dial in just the right angle to detect the low curbs, but not the ground.  It isn&#8217;t pretty, but it works.</p>
<div id="attachment_137" class="wp-caption aligncenter" style="width: 470px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0382.jpg"><img class="size-full wp-image-137" title="Deathpod with ir sensors" src="http://deathpod3000.files.wordpress.com/2009/04/img_0382.jpg?w=460&#038;h=613" alt="Deathpod with ir sensors" width="460" height="613" /></a><p class="wp-caption-text">Deathpod with ir sensors</p></div>
<p>One other thing I found when I was testing at the track is if the waypoint &#8220;moves&#8221; because of GPS error to someplace the car can&#8217;t reach (like, say, into the pond) even if you avoid the curb, the car won&#8217;t complete the course because it will never move to the next waypoint.  I came up with a couple of strategies to overcome this and implemented the simplest one.  If it determines it is on a line between the current waypoint and the next waypoint, it will drop the current waypoint and move on to the next one.  It should move along the curb with the ir sensor trying to get to the current waypoint and then at some point decide it can just abandon it and continue on.</p>
<p>That&#8217;s going to have to be it.  I wasn&#8217;t sure I could get the ir sensors on and working in time, but I made it.  We did some testing in the street outside the house and it looks promising.  Race day is here so we&#8217;ll just have to take what we have and hope for the best.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=134&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/16/adding-infrared-distance-sensors-to-an-avr-atmega32/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_03711.jpg" medium="image">
			<media:title type="html">Sonar Shield</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0382.jpg" medium="image">
			<media:title type="html">Deathpod with ir sensors</media:title>
		</media:content>
	</item>
		<item>
		<title>How to read rc servo pulses with an AVR Atmega32 and final board construction</title>
		<link>http://deathpod3000.wordpress.com/2009/04/13/how-to-read-rc-servo-pulses-with-an-avr-atmega32-and-final-board-construction/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/13/how-to-read-rc-servo-pulses-with-an-avr-atmega32-and-final-board-construction/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 19:07:51 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=124</guid>
		<description><![CDATA[In the last post we took a run around the race course and found out we will need obstacle avoidance.  I forgot one step &#8211; putting the final board together.  In this installment I will show how I read rc server pulses from the receiver allowing me to use the rc transmitter as a failsafe [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=124&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a title="Test Run" href="http://deathpod3000.wordpress.com/2009/04/13/test-run-at-the-track/" target="_self">last post</a> we took a run around the race course and found out we will need obstacle avoidance.  I forgot one step &#8211; putting the final board together.  In this installment I will show how I read rc server pulses from the receiver allowing me to use the rc transmitter as a failsafe kill switch and also show putting the final control board together.</p>
<p><span id="more-124"></span>First up, some pics of the final board construction.</p>
<div id="attachment_126" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_034511.jpg"><img class="size-full wp-image-126" title="Board1" src="http://deathpod3000.files.wordpress.com/2009/04/img_034511.jpg?w=460" alt="Board1"   /></a><p class="wp-caption-text">Board1</p></div>
<p>I&#8217;m using a board from Sparkfun that includes powersupply, db9 serial port and rs232 conversion, in circuit programming port, 8 mhz crystal and plenty of room to solder our connections.  I decided to connect everything with ribbon cables so I can re-use things on other projects if I need to.  Since I originally thought I wouldn&#8217;t be using anything requiring analog to digital conversion, I needed an entire 8 pin port for the LCD and I needed pins from the other ports for things like i2c, serial and input pin interrup, I used port A, which is also the a2d pins.  This turned out to be a headache later on.</p>
<p>The pic above shows the board after I soldered wires to connect the LCD.  I tested this first because it can help with debugging other problems.  Next I soldered connections for serial and power to go to the gps, i2c and the servos.  I included one more 3 pin servo connection wired to one of the interrupt pins, which I&#8217;ll talk about later.  I also used this connection to provide power for the servos, which comes from the rc battery, separate from the board power.</p>
<div id="attachment_127" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_03461.jpg"><img class="size-full wp-image-127" title="Board2" src="http://deathpod3000.files.wordpress.com/2009/04/img_03461.jpg?w=460" alt="Board2"   /></a><p class="wp-caption-text">Board2</p></div>
<p>After soldering and testing all the connections I bought some thin, but stiff plywood and bolts/screws to use to attach everything to the car.  I cut out a rectangle of plywood big enough to hold the boards and parts, but small enough to allow removing the rc car battery.  There is a plastic cover on the steering servo in the front of the car and I decided to use this for mounting.  I drilled holes through the plasic cover and then used small bolts to attach the plywood to the cover.</p>
<div id="attachment_128" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_03561.jpg"><img class="size-full wp-image-128" title="Construction" src="http://deathpod3000.files.wordpress.com/2009/04/img_03561.jpg?w=460" alt="Construction"   /></a><p class="wp-caption-text">Construction</p></div>
<p>Then I used screws to attach the boards to the plywood.  The compass was a little tricky since it didn&#8217;t have any mounting holes and it needs to be in a consistent orientation.  I decided to superglue the compass to the plywood away from the main board and midway between the motor controller and the steering servo to try to minimize magnetic interference.</p>
<p>With the very real possibility of ending up in a pond, I decided I needed a way to kill the throttle if the car headed for water.  I thought I could use the rc receiver to read the pulses from the transmitter and only run if the car detected pulses.  I connected once channel of the rc receiver to one of the INT pins on the Atmega32.  The receiver channels are wired just like servos and provide the exact same pulse timing that you would send to a servo.  The 3 wires are ground, power and signal.  I connected the signal wire to the INT1 pin on the Atmega32 and set it up to trigger an interrupt on any change (high to low or low to high) on the pin.  Here is the code to do this:</p>
<blockquote><p><span> </span>//Set up external interrupt for reading receiver<br />
cbi(EXTINTDIR, EXTINT);<br />
sbi(PORTD, PD3);<br />
MCUCR = 1&lt;&lt;ISC10;<br />
GIMSK = 1&lt;&lt;INT1;</p></blockquote>
<p>I previously defined EXTINTDIR as DDRD and  EXINT as PD3.  The first two lines set up the pin as input and enable the internal pull-up resistor.  The next line sets INT1 as trigger interrupt on any change.  There are a number of different conditions you can have trigger the interrupt including low to high, high to low, low and any change.  See the Atmega32 datasheet for which bits to set in MCUCR for each type.   The last line sets the bit in the global interrupt mask for INT1, which enables the interrupt pin.</p>
<p>The code to service the interrupt is very simple since all I need is a counter that increments once every time there is a change on the pin indicating a servo pulse on or off.  I set up a global int variable called cntValue and start it at 0.  I decided to set it back to 0 after 20,000 interrupts.  We only care about change in the value, not the specific value itself so overflows don&#8217;t matter.</p>
<blockquote><p>//External Interrupt Handler<br />
ISR(INT1_vect)  /* signal handler for external interrupt int0 */<br />
{<br />
//We just increment this variable whenever there is a state<br />
change<br />
//We store the previous value each cycle of our main navigation<br />
loop<br />
//Then check current value against the previous value to see if<br />
//We have rc transmitter signal.  If not, safety kill.</p>
<p><span> </span>cntValue++;<br />
if(cntValue &gt; 20000)<br />
{<br />
cntValue = 0;<br />
}<br />
}</p></blockquote>
<p>In the main navigation loop, we compare the current value to the value stored during the last time through the loop and if it is the same we kill the throttle.  Basically, when the transmitter is on, no matter what state the controls are in, the car goes, when the transmitter is off or if it goes beyond signal range, the car stops.</p>
<p>OK, so now the main board is wired up and attached to the car and the kill switch will hopefully keep us out of the pond should things go really bad.  Now, we need some way to avoid obstacles.  The next post will be about using sonar to do that.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=124&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/13/how-to-read-rc-servo-pulses-with-an-avr-atmega32-and-final-board-construction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_034511.jpg" medium="image">
			<media:title type="html">Board1</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_03461.jpg" medium="image">
			<media:title type="html">Board2</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_03561.jpg" medium="image">
			<media:title type="html">Construction</media:title>
		</media:content>
	</item>
		<item>
		<title>Test run at the track</title>
		<link>http://deathpod3000.wordpress.com/2009/04/13/test-run-at-the-track/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/13/test-run-at-the-track/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 15:48:51 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=117</guid>
		<description><![CDATA[After installing a new gps and compass in previous posts, we took the Deathpod to a parking lot for a test run around a simulated track.  The results were not bad.  The car went around the track at 30% throttle and 50% throttle.  At 50%, it tended to spin out and fishtail in the corners [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=117&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After installing a new <a title="gps" href="http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/" target="_self">gps</a> and <a title="compass" href="http://deathpod3000.wordpress.com/2009/04/06/adding-an-i2c-compass-to-the-avr-atmega32/" target="_self">compass</a> in previous posts, we took the Deathpod to a parking lot for a test run around a simulated track.  The results were not bad.  The car went around the track at 30% throttle and 50% throttle.  At 50%, it tended to spin out and fishtail in the corners so I added some logic to slow down as it approaches a waypoint.  As testing went on, the gps error started causing problems.  The car starting hitting some cones, which represented the building.  But, there were some laps where it missed hitting any cones so I thought things were looking good.  I decided to head up to Boulder for a lap around the real course.</p>
<div id="attachment_118" class="wp-caption aligncenter" style="width: 469px"><a href="http://deathpod3000.files.wordpress.com/2009/04/img_03611.jpg"><img class="size-full wp-image-118" title="Sparkfun" src="http://deathpod3000.files.wordpress.com/2009/04/img_03611.jpg?w=460" alt="Sparkfun"   /></a><p class="wp-caption-text">Sparkfun</p></div>
<p><span id="more-117"></span>We walked the car around the building and set waypoints at the corners.  After starting the car, it tried to cut the first corner too short and headed for the curb.  We moved the car over and after heading around the turn, it went straight down the side.  It had a couple more curb incidents  and it wouldn&#8217;t have made a complete lap on its own.</p>
<p>We decided to try more waypoints and it only made the problem worse.  There is a pond on one side of the course and Deathpod apparently was feeling a little warm because it really wanted to go for a swim.  After a number of attempts, it didn&#8217;t make it all the way around the building without incident once.  The major problem was gps error and some relatively tight straightaways.</p>
<p>I don&#8217;t think I mentioned that I connected the r/c receiver to a pin on the atmega32 so I can read the rc pulses as a failsafe.  It doesn&#8217;t actually do anything with the rc pulses other than count them.  If the count keeps going up, it keeps driving.  If the rc pulses stop, the car cuts throttle.  This way, when Deathpod decides to go for a swim, I can stop the car before he gets to the water by simply turning off the rc transmitter.</p>
<p>My original plan was to navigate using only gps and compass, but it became clear that the car will need abstacle avoidance.  If there are cars in the parking lot, Deathpod will need to go around them.  More importantly, it will need to stay within the curbs to keep it from going into the pond!  I have both sonar and infrared distance sensors.  I think sonar will be better for general obstacle avoidance, but I don&#8217;t know if it will work for curbs.  In the <a title="Board Construction and RC Servo Pulses" href="http://deathpod3000.wordpress.com/2009/04/13/how-to-read-rc-servo-pulses-with-an-avr-atmega32-and-final-board-construction/" target="_self">next post</a> I will describe how I read the rc servo pulses from the receiver and then I will talk about connecting and testing the sonars and infrared sensors.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=117&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/13/test-run-at-the-track/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_03611.jpg" medium="image">
			<media:title type="html">Sparkfun</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding an I2C Compass to the AVR Atmega32</title>
		<link>http://deathpod3000.wordpress.com/2009/04/06/adding-an-i2c-compass-to-the-avr-atmega32/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/06/adding-an-i2c-compass-to-the-avr-atmega32/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 21:21:10 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=108</guid>
		<description><![CDATA[The new 5hz gps module I added in the last post is working.  Now, to tackle the biggest problem discovered during Deathpod3000&#8242;s maiden voyage, we need a way to get very fast heading updates during turns.  While the faster refresh rate of the new gps will help, it is never going to give us accurate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=108&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The new 5hz gps module I added in the <a title="Adding 3.3v gps to 5v Atmega32" href="http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/" target="_self">last post</a> is working.  Now, to tackle the biggest problem discovered during Deathpod3000&#8242;s maiden voyage, we need a way to get very fast heading updates during turns.  While the faster refresh rate of the new gps will help, it is never going to give us accurate heading data in a turn.  In order to do that we need a compass.  In this post, I&#8217;ll describe how I added a digital i2c compass to Deathpod.</p>
<p><span id="more-108"></span>Even with 5hz updates, the gps isn&#8217;t going to be able to give us accurate heading data during a turn.  The reason is a gps figures out heading based on a line drawn from where you were during the last update to where you are this update.  In a turn, as the car goes around in a circle, the nose is always pointing beyond this line so the gps heading will always lag behind the true direction the car is pointing.</p>
<p>The way to get an accurate heading reading in a turn is with a compass.  Our UART (regular serial port) is already being used by the gps, so we need a compass with some other interface.  The Atmega32 has both spi and i2c synchronous serial.  Sparkfun carries a digital compass chip with an i2c interface mounted on a small board with spots to solder pins at standard .1&#8243; spacing.  The <a title="Honeywell HMC6352" href="http://www.sparkfun.com/commerce/product_info.php?products_id=7915" target="_self">Honywell HMC6352 mounted on a breakout board</a> requires only 4 connections:  5v, GND, clock (SCL) and data (SDA).</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/07915-07-l.jpg"><img class="aligncenter size-full wp-image-110" title="Honeywell HMC6352 I2C Compass" src="http://deathpod3000.files.wordpress.com/2009/04/07915-07-l.jpg?w=460&#038;h=460" alt="Honeywell HMC6352 I2C Compass" width="460" height="460" /></a></p>
<p>I2c is a 2 wire synchronous serial interface.  It is actually a bus since it can accomodate multiple slave devices and a master device on only 2 wires.  I2c was originally developed by Philips and to get around  licensing costs, other manufacturers have released their own implementations.  Smbus is compatible with i2c and is used on many motherboards to communicate with temperature sensors.  Atmel calls it TWI (Two Wire Interface).</p>
<p>The two wires  that make up the i2c bus are clock and data.  The master drives the clock and both master and slave transmit using the data line.  In this case, the Atmega32 will be the master and the compass chip will be the slave.  Because it is a synchronous interface, much higher transfer speeds are possible than with an async serial interface like rs232.  The &#8220;slow&#8221; speed is 100 Kbps and you can go up to 1 Mbps with some devices.  Because of the fast speed, small number of connections required and ability to connect multiple devices on the same bus, i2c is a very popular communication mechanism for microcontrollers.  You can find devices that use i2c ranging from eeprom chips to sonars to motor controllers and compasses.</p>
<p>I soldered standard straight pins onto the compass breakout board thinking I&#8217;d use one of the 10 pin header ribbon cables I had to connect to similar pins on the final board.  This will allow me to connect and disconnect the compass easily if I want to use it on another project in the future.  On the Atmega32, pin PC0 is SCL and PC1 is SDA.  I used breadboard wires to connect the 10 pin header to the correct pins on the STK500 dev board.</p>
<p>I2c handles multiple devices on a single 2 wire interface by assigning each device a unique 7 bit address.  The compass by default uses address hex 42.  The master device doesn&#8217;t need an address.</p>
<p>AVRlib includes a module to handle i2c communication both as a master and slave.  We&#8217;ll use this module to communicate with the compass.  The library makes this pretty easy and we will only need to call one fuction to write to the device and 1 function to read from the device.  All the low-level stuff is taken care of by the library and the AVR hardware.  By default, the compass is in &#8220;query&#8221; mode.  It will take and return a reading on command.  This sounds fine for what we want to do.</p>
<p>To take a reading you must first send hex 41, then read 2 bytes (MSB, LSB) of heading.  The heading has an implied 1 decimal point so a reading of 2436 would be a heading of 243.6 degrees.  It takes 6 ms for the compass to compute the heading so we&#8217;ll put in a little delay of 10ms to let it do it&#8217;s magic.  First, in order to make changes easier, we&#8217;ll put in a define for the target address of our i2c commands.</p>
<blockquote><p>//define for compass iic addresses<br />
#define TARGET_ADDR<span> </span>0&#215;42</p></blockquote>
<p>I put the code to read a compass heading in a function so it will be clean and easy to read the heading in our main processing loop.  In order to account for errors in compass placement (where the compass isn&#8217;t pointing directly forward on the car), I included an offset passed to the function that we can use later if we need to correct for some heading error.  Here is the code in my compass reading function.</p>
<blockquote><p>float GetCompassHeading(float offset)<br />
{<br />
u08 c=0;<br />
u08 in[2];<br />
int reading = 0;<br />
float returnHeading = 0.0;<br />
c = 0&#215;41;<br />
i2cMasterSend(TARGET_ADDR, 1, &amp;c);<br />
timerPause(10);<br />
i2cMasterReceive(TARGET_ADDR, 2, &amp;in[0]);<br />
reading = in[0];<br />
reading = reading &lt;&lt; 8;<br />
reading += in[1];<br />
returnHeading = (float) reading;<br />
returnHeading = returnHeading / 10;<br />
returnHeading += offset;<br />
if(returnHeading &lt; 0)<br />
{<br />
returnHeading += 360;<br />
}<br />
<span> </span>if(returnHeading &gt;= 360)<br />
{<br />
returnHeading -= 360;<br />
}</p>
<p>return returnHeading;<br />
}</p></blockquote>
<p>No indenting for some reason.  Still readable I guess.  Anyway, set up unsigned char variable c to hold the &#8220;command&#8221; to send and 2 byte array in for the returned data.  We&#8217;ll convert the reading to an in int called reading and use a float to hold the final reaturn heading.  We set the command to 0&#215;41 (hex 41 or the character &#8216;A&#8217;) and then call i2cMasterSend, the AVRlib command to transmit.  The three parameters are i2c address, bytes to send and a pointer to the data.  Next we wait 10ms and then read the result.  i2cMasterReceive takes the same 3 parameters as send.  We read the first byte (MSB), then shift it 8 bits to the left and then add the next byte we received to construct the 16 bit int.  Next we convert it to a float and load it into our returnHeading, then divide by 10 to get our xxx.x heading.</p>
<p>Now we will deal with the offset passed into the function.  First we simplyadd it to the heading.  At this point, if the offset is negative  and the heading is close to 0, we could end up with negative heading.  For example, let&#8217;s say the heading is 006.0 and offset is -9.  The returned heading would be -003.0, which doesn&#8217;t make any sense.  To account for this, if the heading ends up less than 0, we add 360.  So in our example, -003.0 + 360 = 357.0.  In the same way, with a positive offset and a heading near 360, we could end up with a heading that greater than 360.  We take care of this situation by subtracting 360 if the heading is greater than or equal to 360.  Now we will always return a heading between 0 and 359.9 degrees.</p>
<p>I changed the main navigation loop to read the compass, use the compass heading for steering rather than the gps heading and display the compass heading on the LCD.  Turning on the system gave me&#8230;nothing.  I was getting 0 no matter which way I turned the compass.  I searched the web, I double-check the code, I tried non-interrupt driven i2c calls.  Then I checked the wiring.  It turns out I had the SDA line connected to the wrong spot on the header.  I moved the wire over one spot and bingo &#8211; rapidly changing heading readings.</p>
<p>The compass chip has a calibration mode where you spin the chip around for several seconds and it calibrates to it&#8217;s environment in case there is metal around, etc.  I added an option when the system starts up to allow the user to do the calibration and then point to the first waypoint stored in eeprom.  The car calculates an offset based on this and stores the offset to feed to the compass heading reading function.</p>
<p>Testing the new setup with the faster gps and digital compass proved successful.  The car no longer drove around in circles, but once it figured out bearing to the waypoint, it drove straight toward it.  The waypoint tended to move around because of gps error, but the car was able to track directly to where it thought the waypoint was.</p>
<p>Navigation is working.  The next step is to ditch the STK500 dev board and wire up the final, much smaller and lighter board and start attaching things more permanently to the car.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=108&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/06/adding-an-i2c-compass-to-the-avr-atmega32/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/07915-07-l.jpg" medium="image">
			<media:title type="html">Honeywell HMC6352 I2C Compass</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding a 3.3v GPS to a 5v AVR Atmega32</title>
		<link>http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 16:41:49 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=96</guid>
		<description><![CDATA[So the maiden voyage of Deathpod3000 was a disaster.  The problems seemed to be twofold.  One, gps updates were too slow and two and probably most importantly, heading info coming from the gps was way too slow to be useful in turns.  The net result was that it mostly drove around in circles.  I decided [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=96&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So the <a title="Maiden Voyage" href="http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/" target="_self">maiden voyage</a> of Deathpod3000 was a disaster.  The problems seemed to be twofold.  One, gps updates were too slow and two and probably most importantly, heading info coming from the gps was way too slow to be useful in turns.  The net result was that it mostly drove around in circles.  I decided to add a gps with a faster refresh rate and a digital compass.  In this installment, I&#8217;ll add the gps.  The main issue I had to deal with is the gps is 3.3v and the rest of the electronics are 5v&#8230;</p>
<p><span id="more-96"></span>After looking at available options, I settled on the <a title="Locosys LS20031" href="http://www.sparkfun.com/commerce/product_info.php?products_id=8975" target="_blank">Locosys LS20031</a> 5hz gps receiver.  It is a self-contained unit, complete with antenna.  It outputs nmea and I already have an nmea parser library.  The only connections required are power, ground and serial tx/rx.  After doing some research, the only problem to overcome was the 3.3v to 5v conversion required.</p>
<p>Sparkfun sells a <a title="3.3v to 5v logic level converter board" href="http://www.sparkfun.com/commerce/product_info.php?products_id=8745" target="_blank">3.3v to 5v logic level converter board</a>.  This little (and I mean little) board will convert tx/rx for 2 serial connections.  One side of the board takes 5v and the other takes 3.3v connections for power.  Tx/rx on the high side operates at 5v and the low side operates at 3.3v.  It worked like a charm.</p>
<p>The gps has no connectors, just pads to solder to so I soldered wires to the pads.  I decided to connect everything using a breadboard to make sure communication was working before doing the final wiring.  I used a 3.3v voltage regulator to supply the 3.3v, connected tx/rx on the low side to the gps and the high side to the tx/rx pins on the Atmega32.  Note that because the gps uses ttl serial I did not have to use an rs232 converter like I did with the Garmin unit.  That is why I am connecting directly to the pins on the microcontroller.</p>
<p>Here is a pic of the breadboard setup.  You can see the gps chip (large looking white/cream/green square &#8211; it is actually only about an inch square) to the right.  To the left you can barely see the logic level converter board buried in wires and just above and to the left of that the voltage regulator.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0338.jpg"><img class="aligncenter size-full wp-image-97" title="Locosys LS20031 GPS" src="http://deathpod3000.files.wordpress.com/2009/04/img_0338.jpg?w=460" alt="Locosys LS20031 GPS"   /></a></p>
<p>The gps has a little light that is supposed to flash once per second if it has a lock.  I turned on the power and waited to see if I&#8217;d get &#8220;flashy lights&#8221;.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0335.jpg"><img class="aligncenter size-full wp-image-98" title="GPS Flashy Lights" src="http://deathpod3000.files.wordpress.com/2009/04/img_0335.jpg?w=460" alt="GPS Flashy Lights"   /></a></p>
<p>All right, so the gps appears to be working.  To start I decided to connect it to the computer because it would be easier to debug communication problems when I can see the actual output and test various baud settings, etc.  After connecting things up I got&#8230;garbage.  The datasheet for the gps chip said by default it used 9600 bps.  Nope, after some experimentation I found by default it was spitting out data at 57,600 bps.  On the bright side, it seemed to be working perfectly.</p>
<p>There is a little program available for download on the sparkfun site <a title="MiniGPS_1.32.zip" href="http://www.sparkfun.com/datasheets/GPS/MiniGPS_1.32.zip">here</a> for another gps that I found works fine with the gps I bought as well.  It will show you how many sats it has locked, lat/long, settings, etc.  The nice thing is it will also let you set the parameters and save them to the chip.  I am only parsing 2 nmea sentences,  GGA and VTG, so I turned off all the others and set the unit for 5hz updates.</p>
<p>Sorry about the blurry pic, but you can at least see that it found satellites and is giving data to the program.  Everything looks great.</p>
<p><a href="http://deathpod3000.files.wordpress.com/2009/04/img_0339.jpg"><img class="aligncenter size-full wp-image-99" title="Happy GPS" src="http://deathpod3000.files.wordpress.com/2009/04/img_0339.jpg?w=460&#038;h=613" alt="Happy GPS" width="460" height="613" /></a></p>
<p>Next, I connected the gps directly to the microcontroller pins and started getting lat/long readings just like before, except a lot faster.  I increased the size of the serial buffer in my uart library to allow for the faster serial speed.  I also decided to cut back to 2 updates per second, at least for now.  This is a huge improvement over 1 every 2 seconds and if I get everything else working and I can spare the cpu cycles, I will increase it later.</p>
<p>Next on the agenda is connecting the digital compass.  It uses i2c to communicate with the microcontroller.  We&#8217;ll have to add some more library code to deal with that and connect to some more pins.  We&#8217;ll cover that in the <a title="Adding an i2c compass to Atmega32" href="http://deathpod3000.wordpress.com/2009/04/06/adding-an-i2c-compass-to-the-avr-atmega32/" target="_self">next post</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=96&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0338.jpg" medium="image">
			<media:title type="html">Locosys LS20031 GPS</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0335.jpg" medium="image">
			<media:title type="html">GPS Flashy Lights</media:title>
		</media:content>

		<media:content url="http://deathpod3000.files.wordpress.com/2009/04/img_0339.jpg" medium="image">
			<media:title type="html">Happy GPS</media:title>
		</media:content>
	</item>
		<item>
		<title>Maiden Voyage = Epic Fail</title>
		<link>http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/</link>
		<comments>http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 22:32:09 +0000</pubDate>
		<dc:creator>aliasmrjones</dc:creator>
				<category><![CDATA[The Build]]></category>

		<guid isPermaLink="false">http://deathpod3000.wordpress.com/?p=89</guid>
		<description><![CDATA[In the last post, we finished all the initial programming and   It&#8217;s time for the maiden voyage of Deathpod3000!  The first test drive of the car was less than perfect&#8230;Ok, it sucked big time.   There are two videos showing all the fun. Here is a little video of me showing the parts: And [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=89&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a title="last post" href="http://deathpod3000.wordpress.com/2009/03/13/controlling-servos-with-the-atmel-avr-atmega32/" target="_self">last post</a>, we finished all the initial programming and   It&#8217;s time for the maiden voyage of Deathpod3000!  The first test drive of the car was less than perfect&#8230;Ok, it sucked big time.   There are two videos showing all the fun.</p>
<p><span id="more-89"></span></p>
<p>Here is a little video of me showing the parts:</p>
<span style="text-align:center; display: block;"><a href="http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/"><img src="http://img.youtube.com/vi/0AgaiBSmlYk/2.jpg" alt="" /></a></span>
<p>And here&#8217;s a vid of the first drive, which mostly features driving around in circles:</p>
<span style="text-align:center; display: block;"><a href="http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/"><img src="http://img.youtube.com/vi/i1jFA4j0P7g/2.jpg" alt="" /></a></span>
<p>The main problem seems to be that the cpu only gets updates from the gps about once every 2 seconds and it is getting current heading data from the gps.</p>
<p>As the car turns, the gps computes heading based on where it was at the last fix and where it is at the current fix.  Unfortunately, while it&#8217;s turning, it is pointing way past this direction so it constantly overshoots where it is trying to turn.  This coupled with the fact that it only gets updates to its heading (as bad as that heading data may be) every 2 seconds means it can&#8217;t figure out where it is heading and spins around in a circle until it decides to spin around in a circle the other directions.</p>
<p>If the car is pointing where it should be going, it does drive straight.  So, it is computing where it wants to go correctly.  The problem is with the current sensor array, it can&#8217;t accurately point the car in the desired direction.</p>
<p>The good news is it looks like the basic programming and navigation software work.  So, it looks like we need to upgrade our sensor array.  I ordered a new gps that updates 5(!) times per second and a digital compass.  Hopefully more frequent updates from the gps will help.  More importantly, though, the digital compass should allow the cpu to get heading readings in real time so it can track to the desired heading accuratly.</p>
<p>The compass uses i2c, a synchronous serial interface and the gps is 3.3v, which will require a level converter.  In the <a title="Adding 3.3v gps to AVR Atmega32" href="http://deathpod3000.wordpress.com/2009/04/06/adding-a-33v-gps-to-a-5v-avr-atmega32/" target="_self">next post</a>, we&#8217;ll hook up the new hardware.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/deathpod3000.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/deathpod3000.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/deathpod3000.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deathpod3000.wordpress.com&amp;blog=6317108&amp;post=89&amp;subd=deathpod3000&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://deathpod3000.wordpress.com/2009/04/02/maiden-voyage-epic-fail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1774e8dd8566c8d85453634b3fc2267e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aliasmrjones</media:title>
		</media:content>
	</item>
	</channel>
</rss>
