<?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>I&#039;d Rather Be Building Robots &#187; Experiments</title>
	<atom:link href="http://mightor.wordpress.com/category/experiments/feed/" rel="self" type="application/rss+xml" />
	<link>http://mightor.wordpress.com</link>
	<description>A place where I can share my ideas, thoughts and plans, mostly robotics related.</description>
	<lastBuildDate>Thu, 24 Dec 2009 21:18:08 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mightor.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/2178998d8d8c4b87440d427d9c3951c1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>I&#039;d Rather Be Building Robots &#187; Experiments</title>
		<link>http://mightor.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mightor.wordpress.com/osd.xml" title="I&#039;d Rather Be Building Robots" />
		<item>
		<title>Mindstorms Power Scope</title>
		<link>http://mightor.wordpress.com/2009/12/24/mindstorms-power-scope/</link>
		<comments>http://mightor.wordpress.com/2009/12/24/mindstorms-power-scope/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 14:32:09 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[RobotC Drivers]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/12/24/mindstorms-power-scope/</guid>
		<description><![CDATA[ 

Mindsensors was kind of enough to send me one of their prototype sensors, the Power Meter, to play with.&#160; It’s a sensor that allows you to measure, among other things, the current and voltage of anything you care to connect to it (within limits, of course).&#160; 
The first thing that came to mind was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=348&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="Mindsensors Power Meter" border="0" alt="Mindsensors Power Meter" align="right" src="http://mightor.files.wordpress.com/2009/12/image1.png?w=240&#038;h=168" width="240" height="168" /> </p>
</p>
<p><a href="http://www.mindsensors.com" target="_blank">Mindsensors</a> was kind of enough to send me one of their prototype sensors, the Power Meter, to play with.&#160; It’s a sensor that allows you to measure, among other things, the current and voltage of anything you care to connect to it (within limits, of course).&#160; </p>
<p>The first thing that came to mind was building something that would log the incoming data to an Excel sheet using the <a href="http://www.mindsensors.com/index.php?module=pagemaster&amp;PAGE_user_op=view_page&amp;PAGE_id=119" target="_blank">NXT HID</a>, but then <a href="http://www.youtube.com/watch?v=QgS6P3-u89g" target="_blank">Andy M scooped me on that</a> so I had to come up with something else (damn you, Andy!).&#160; Then it hit me!&#160; Why not make an oscilloscope? So without further ado I started programming. This is what I came up with.</p>
<div style="width:425px;display:block;float:none;margin-left:auto;margin-right:auto;padding:0;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:a07ba3b4-61dd-4fa4-a906-114658098cd1" class="wlWriterEditableSmartContent">
<div><span style="text-align:center; display: block;"><a href="http://mightor.wordpress.com/2009/12/24/mindstorms-power-scope/"><img src="http://img.youtube.com/vi/hYekbg95FQU/2.jpg" alt="" /></a></span></div>
</div>
<p>The result is quite nice, I must say.&#160; Right now it takes a sample every couple of milliseconds and refreshes the screen every 20 milliseconds.&#160; There are five scales for each unit (amps and volts), to cover the full range of the sensor (up to 13V5 and up to 3A).&#160; You can switch between ranges using the arrow keys and between units using the enter key.&#160; This program, together with the driver will be available with the next release of the <a href="http://rdpartyrobotcdr.sourceforge.net/" target="_blank">3rd Party Driver Suite</a>.</p>
</p>
<p>Things I’d like to implement at some point is data recording, zooming and manual scrolling of the screen.&#160; I had the manual scrolling implemented at one point but ditched it for the cardiogram-look instead.</p>
<p>Another cool project using the Power Meter sensor can be found here: [<a href="http://ramacco.blogspot.com/2009/12/mindsensors-nxt-powermeter.html" target="_blank">LINK</a>].</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=348&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/12/24/mindstorms-power-scope/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/12/image1.png" medium="image">
			<media:title type="html">Mindsensors Power Meter</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/hYekbg95FQU/2.jpg" medium="image" />
	</item>
		<item>
		<title>I Feel The Need, The Need For Speed&#8230;</title>
		<link>http://mightor.wordpress.com/2009/11/05/i-feel-the-need-the-need-for-speed/</link>
		<comments>http://mightor.wordpress.com/2009/11/05/i-feel-the-need-the-need-for-speed/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 19:58:28 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/11/05/i-feel-the-need-the-need-for-speed/</guid>
		<description><![CDATA[In an earlier article I wrote, I tested how fast I could push the HiTechnic ProtoBoard and the MAX127 ADC under ROBOTC.&#160; In a recent discussion with Deepak from Mindsensors, I2C speeds in ROBOTC on the NXT came up.&#160; The questions arose about the most efficient read size for the NXT and if there was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=243&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In an <a href="http://mightor.wordpress.com/2008/10/25/taking-i2c-to-the-max-on-the-nxt/" target="_blank">earlier article</a> I wrote, I tested how fast I could push the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NPS1055" target="_blank">HiTechnic ProtoBoard</a> and the <a href="http://datasheets.maxim-ic.com/en/ds/MAX127-MAX128B.pdf" target="_blank">MAX127 ADC</a> under <a href="http://www.robotc.net" target="_blank">ROBOTC</a>.&#160; In a recent discussion with Deepak from <a href="http://www.mindsensors.com" target="_blank">Mindsensors</a>, I2C speeds in <a href="http://www.robotc.net" target="_blank">ROBOTC</a> on the NXT came up.&#160; The questions arose about the most efficient read size for the NXT and if there was a ceiling or a cut-off point.</p>
<p>So, rather than taking a guess, I wrote a quick <a href="http://www.robotc.net" target="_blank">ROBOTC</a> program to test the time taken to repeatedly do requests for an ever increasing number of bytes.&#160; The program would do a 1000 reads of 1 byte, time the results, then repeat the same 1000 requests for 2 bytes, all the way up to 16 bytes.&#160; The results were quite interesting and not nearly as linear as you’d expect.&#160; I made use of the new I2C calls “<em>clearI2CStatistics()</em>” and “<em>getI2CDriverStatistics()</em>”.&#160; They allow you to gather information on internal I2C statistics, such as failed pull-up tests, number of retransmits and other things.&#160; You can find more information about them in the &quot;<em>I2CIntrinsics.h</em>&quot; header file included with the latest release of <a href="http://www.robotc.net" target="_blank">ROBOTC</a> (2.00 preview at the time of writing this article).&#160; </p>
<p>So without further ado, here are the results:</p>
<table border="0" cellspacing="0" cellpadding="0" width="675">
<tbody>
<tr>
<td width="126"><strong>Read size (B)</strong></td>
<td width="140"><strong>Time Taken (ms)</strong></td>
<td width="83"><strong>Bytes/s</strong></td>
<td width="178"><strong>Transaction time (ms)</strong></td>
<td width="146"><strong>Transaction/s</strong></td>
</tr>
<tr>
<td width="126">1</td>
<td width="140">1995</td>
<td width="83">501</td>
<td width="178">2.00</td>
<td width="146">501</td>
</tr>
<tr>
<td width="126">2</td>
<td width="140">2000</td>
<td width="83">1000</td>
<td width="178">2.00</td>
<td width="146">500</td>
</tr>
<tr>
<td width="126">3</td>
<td width="140">2000</td>
<td width="83">1500</td>
<td width="178">2.00</td>
<td width="146">500</td>
</tr>
<tr>
<td width="126">4</td>
<td width="140">2994</td>
<td width="83">1336</td>
<td width="178">2.99</td>
<td width="146">334</td>
</tr>
<tr>
<td width="126">5</td>
<td width="140">3000</td>
<td width="83">1667</td>
<td width="178">3.00</td>
<td width="146">333</td>
</tr>
<tr>
<td width="126">6</td>
<td width="140">3000</td>
<td width="83">2000</td>
<td width="178">3.00</td>
<td width="146">333</td>
</tr>
<tr>
<td width="126">7</td>
<td width="140">3989</td>
<td width="83">1755</td>
<td width="178">3.99</td>
<td width="146">251</td>
</tr>
<tr>
<td width="126">8</td>
<td width="140">4000</td>
<td width="83">2000</td>
<td width="178">4.00</td>
<td width="146">250</td>
</tr>
<tr>
<td width="126">9</td>
<td width="140">4000</td>
<td width="83">2250</td>
<td width="178">4.00</td>
<td width="146">250</td>
</tr>
<tr>
<td width="126">10</td>
<td width="140">4549</td>
<td width="83">2198</td>
<td width="178">4.55</td>
<td width="146">220</td>
</tr>
<tr>
<td width="126">11</td>
<td width="140">5000</td>
<td width="83">2200</td>
<td width="178">5.00</td>
<td width="146">200</td>
</tr>
<tr>
<td width="126">12</td>
<td width="140">5000</td>
<td width="83">2400</td>
<td width="178">5.00</td>
<td width="146">200</td>
</tr>
<tr>
<td width="126">13</td>
<td width="140">5347</td>
<td width="83">2431</td>
<td width="178">5.35</td>
<td width="146">187</td>
</tr>
<tr>
<td width="126">14</td>
<td width="140">6000</td>
<td width="83">2333</td>
<td width="178">6.00</td>
<td width="146">167</td>
</tr>
<tr>
<td width="126">15</td>
<td width="140">6000</td>
<td width="83">2500</td>
<td width="178">6.00</td>
<td width="146">167</td>
</tr>
<tr>
<td width="126">16</td>
<td width="140">6011</td>
<td width="83">2662</td>
<td width="178">6.01</td>
<td width="146">166</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<table border="0" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td valign="top" width="200"><a href="http://mightor.files.wordpress.com/2009/11/image.png"><img style="display:inline;" title="[Click to enlarge]" alt="[Click to enlarge]" src="http://mightor.files.wordpress.com/2009/11/image_thumb.png?w=240&#038;h=142" width="240" height="142" /></a></td>
<td valign="top" width="200"><a href="http://mightor.files.wordpress.com/2009/11/image1.png"><img style="display:inline;" title="[Click to enlarge]" alt="[Click to enlarge]" src="http://mightor.files.wordpress.com/2009/11/image_thumb1.png?w=240&#038;h=141" width="240" height="141" /></a></td>
<td valign="top" width="200"><a href="http://mightor.files.wordpress.com/2009/11/image2.png"><img style="display:inline;" title="[Click to enlarge]" alt="[Click to enlarge]" src="http://mightor.files.wordpress.com/2009/11/image_thumb2.png?w=240&#038;h=142" width="240" height="142" /></a></td>
</tr>
<tr>
<td valign="top" width="200">Number of bytes read per second.</td>
<td valign="top" width="200">Average time per I2C transaction.&#160; This includes the time required to send the request and for the reply to be received and read.</td>
<td valign="top" width="200">Number of transactions per second.</td>
</tr>
</tbody>
</table>
<p>So what conclusions can we draw from this?&#160; If it’s sheer bandwidth you need then reading 16 bytes at a time is the way to go.&#160; However, it does reduce the number of total transactions per second to about 166.&#160; If you need to poll a sensor very frequently, it is paramount to keep the number of bytes requested down.&#160; </p>
<p>Tests were done using two sensors, a <a href="http://www.mindsensors.com/index.php?module=pagemaster&amp;PAGE_user_op=view_page&amp;PAGE_id=101" target="_blank">Mindsensors Accel-NX</a> and the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NCO1038" target="_blank">HiTechnic Colour Sensor (V1)</a>.&#160; The results were identical (with a deviation of perhaps 4-6 ms).&#160; The sensor was configured as a custom I2C sensor using the fastest possible clock speed.&#160; Please note that a lot of sensors are not guaranteed to work flawlessly at these speeds.&#160; However, neither sensor produced any errors during the test runs.&#160; <a href="http://www.robotc.net" target="_blank">ROBOTC</a> version 2.00 preview was used, the program was compiled with the “release” setting and without a connection to the debugger.&#160; Runs with the debugger connected and with the “debug” setting enabled showed no difference in performance.</p>
<p>Remember, there are three kinds of lies: lies, damned lies, and statistics..&#160; Use the above data with caution!</p>
<p>You can download the source for the program here: [<a href="http://www.breigh.com/xander/I2C_SpeedTest-1.1.c" target="_blank">LINK</a>].</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/243/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=243&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/11/05/i-feel-the-need-the-need-for-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/11/image_thumb.png" medium="image">
			<media:title type="html">[Click to enlarge]</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/11/image_thumb1.png" medium="image">
			<media:title type="html">[Click to enlarge]</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/11/image_thumb2.png" medium="image">
			<media:title type="html">[Click to enlarge]</media:title>
		</media:content>
	</item>
		<item>
		<title>Connecting the NXT to an ArduinoMega</title>
		<link>http://mightor.wordpress.com/2009/08/04/connecting-the-nxt-to-an-arduinomega/</link>
		<comments>http://mightor.wordpress.com/2009/08/04/connecting-the-nxt-to-an-arduinomega/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 16:09:37 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Sensors]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/08/04/connecting-the-nxt-to-an-arduinomega/</guid>
		<description><![CDATA[I’ve had my ArduinoMega for almost 2 weeks now and until today I had no luck getting it to work as an I2C slave with the NXT.&#160; The NXT is a finicky beast when it comes to I2C.&#160; It’s really not all that standard and requires very high pull-ups (82K) for the NXT to be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=231&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I’ve had my <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> for almost 2 weeks now and until today I had no luck getting it to work as an <a href="http://www.nxp.com/acrobat_download/literature/9398/39340011.pdf" target="_blank">I2C</a> slave with the <a href="http://mindstorms.lego.com/" target="_blank">NXT</a>.&#160; The <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> is a finicky beast when it comes to <a href="http://www.nxp.com/acrobat_download/literature/9398/39340011.pdf" target="_blank">I2C</a>.&#160; It’s really not all that standard and requires very high pull-ups (82K) for the <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> to be able to pull the lines down properly. </p>
<p>After testing the <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a>’s ability to play I2C master to a number of ICs I had lying around, an <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en021393" target="_blank">MCP23008</a> and a <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3241" target="_blank">DS1631</a>, I was pretty sure the <a href="http://www.nxp.com/acrobat_download/literature/9398/39340011.pdf" target="_blank">I2C</a> lines were working properly.&#160; I tried in vain to make the <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> work as a slave with the <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> using the <a href="http://www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/docs/html/group__i2c.html" target="_blank">AVRlib I2C library</a>, the one provided by the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2565.pdf" target="_blank">Atmel AVR311 Appnote</a> (<a href="http://www.atmel.com/dyn/resources/prod_documents/AVR311.zip" target="_blank">source code</a>) and the <a href="http://www.arduino.cc/en/Reference/Wire" target="_blank">Arduino Wire library</a>.&#160; Having tested it with 3 libraries, I was pretty sure it was probably not a software issue but some stupid electrical problem.&#160; Little did I know how stupid it turned out to be.</p>
<p>Lacking the proper equipment to further diagnose the problem, namely a scope and a logic analyser, I employed the help of my friend Joep.&#160; We hooked up the <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> to his PC based <a href="http://www.nxp.com/acrobat_download/literature/9398/39340011.pdf" target="_blank">I2C</a> master board and all tests completed successfully.&#160; The board responded as it should so that definitely ruled out the software as a source of our problems.&#160; So what could it be?&#160; We connected the <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> to the <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> using a small breadboard and two 82K pull-ups.&#160; With the scope hooked up to SCL the problem became pretty obvious; the <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> wasn’t pulling down the line enough.&#160; That made no sense, since the internal pull-ups of the <a href="http://www.atmel.com/dyn/Products/product_card.asp?part_id=3633" target="_blank">ATmega1280</a> were explicitly disabled in our program.&#160; Joep re-examined the <a href="http://arduino.cc/en/uploads/Main/arduino-mega-schematic.pdf" target="_blank">PDF with the circuit diagram</a> and discovered that the SDA and SCL lines had in fact 10K pull-ups!&#160; They were not drawn near the chip itself, but way, way off in the top right corner where you could easily miss them.&#160; With the 10K pull-ups in parallel to the 82K ones, the resulting pull-up resistance had been reduced to a mere 8K9.&#160; After a little brain surgery, the two evil pull-ups from Hell, were removed and subsequent testing resulted in a successful <a href="http://mindstorms.lego.com/" target="_blank">NXT</a> to <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> <a href="http://www.nxp.com/acrobat_download/literature/9398/39340011.pdf" target="_blank">I2C</a> transaction!&#160; </p>
<p>If you plan to use your <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> with an <a href="http://mindstorms.lego.com/" target="_blank">NXT</a>, you will need to remove R2 and R3, which you can find below.&#160; Click on the left picture for a larger version.&#160; </p>
<div align="center">
<table border="0" cellspacing="0" cellpadding="2" width="600" align="center">
<tbody>
<tr>
<td valign="top" width="300"><a href="http://mightor.files.wordpress.com/2009/08/arduino_mega_edited.jpg"><img style="display:inline;border-width:0;margin:0 5px 0 0;" title="[Click to enlarge]" border="0" alt="[Click to enlarge]" src="http://mightor.files.wordpress.com/2009/08/arduino_mega_edited_thumb.jpg?w=378&#038;h=200" width="378" height="200" /></a></td>
<td valign="top" width="300"><a href="http://mightor.files.wordpress.com/2009/08/cimg9585_cropped.png"><img style="display:inline;border-width:0;margin:0 0 0 5px;" title="[Click to enlarge]" border="0" alt="[Click to enlarge]" src="http://mightor.files.wordpress.com/2009/08/cimg9585_cropped_thumb.png?w=225&#038;h=200" width="225" height="200" /></a></td>
</tr>
<tr>
<td valign="top" width="300" align="center">Before brain surgery</td>
<td valign="top" width="300" align="center">After</td>
</tr>
</tbody>
</table></div>
<p align="left">Be very careful when removing these two resistor, of course.&#160; You don’t want to end up damaging your board.&#160; Joep is quite experienced in soldering very small components and has a very fine tipped soldering iron.&#160; The end result was very nice.&#160; Click on the picture on the right to see a bigger version.&#160; </p>
<p>So why had no one else bumped into this problem with <a href="http://www.arduino.cc" target="_blank">Arduino</a>’s before?&#160; Well, it turns out that the <a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove" target="_blank">Arduino Duemilanove</a>, for example, does NOT have these pull-ups.&#160; The SCL/SDA lines are shared with the ADC channels.&#160; You can’t very well put a pull-up on an ADC channel.&#160; I am not sure why they would put the pull-ups on the SDA/SCL lines on the <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> when they weren’t there on the normal <a href="http://www.arduino.cc" target="_blank">Arduino</a>.&#160; </p>
<p>Thank you, Joep, you saved the day!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=231&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/08/04/connecting-the-nxt-to-an-arduinomega/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/08/arduino_mega_edited_thumb.jpg" medium="image">
			<media:title type="html">[Click to enlarge]</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/08/cimg9585_cropped_thumb.png" medium="image">
			<media:title type="html">[Click to enlarge]</media:title>
		</media:content>
	</item>
		<item>
		<title>All aboard the Arduino Bandwagon!</title>
		<link>http://mightor.wordpress.com/2009/07/25/all-aboard-the-arduino-bandwagon/</link>
		<comments>http://mightor.wordpress.com/2009/07/25/all-aboard-the-arduino-bandwagon/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 05:17:54 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/07/25/all-aboard-the-arduino-bandwagon/</guid>
		<description><![CDATA[Having read the countless articles, websites and hearing about it from friends, I’ve decided to jump on the Arduino bandwagon.&#160; I bought one of the new ArduinoMega boards with a very nice shield and some other things.
&#160;&#160;
The ArduinoMega is an Arduino compatible board with an ATmega1280 controller that has 128KB flash, 8KB SRAM and 4KB [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=218&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="left">Having read the countless articles, websites and hearing about it from friends, I’ve decided to jump on the <a href="http://arduino.cc" target="_blank">Arduino</a> bandwagon.&#160; I bought one of the new <a href="http://www.watterott.com/index.php?a=785&amp;lang=eng&amp;&amp;lang=eng" target="_blank">ArduinoMega</a> boards with <a href="http://www.watterott.com/index.php?a=791&amp;lang=eng&amp;&amp;lang=eng" target="_blank">a very nice shield</a> and some other things.</p>
<p align="center">&#160;<img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 5px 0 0;" title="ArduinoMega" border="0" alt="ArduinoMega" src="http://arduino.cc/en/uploads/Main/ArduinoMega.jpg" width="288" height="150" />&#160;<img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 0 0 5px;" title="Shield" border="0" alt="Shield" src="http://www.watterott.com/bilder/produkte/gross/791_1.jpg" width="192" height="150" /></p>
<p align="left">The <a href="http://arduino.cc/en/Main/ArduinoBoardMega" target="_blank">ArduinoMega</a> is an <a href="http://arduino.cc" target="_blank">Arduino</a> compatible board with an <a href="http://www.atmel.com/dyn/Products/product_card.asp?part_id=3633" target="_blank">ATmega1280</a> controller that has 128KB flash, 8KB SRAM and 4KB EEPROM.&#160; It has 54 digital IO pins (of which 14 can provide PWM output), 16 10bit analogue inputs, I2C and a bunch of other ones.</p>
<p align="left">The idea is to use the ArduinoMega as a (very) smart sensor/I2C slave for the NXT.&#160; I am not sure what I’ll do with it, yet.&#160; I have a <a href="http://www.wiznet.co.kr/en/pro02.php?&amp;ss[2]=2&amp;page=1&amp;num=23" target="_blank">Wiznet WIZ810MJ</a> Ethernet module in a drawer somewhere, perhaps I can use that.&#160; So far I have managed to upload a “blink” program and it works.&#160; The only bad thing about the Arduino programming environment is that it is very, very slow on my Windows 7 64bit laptop.&#160; I have it running on a Vista 64bit VM without any issues, though.&#160; Perhaps they have fixed this in the upcoming 0017 release.&#160; For now I will just use the VM-based solution.</p>
<p align="left">I ordered the stuff from an online shop in Germany called <a href="http://www.watterott.com" target="_blank">Watterrot</a>.&#160; I was really impressed with how quickly my order was processed and shipped.&#160; I ordered it on Wednesday lunch time, it shipped out on Thursday afternoon and by Friday afternoon I had all my items.&#160; Their packages are traceable, so you can hit F5 (refresh) in your browser until the lettering wears off.&#160; They also stock a very wide variety of SparkFun items (117 of them @ 25/07/09), which is great.&#160; To top it all off, they have very good prices and only charge €10 euro for shipping and handling for orders within the EU!&#160; That’s less than a 1/3 than what some of the shops in the Netherlands charge for a similar order.&#160; I will definitely order from them the next time.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/218/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/218/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/218/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/218/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/218/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=218&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/07/25/all-aboard-the-arduino-bandwagon/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://arduino.cc/en/uploads/Main/ArduinoMega.jpg" medium="image">
			<media:title type="html">ArduinoMega</media:title>
		</media:content>

		<media:content url="http://www.watterott.com/bilder/produkte/gross/791_1.jpg" medium="image">
			<media:title type="html">Shield</media:title>
		</media:content>
	</item>
		<item>
		<title>TwitterTattle: Big Brother Is Watching You</title>
		<link>http://mightor.wordpress.com/2009/07/21/twittertattle-big-brother-is-watching-you/</link>
		<comments>http://mightor.wordpress.com/2009/07/21/twittertattle-big-brother-is-watching-you/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 20:49:08 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/07/21/twittertattle-big-brother-is-watching-you/</guid>
		<description><![CDATA[ I love our dogs more than anything.&#160; Even more than my NXTs.&#160; I can hear you all gasp and mutter “blasphemer!”.&#160; Now before you throw me on the fire, you must understand that I was a dog person before I was a robot person.
Anyway, as I was saying, as much as I love my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=213&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mightor.files.wordpress.com/2009/07/2867594428_9f7cc0a92c_b.jpg"><img style="display:inline;border-width:0;margin:0 5px 0 0;" title="Bailey, me and Pixel.  [click to enlarge]" border="0" alt="Bailey, me and Pixel.  [click to enlarge]" align="left" src="http://mightor.files.wordpress.com/2009/07/2867594428_9f7cc0a92c_b_thumb.jpg?w=240&#038;h=178" width="240" height="178" /></a> I love our dogs more than anything.&#160; Even more than my NXTs.&#160; I can hear you all gasp and mutter “blasphemer!”.&#160; Now before you throw me on the fire, you must understand that I was a dog person before I was a robot person.</p>
<p>Anyway, as I was saying, as much as I love my dogs, they have a tendency to bark.&#160; When we’re home, we can (and do) tell them to shut up, sometimes combined with the (in)appropriate expletives, depending on volume and time duration of said barking spree. However, when we’re not there, we obviously can’t keep an eye and ear on them.&#160; Luck would have it that <a href="http://www.mindsensors.com/" target="_blank">Mindsensors</a> have a new sensor, the <a href="http://www.mindsensors.com/index.php?module=pagemaster&amp;PAGE_user_op=view_page&amp;PAGE_id=119" target="_blank">NXTHID</a>.&#160; It’s a sensor that can act as a <a href="http://en.wikipedia.org/wiki/Human_interface_device" target="_blank">Human Interface Device</a> (HID), like a keyboard.&#160; Using I2C commands, you can, for example, send data to a program on your computer via a USB cable as if *you* were typing it.&#160; You can also make it start a program using the “run command” by sending the “Windows Key” modifier and the letter “r” and entering the command line in the text box followed by an newline and return carriage.&#160; </p>
<p><a href="http://mightor.files.wordpress.com/2009/07/twittertattle.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 0 5px 5px;" title="TwitterTattle [click to enlarge]" border="0" alt="TwitterTattle [click to enlarge]" align="right" src="http://mightor.files.wordpress.com/2009/07/twittertattle_thumb1.png?w=165&#038;h=240" width="165" height="240" /></a> That gave me an idea. How cool would it be to know how much the dogs had barked and for how long?&#160; Everyone (and their dog) is using <a href="http://twitter.com/" target="_blank">Twitter</a> nowadays, so why not my NXT as well?&#160; I did some Google’ing for a command line <a href="http://twitter.com/" target="_blank">Twitter</a> client for Windows and bumped into a very handy <a href="http://phalacee.com/index.php?page=development&amp;section=app&amp;development=19" target="_blank">little script</a> that uses <a href="http://www.gnu.org/software/wget/" target="_blank">wget</a> to send a message.&#160; It’s really very simple.&#160; Put the batch file and wget program in a directory in your PATH (like C:\Windows or another directory you added to the PATH variable yourself).&#160; Make sure you edit the twitter.bat file to set the username and password of your <a href="http://twitter.com/" target="_blank">Twitter</a> account.&#160; </p>
<p>I created a small program that uses a test release of the NXTHID driver I made.&#160; It will be part of the next release of the ROBOTC Driver Suite.&#160; You can download the zip file with the program and all the necessary drivers here: [<a href="https://www.qdrive.net/download/sharelinkdownloader.php?id=19273&amp;key=3P2zdF9MnX6rdB7AXx2zXX9MqL4KxJ5IXH4" target="_blank">LINK</a>].&#160; The program is quite simple.&#160; First we check if the dog is barking, this is done by checking if the sound sensor is registering a loud noise.&#160; Usually our house is pretty quiet, so if the sensor reads “100”, we can be pretty sure that it’s a bark.&#160; If we’re not already running a total bark time timer, we reset it now and start counting.&#160; Another timer to check how long it’s been since the last bark is also reset.&#160; If there hasn’t been any barking for 30 seconds and our total barking time has been less than 90 seconds (that’s 60 seconds of barking time + the 30 seconds since the last bark), we’ll ignore it.&#160; However, if the total barking time is more than 90 seconds, we’ll start up the twitter script to alert us.&#160; After the tweet is sent, the whole process starts anew.</p>
<p>It is important to set your NXT to not switch itself off after 10 minutes or you’ll never know how bad your dog has been.&#160; You can view my NXT’s Twitter page here: [<a href="http://twitter.com/XandersNXT" target="_blank">LINK</a>].</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=213&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/07/21/twittertattle-big-brother-is-watching-you/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/07/2867594428_9f7cc0a92c_b_thumb.jpg" medium="image">
			<media:title type="html">Bailey, me and Pixel.  [click to enlarge]</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/07/twittertattle_thumb1.png" medium="image">
			<media:title type="html">TwitterTattle [click to enlarge]</media:title>
		</media:content>
	</item>
		<item>
		<title>Release your inner evil scientist</title>
		<link>http://mightor.wordpress.com/2009/07/02/release-your-inner-evil-scientist/</link>
		<comments>http://mightor.wordpress.com/2009/07/02/release-your-inner-evil-scientist/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 06:49:17 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/07/02/release-your-inner-evil-scientist/</guid>
		<description><![CDATA[Are you a budding evil scientist but lack the electronics skills to build your own sharks with laser beams?&#160; Well, you no longer need to outsource your plans for world domination to second rate henchmen.&#160; Now you can learn the skills needed to do this kind of thing yourself. HiTechnic have brought out the Experimenter&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=208&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img style="display:inline;border-width:0;margin:0 5px 0 0;" title="This could be *you*" border="0" alt="This could be *you*" align="left" src="http://johneaves.files.wordpress.com/2009/06/lingerie_dr_evil_surgery.jpg?w=151&#038;h=112" width="151" height="112" />Are you a budding <a href="http://en.wikipedia.org/wiki/Dr_Evil" target="_blank">evil scientist</a> but lack the electronics skills to build your own <a href="http://www.youtube.com/watch?v=Bh7bYNAHXxw" target="_blank">sharks with laser beams</a>?&#160; Well, you no longer need to outsource your plans for world domination to <a href="http://en.wikipedia.org/wiki/Number_2_(Austin_Powers)" target="_blank">second rate henchmen</a>.&#160; Now you can learn the skills needed to do this kind of thing yourself. HiTechnic have brought out the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NPA1058" target="_blank">Experimenter&#8217;s Kit A</a>, which consists of the solderless version of the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NPS1055" target="_blank">Protoboard</a>, a solderless breadboard, a whole bunch of electronic components, jumper wires and, of course, a handbook with quite a number of experiments.&#160; Sample programs in NXT-G, LabView, NXC and RobotC (written by yours truly) are available for each experiment.&#160; They’re easy to modify and expand on so the only limit is your imagination.</p>
<p><img style="display:inline;border-width:0;margin:0 0 0 5px;" title="The experimenter&#39;s kit A" border="0" alt="The experimenter&#39;s kit A" align="right" src="http://www.hitechnic.com/contents/media/Exp-Kit-A-1.jpg" width="172" height="100" /></p>
<p>The kit allows you learn how to interface your NXT with more than just the pre-made sensors that are available on the market.&#160; It includes push buttons, a temperature sensor, a magnetic sensor (plus magnet) and much more.&#160; You can even build your own ambient cancelling light sensor!&#160; That’ll give you a good idea of how the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NEO1048" target="_blank">EOPD</a> sensor works.&#160; The handbook has plenty of drawings, photos and diagram, so you won’t be left in any doubt as to which components to place where.</p>
<p>When you’re done with the experiments in this kit, you’ll be well acquainted with interfacing non-Lego electronics with your brick and programming it to access their data.&#160; How to make your own NXT controlled <a href="http://en.wikipedia.org/wiki/Death_Star" target="_blank">Death Star</a> will be covered in the second edition of the handbook.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=208&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/07/02/release-your-inner-evil-scientist/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://johneaves.files.wordpress.com/2009/06/lingerie_dr_evil_surgery.jpg" medium="image">
			<media:title type="html">This could be *you*</media:title>
		</media:content>

		<media:content url="http://www.hitechnic.com/contents/media/Exp-Kit-A-1.jpg" medium="image">
			<media:title type="html">The experimenter&#39;s kit A</media:title>
		</media:content>
	</item>
		<item>
		<title>HiTechnic Sensor Hack</title>
		<link>http://mightor.wordpress.com/2009/06/30/hitechnic-sensor-hack/</link>
		<comments>http://mightor.wordpress.com/2009/06/30/hitechnic-sensor-hack/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 06:57:50 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/06/30/hitechnic-sensor-hack/</guid>
		<description><![CDATA[ In two previous articles (here and here) I had tried to come up with a way to use IR light to gauge distances.  It wasn’t very successful, but such is the risk of trying something new.  So last night, whilst sitting at my laptop, I wondered if there was a way to emulate a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=206&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mightor.files.wordpress.com/2009/06/irdistance2.png"><img style="display:inline;border-width:0;margin:0 0 0 5px;" title="Click for bigger version" src="http://mightor.files.wordpress.com/2009/06/irdistance2_thumb.png?w=163&#038;h=100" border="0" alt="Click for bigger version" width="163" height="100" align="right" /></a> In two previous articles (<a href="http://mightor.wordpress.com/2008/07/27/ir-distance-gauging-with-the-max127/" target="_blank">here</a> and <a href="http://mightor.wordpress.com/2008/06/15/determining-object-distance-with-infrared/" target="_blank">here</a>) I had tried to come up with a way to use IR light to gauge distances.  It wasn’t very successful, but such is the risk of trying something new.  So last night, whilst sitting at my laptop, I wondered if there was a way to emulate a $10 device (a Sharp IR Sensor) with more than $100’s worth of NXT sensors.  It seems there is.  I repurposed a <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NIL1046" target="_blank">HiTechnic IR Link</a> and <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NSK1042" target="_blank">IR Seeker (v2)</a> and turned them into a very limited IR distance sensor.</p>
<p><a href="http://mightor.files.wordpress.com/2009/06/irdistance.png"><img style="display:inline;border-width:0;margin:0 5px 0 0;" title="Click for larger version" src="http://mightor.files.wordpress.com/2009/06/irdistance_thumb.png?w=122&#038;h=100" border="0" alt="Click for larger version" width="122" height="100" align="left" /></a> So how does it work? Well, remember <a href="http://mightor.wordpress.com/2009/05/21/control-the-world-with-the-hitechnic-ir-link/" target="_blank">I mentioned</a> a few articles back how you could turn an IR Link into a beacon by pulsing it at 1200Hz? Well, instead of using the IR Seeker’s direction register to determine where the beacon is, you could, instead, just query the forward pointing sensor (sensor number 2) for signal strength.  Now if you put the IR Link next to the IR Seeker and point them at an object some of the beacon signal from the IR Link is bound to bounce back and be detected by the IR Seeker.  Using the contraption on the left, I set out to take readings at various distances.  The results surprised me a little.</p>
<p><a href="http://mightor.files.wordpress.com/2009/06/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 5px 0 0;" title="Click for larger version" src="http://mightor.files.wordpress.com/2009/06/image_thumb.png?w=168&#038;h=100" border="0" alt="Click for larger version" width="168" height="100" align="left" /></a></p>
<p>The first 3 points I expected to look that way, the surface was simply too close.  However, the linearity of the next couple of points really boggled me.  Did this actually work?  They are most likely highly inaccurate as the values bounced around a fair bit, even though the program was taking 10 readings and averaging them out before displaying them.  So there you go, a highly inaccurate, completely impractical IR distance sensor!  I think the <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&amp;key=NEO1048" target="_blank">EOPD</a> is probably more suitable for this kind of thing but what would the fun be in that?</p>
<p>You can download the program here: [<a href="http://www.breigh.com/xander/IR_Distance.c" target="_blank">LINK</a>].  Please note that you will need to use my driver suite, too.  You can pick that up here: [<a href="http://rdpartyrobotcdr.sourceforge.net/" target="_blank">LINK</a>].</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/206/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=206&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/06/30/hitechnic-sensor-hack/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/06/irdistance2_thumb.png" medium="image">
			<media:title type="html">Click for bigger version</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/06/irdistance_thumb.png" medium="image">
			<media:title type="html">Click for larger version</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/06/image_thumb.png" medium="image">
			<media:title type="html">Click for larger version</media:title>
		</media:content>
	</item>
		<item>
		<title>Sharp IR MUX board</title>
		<link>http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/</link>
		<comments>http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 10:14:37 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/</guid>
		<description><![CDATA[What is nicer than attaching a Sharp IR sensor to your NXT?&#160; Attaching 8 of them, of course. That is what my friend Helmut wanted to do with his NXT.&#160; Unfortunately, as good a programmer as he might be, messing around with electronics just wasn&#8217;t his &#8220;Tasse Tee&#8221; (that is cup of tea for you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=138&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mightor.files.wordpress.com/2009/03/image.png"><img height="131" alt="image" src="http://mightor.files.wordpress.com/2009/03/image-thumb.png?w=182&#038;h=131" width="182" align="left"></a>What is nicer than attaching a Sharp IR sensor to your NXT?&nbsp; Attaching 8 of them, of course. That is what my friend Helmut wanted to do with his NXT.&nbsp; Unfortunately, as good a programmer as he might be, messing around with electronics just wasn&#8217;t his &#8220;Tasse Tee&#8221; (that is cup of tea for you non-German speaking folks).</p>
<p>8 Sharp IR sensors consume a lot of power, much more than the NXT could ever hope to supply without frying.&nbsp; A single sensor can easily draw up to 40mA, so 8 of them is 320mA, almost 4 times as much as the all the sensor ports can supply, put together!&nbsp; An external power supply would be necessary.&nbsp; A way to enable and disable sensors on an individual bases would be very useful, too.</p>
<p><a href="http://mightor.files.wordpress.com/2009/03/mightyboard-schematic.png"><img height="125" alt="Click to see a MUCH larger version" src="http://mightor.files.wordpress.com/2009/03/mightyboard-schematic-thumb.png?w=182&#038;h=125" width="182" align="right"></a> Thus was born &#8220;MightyBoard&#8221;.&nbsp; At the heart of the board are 2 ICs, the MAX127, an 8 channel 12bit ADC, and an MCP23008, an 8 channel IO chip.&nbsp; Both these chips can talk I2C and are therefore ideal to connect to the NXT.&nbsp; The ULN2803A merely acts as a buffer for the MCP23008. I added some green LEDs so that it was easy to see when a channel was enabled. </p>
<p>I prototyped the whole thing on 3 breadboards but to cut down on the wires and mess, I only made it work for 4 channels.&nbsp; It was for proving a concept, rather than duplicating the whole thing.&nbsp; Below is a short video of one of the first tests.</p>
<p align="center">
<div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:5c6096bf-af7c-471b-8d56-0d0ae2f3bf4e" style="display:inline;margin:0;padding:0;">
<div><span style="text-align:center; display: block;"><a href="http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/"><img src="http://img.youtube.com/vi/GfYjFcH2ecU/2.jpg" alt="" /></a></span></div>
</div>
<p>Next was the hard part, making a permanent copy of the whole thing.&nbsp; I chose to use copper strip board, the 3 hole per strip kind.&nbsp; They&#8217;re fairly easy to use and you almost never have to manually cut any of the strips.&nbsp; I used a cut up conducting flat strip of Lego as a connecting point for the Lego battery holder. I soldered some pins into the back of it and then super glued it to the board to stop it from ever moving again.&nbsp; The small dual DIP switch is to allow the pull-up resistors to be disabled.&nbsp; This is necessary if the second sensor looped through is a Lego sensor.&nbsp; They have the pull-ups already built in.</p>
<p align="center">&nbsp;<a href="http://mightor.files.wordpress.com/2009/03/cimg7584.jpg"><img height="180" alt="Front of the board, nice and tidy" src="http://mightor.files.wordpress.com/2009/03/cimg7584-thumb.jpg?w=240&#038;h=180" width="240"></a> <a href="http://mightor.files.wordpress.com/2009/03/cimg7586.jpg"><img height="180" alt="Back of the board - spaghetti hell" src="http://mightor.files.wordpress.com/2009/03/cimg7586-thumb.jpg?w=240&#038;h=180" width="240"></a> </p>
<p>To prevent the mess of wires from being ripped off, I used a whole bunch of hot glue and the plastic from a DVD cover box.&nbsp; It really did the trick and made the board rather &#8220;professional&#8221; looking, even if I do say so myself.&nbsp; I used a box cutting knife to trim the blobs off the side.</p>
<p align="center"><a href="http://mightor.files.wordpress.com/2009/03/cimg7592-1.jpg"><img height="180" alt="Lots of hot glue." src="http://mightor.files.wordpress.com/2009/03/cimg7592-1-thumb.jpg?w=240&#038;h=180" width="240"></a> <a href="http://mightor.files.wordpress.com/2009/03/cimg7593-1.jpg"><img height="180" alt="Nice and flat back, no spaghetti!" src="http://mightor.files.wordpress.com/2009/03/cimg7593-1-thumb.jpg?w=240&#038;h=180" width="240"></a> </p>
<p>Below is the video of the first test I did with the final version of the MightyBoard.&nbsp; As you can see, it worked rather well.</p>
<div align="center">
<div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:946118b9-89c9-49cd-a4b7-0dc9616039d5" style="display:inline;margin:0;padding:0;">
<div><span style="text-align:center; display: block;"><a href="http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/"><img src="http://img.youtube.com/vi/ABLdpef7f80/2.jpg" alt="" /></a></span></div>
</div>
</div>
<div align="center">&nbsp;</div>
<div align="left">The parts list can be found below.&nbsp; Please note that this is merely for the control circuit and does not include parts needed to make the power supply.&nbsp; I am sure a much more efficient design could be made.&nbsp; In my circuit I used the rather pricey <a href="http://datasheet.digchip.com/456/456-04830-0-L4805.pdf" target="_blank">L4805</a> which has a super low drop-out voltage.&nbsp; I also used a rectifier to ensure that the circuit could not be damaged in the event of the power supply being wrongly connected.</div>
<p><a href="http://datasheet.digchip.com/456/456-04830-0-L4805.pdf" target="_blank">MAX127</a> 8 channel 12 bit ADC with I2C interface<br /><a href="http://focus.ti.com/lit/ds/symlink/uln2803a.pdf" target="_blank">ULN2803A</a> Darlington transistor array<br /><a href="http://ww1.microchip.com/downloads/en/DeviceDoc/21919d.pdf" target="_blank">MCP23008</a> 8-Bit I/O Expander with I2C interface<br />C1..C8 0.1 uF capacitor<br />R1..R8 1kOhm resistor<br />D1..D8 green 3mm LED<br />CON0..CON8 3 pin connector <br />C9 0.01 uF capacitor<br />C10 4.7 uF capacitor<br />J1, J2 NXT connector&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />R1..R8 1kOhm resistor&nbsp; <br />R9, R10 82kOhm resistor&nbsp;&nbsp;&nbsp; <br />SW1&nbsp; double DIP switch</p>
<p>You can download the latest version of the RobotC drivers for this board here: [<a href="http://code.google.com/p/robotc-drivers/downloads/list" target="_blank">LINK</a>].</p>
<p>Have fun and remember, if you blow it up, don&#8217;t blame me!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=138&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/03/02/sharp-ir-mux-board/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/03/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/03/mightyboard-schematic-thumb.png" medium="image">
			<media:title type="html">Click to see a MUCH larger version</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/GfYjFcH2ecU/2.jpg" medium="image" />

		<media:content url="http://mightor.files.wordpress.com/2009/03/cimg7584-thumb.jpg" medium="image">
			<media:title type="html">Front of the board, nice and tidy</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/03/cimg7586-thumb.jpg" medium="image">
			<media:title type="html">Back of the board - spaghetti hell</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/03/cimg7592-1-thumb.jpg" medium="image">
			<media:title type="html">Lots of hot glue.</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/03/cimg7593-1-thumb.jpg" medium="image">
			<media:title type="html">Nice and flat back, no spaghetti!</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/ABLdpef7f80/2.jpg" medium="image" />
	</item>
		<item>
		<title>Take control of your NXTCam2</title>
		<link>http://mightor.wordpress.com/2009/02/23/take-control-of-your-nxtcam2/</link>
		<comments>http://mightor.wordpress.com/2009/02/23/take-control-of-your-nxtcam2/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 22:12:01 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2009/02/23/take-control-of-your-nxtcam2/</guid>
		<description><![CDATA[Technorati Tags: NXTCam,Mindsensors,NXT,RobotC
I got a Mindsensors NXTCam2 for my birthday last year but hadn&#8217;t had much time to play with it yet.&#160; That is, until today.&#160; 
The NXTCam2 detects objects by matching them to one of 8 user-programmable colour ranges.&#160; The objects and their colour can then be retrieved via a few trivial I2C commands. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=124&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c2ae0ff4-f92e-4a7f-893c-29203574f8da" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/NXTCam" rel="tag">NXTCam</a>,<a href="http://technorati.com/tags/Mindsensors" rel="tag">Mindsensors</a>,<a href="http://technorati.com/tags/NXT" rel="tag">NXT</a>,<a href="http://technorati.com/tags/RobotC" rel="tag">RobotC</a></div>
<p><img src="http://www.mindsensors.com/images/pagemaster/NXTCamv2s2.png" align="left">I got a <a href="http://www.mindsensors.com/index.php?module=pagemaster&amp;PAGE_user_op=view_page&amp;PAGE_id=78" target="_blank">Mindsensors NXTCam2</a> for my birthday last year but hadn&#8217;t had much time to play with it yet.&nbsp; That is, until today.&nbsp; </p>
<p>The NXTCam2 detects objects by matching them to one of 8 user-programmable colour ranges.&nbsp; The objects and their colour can then be retrieved via a few trivial I2C commands. </p>
<p><a href="http://mightor.files.wordpress.com/2009/02/before.png"><img height="64" alt="before" src="http://mightor.files.wordpress.com/2009/02/before-thumb.png?w=100&#038;h=64" width="100" align="right"></a> You would think that this would mean that a ball shaped object would appear ball shaped on the camera when dangled in front of it.&nbsp; You would be wrong.&nbsp; Objects are rarely uniformly coloured and a patch of reflected light might make the object appear very differently to the camera, resulting in something resembling the picture to the right.&nbsp; </p>
<p>This can make processing processing the information quite hard and daunting if all you really want is to know whether there&#8217;s a red ball in front of your robot.&nbsp; I thought it would be nice if there was some way to combine all the shapes that were overlapping or touching into something that was was contiguous and square.&nbsp; One type of software that does a lot of checking whether two objects are touching is game software.&nbsp; After a little Googe&#8217;ing I came across this great tutorial that explains collision detection very nicely: <a href="http://www.metanetsoftware.com/technique/tutorialA.html" target="_blank">Collision Detection and Response</a>.</p>
<p><a href="http://mightor.files.wordpress.com/2009/02/after.png"><img height="64" alt="after" src="http://mightor.files.wordpress.com/2009/02/after-thumb.png?w=100&#038;h=64" width="100" align="left"></a> After a little fiddling and programming, I turned the above jumble of boxes into just two big squares. This makes dealing with the shapes a lot simpler.&nbsp; It gives a much more accurate representation of what&#8217;s in front of the camera than the original, assuming you&#8217;re not trying to detect pringles with your NXTCam2, that is.</p>
<p>The program below is a modified version of cam_display written by <a href="http://www.itee.uq.edu.au/~wyeth/NXT/" target="_blank">Gordon Wyeth</a>.&nbsp; I&#8217;ve also included the nxtcamlib file with the program.</p>
<p>File: <a href="http://www.breigh.com/xander/cam_display_mk2.zip" target="_blank">cam_display_mk2.zip</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=124&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2009/02/23/take-control-of-your-nxtcam2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://www.mindsensors.com/images/pagemaster/NXTCamv2s2.png" medium="image" />

		<media:content url="http://mightor.files.wordpress.com/2009/02/before-thumb.png" medium="image">
			<media:title type="html">before</media:title>
		</media:content>

		<media:content url="http://mightor.files.wordpress.com/2009/02/after-thumb.png" medium="image">
			<media:title type="html">after</media:title>
		</media:content>
	</item>
		<item>
		<title>Taking I2C to the max on the NXT</title>
		<link>http://mightor.wordpress.com/2008/10/25/taking-i2c-to-the-max-on-the-nxt/</link>
		<comments>http://mightor.wordpress.com/2008/10/25/taking-i2c-to-the-max-on-the-nxt/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 08:39:42 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">http://mightor.wordpress.com/2008/10/25/taking-i2c-to-the-max-on-the-nxt/</guid>
		<description><![CDATA[I&#8217;ve been quite busy the last few days with various performance testing.&#160; A friend of mine is keen to develop a robo-football platform.&#160; Due to the nature of the game, very fast sensor updates and processing is required to track the ball and the opponents.&#160; I&#8217;ve offered to work on an extension for the NXT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=107&subd=mightor&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been quite busy the last few days with various performance testing.&nbsp; A friend of mine is keen to develop a robo-football platform.&nbsp; Due to the nature of the game, very fast sensor updates and processing is required to track the ball and the opponents.&nbsp; I&#8217;ve offered to work on an extension for the NXT allowing him to hook up to 8 Sharp IR sensors, which will be dotted around the robot&#8217;s body.&nbsp; That made me curious, how fast *can* the NXT go when it comes to I2C?</p>
<p>I wrote a program that made use of two drivers I created earlier.&nbsp; One for the <a href="http://datasheets.maxim-ic.com/en/ds/MAX127-MAX128B.pdf" target="_blank">MAX127</a> and another for the <a href="http://www.hitechnic.com/contents/en-us/d20.html" target="_blank">HiTechnic ProtoBoard</a> (HTPB).&nbsp; Running both sensors in standard mode, I noticed that I was able to get about 140 readings per second on both.&nbsp; However, after a conversation with Steve from <a href="http://www.hitechnic.com/" target="_blank">HiTechnic</a>, I confirmed a suspicion that I had before, that it is possible, with a single request, to query ALL of the ADC channels of the <a href="http://www.hitechnic.com/contents/en-us/d20.html" target="_blank">HTPB</a> at once.&nbsp; I had no function for that so I extended the current driver with a new function:
<dl>
<dt><strong>void HTPBReadAllADC(tSensors _link, tBuffer &amp;_oBuffer, byte _width)</strong>
<dd>Reads all the analogue channels on the Protoboard at once.</dd>
</dl>
<p>This really pushed up the number of readings I could get per second, going as high as 330.&nbsp; Mind you, this is not the number of I2C requests made per second, that would be 330/5 or 66.&nbsp; </p>
<p><img height="113" alt="Dick Swan probably does not look like this." src="http://msp108.photobucket.com/albums/n8/jmgooser33/Dark_Helmet.jpg" width="113" align="left"> After speaking with Dick Swan, one of the principal developers of <a href="http://www.robotc.net" target="_blank">RobotC</a>, the Faster and FastSkipStates for the 9V sensor types were added to both the firmware and the compiler as they only existed for the standard sensor types prior to this.&nbsp; Officially the <a href="http://www.hitechnic.com/contents/en-us/d20.html" target="_blank">HTPB</a> is not supported at these speeds, at least not yet.&nbsp; It does, however, seem to work without any problems.&nbsp; At the Faster speed, the <a href="http://datasheets.maxim-ic.com/en/ds/MAX127-MAX128B.pdf" target="_blank">MAX127</a> can be pushed to 330 reads per second, using the HTPBReadAllADC() call, the HTPB can crank out a very respectable 833 readings per second.&nbsp; For <a href="http://nl.youtube.com/watch?v=HB7tc9pVvYg" target="_blank">ludicrous speed</a>, the FastSkipStates will allow you to go as fast as 500 reads per second on the <a href="http://datasheets.maxim-ic.com/en/ds/MAX127-MAX128B.pdf" target="_blank">MAX127</a> and 886 on the <a href="http://www.hitechnic.com/contents/en-us/d20.html" target="_blank">HTPB</a>. </p>
<table cellspacing="0" cellpadding="2" width="498" border="1">
<tbody>
<tr>
<td valign="top" width="151"><strong>Speed</strong></td>
<td valign="top" width="121"><strong>MAX127 (seq)</strong></td>
<td valign="top" width="112"><strong>HTPB (seq)</strong></td>
<td valign="top" width="112"><strong>HTPB (all)</strong></td>
</tr>
<tr>
<td valign="top" width="153"><strong>Normal</strong></td>
<td valign="top" width="120">142</td>
<td valign="top" width="112">142</td>
<td valign="top" width="112">333</td>
</tr>
<tr>
<td valign="top" width="154"><strong>Faster</strong></td>
<td valign="top" width="120">333</td>
<td valign="top" width="112">333</td>
<td valign="top" width="111">833</td>
</tr>
<tr>
<td valign="top" width="155"><strong>FastSkipStates</strong></td>
<td valign="top" width="120">500</td>
<td valign="top" width="111">500</td>
<td valign="top" width="112">886</td>
</tr>
</tbody>
</table>
<p>To make sure that the readings were not erroneous, extensive testing was done with the <a href="http://www.hitechnic.com/contents/en-us/d20.html" target="_blank">HTPB</a>.&nbsp; A program was written to write a sequentially increased number to a specific register and read it back a predetermined number of times at various speeds.&nbsp; If a different value was read back than was written, an error had occurred.&nbsp; I did 250,000 individual reads at each speed and found no errors.&nbsp; <a href="http://www.hitechnic.com/" target="_blank">HiTechnic</a> are currently doing their own tests to confirm this.&nbsp; </p>
<p>You can download the test programs here: [<a title="Click here to download the I2C test programs used in this post" href="http://www.breigh.com/xander/i2c-testprograms.zip" target="_blank">LINK</a>].</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mightor.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mightor.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mightor.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mightor.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mightor.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mightor.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mightor.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mightor.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mightor.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mightor.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mightor.wordpress.com&blog=3937275&post=107&subd=mightor&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mightor.wordpress.com/2008/10/25/taking-i2c-to-the-max-on-the-nxt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/936a7365b0e638b08dfe384824ab1457?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Xander</media:title>
		</media:content>

		<media:content url="http://msp108.photobucket.com/albums/n8/jmgooser33/Dark_Helmet.jpg" medium="image">
			<media:title type="html">Dick Swan probably does not look like this.</media:title>
		</media:content>
	</item>
	</channel>
</rss>