<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=4&amp;t=1567" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2009-10-20T12:25:06+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=4&amp;t=1567</id>
<entry>
<author><name><![CDATA[limor]]></name></author>
<updated>2009-10-20T12:25:06+01:00</updated>
<published>2009-10-20T12:25:06+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=22381#p22381</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=22381#p22381"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=22381#p22381"><![CDATA[
I updated the <a href="http://robosavvy.com/site/index.php?option=com_openwiki&amp;Itemid=&amp;id=wiki:robonova-i_faq" class="postlink">Robonova Knowledgebase</a> and added this Sparkfun module solution link. btw: The module is available at <a href="http://robosavvy.com/store/product_info.php/products_id/394" class="postlink">RoboSavvy.com/store</a><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2">limor</a> — Tue Oct 20, 2009 12:25 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-09-07T00:49:03+01:00</updated>
<published>2009-09-07T00:49:03+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21677#p21677</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21677#p21677"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21677#p21677"><![CDATA[
<div class='bbmedia' data-url='http://www.youtube.com/watch?v=MH1s1H3HQnA&amp;hl=en&amp;fs=1&amp;' style='margin: 1px; display: inline-block; vertical-align: bottom;'><div style='width: 200px; height: 40px; border: 1px solid #999; display: table-cell; text-align: center; vertical-align: middle; font: 10px/10px Verdana; color: #555; opacity: 0.5;'><a style='color: #105289; text-decoration: none;' href='http://phpbbex.com/' target='_blank'>phpBB</a> &#91;media&#93;</div><script>if (typeof bbmedia == 'undefined') { bbmedia = true; var e = document.createElement('script'); e.async = true; e.src = 'js/bbmedia.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s); }</script></div><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Mon Sep 07, 2009 12:49 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-09-06T20:52:02+01:00</updated>
<published>2009-09-06T20:52:02+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21676#p21676</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21676#p21676"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21676#p21676"><![CDATA[
The code in the below PDF is not perfect but it works with the SparkFun I2C HMC6352 compass. Thanks I-Bot and NovaOne for your help.<br /><br /><!-- m --><a class="postlink" href="http://robosavvy.com/Builders/Gort/SparkFun%20I2C%20HMC6352%20Compass%20Version%201.pdf">http://robosavvy.com/Builders/Gort/Spar ... on%201.pdf</a><!-- m --><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sun Sep 06, 2009 8:52 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[i-Bot]]></name></author>
<updated>2009-08-30T10:01:47+01:00</updated>
<published>2009-08-30T10:01:47+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21538#p21538</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21538#p21538"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21538#p21538"><![CDATA[
Try this:<br />Main: <br />I2cAddr = &amp;H42 'Default address of compass <br />'I2cReg = 1 '!!Not needed for HMC <br />GOSUB WriteA <br />DELAY 100 <br />GOSUB ReadBearing <br />PRINT &amp;HFE,&amp;H01 <br />PRINT &quot;heading = &quot; <br />PRINT FORMAT (I2cDataWord, DEC) <br />DELAY 4000 <br />GOTO Main <br /><br />WriteA: <br />GOSUB I2cStart <br />I2cBuf = I2cAddr <br />GOSUB I2cOutByte <br />I2cBuf = &quot;A&quot; <br />GOSUB I2cOutByte <br />GOSUB I2cStop ' !! I missed the stop<br />PRINT &amp;HFE,&amp;H01 <br />PRINT &quot;Done with WriteA&quot; <br />DELAY 1000 <br />RETURN <br /><br />ReadBearing: <br />GOSUB I2cStart <br />I2cBuf = I2cAddr OR 1 ' or in the read bit to address <br />GOSUB I2cOutByte <br />I2cAckBit = 0      'NAck !!Proper handling of response<br />GOSUB I2cInByte <br />I2cDataWord = I2cBuf * 256<br />I2cAckBit = 1      'Ack last byte<br />GOSUB I2cInByte <br />I2cDataWord = I2cDataWord + I2cData <br />GOSUB I2cStop <br />PRINT &amp;HFE,&amp;H01 <br />PRINT &quot;Done with ReadBearing&quot; <br />PRINT FORMAT (I2cData, DEC) <br />DELAY 1000 <br />RETURN<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=159">i-Bot</a> — Sun Aug 30, 2009 10:01 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-08-30T02:31:31+01:00</updated>
<published>2009-08-30T02:31:31+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21537#p21537</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21537#p21537"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21537#p21537"><![CDATA[
Thanks I-Bot, here is my code so far. Now the issue is that I am alwas getting a value of 10 for the compass.<br /><br />Main: <br />   I2cAddr = &amp;H42        'Default address of  compass <br />   I2cReg = 1           'Register containing Compass bearing as a single Byte   <br />   GOSUB WriteA<br />   DELAY 100<br />   GOSUB ReadBearing   <br />   PRINT &amp;HFE,&amp;H01<br />   PRINT &quot;heading = &quot; <br />   PRINT FORMAT (I2cDataWord, DEC)<br />   DELAY 4000    <br />GOTO Main <br /><br />WriteA: <br />GOSUB I2cStart <br />I2cBuf = I2cAddr <br />GOSUB I2cOutByte <br />I2cBuf = &quot;A&quot; <br />GOSUB I2cOutByte<br />PRINT &amp;HFE,&amp;H01 <br />PRINT &quot;Done with WriteA&quot;<br />DELAY 1000<br />RETURN <br /><br />ReadBearing: <br />GOSUB I2cStart <br />I2cBuf = I2cAddr OR 1 ' or in the read bit to address <br />GOSUB I2cOutByte <br />GOSUB I2cInByte <br />I2cDataWord = I2cBuf * 256 <br />GOSUB I2cInByte <br />I2cDataWord = I2cDataWord + I2cData <br />GOSUB I2cStop <br />PRINT &amp;HFE,&amp;H01<br />PRINT &quot;Done with ReadBearing&quot;<br />PRINT FORMAT (I2cData, DEC)<br />DELAY 1000<br />RETURN<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sun Aug 30, 2009 2:31 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[i-Bot]]></name></author>
<updated>2009-08-29T13:55:46+01:00</updated>
<published>2009-08-29T13:55:46+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21533#p21533</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21533#p21533"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21533#p21533"><![CDATA[
&amp;H is just the prefix to say the number is in HEX to the Robobasic compiler so &amp;HC0 is 0x0c and &amp;H42 would be 0x42 in C speak.<br /><br />I2cReg = 1 specifies the register to be read from the compass in the I2cByteRead subroutine. The CMPS03  appears as a bank of memory over the I2C bus.<br /><br />Your HMC6352 is different using a seperate command and response. This means the I2CByteRead routine will not work for you.<br /><br />You need a couple of new subroutines:<br />DIM I2cData as INTEGER<br /><br />WriteA:<br />GOSUB I2cStart <br />I2cBuf = I2cAddr <br />GOSUB I2cOutByte <br />I2cBuf = &quot;A&quot;<br />GOSUB I2cOutByte <br />RETURN <br /><br />ReadBearing:<br />GOSUB I2cStart          <br />I2cBuf = I2cAddr OR 1  ' or in the read bit to address<br />GOSUB I2cOutByte <br />GOSUB I2cInByte <br />I2cDataWord = I2cBuf * 256<br />GOSUB I2cInByte <br />I2cDataWord = I2cDataWord + I2CInByte<br />GOSUB I2cStop <br />RETURN <br /><br />Then from Main call these with the required delay between.<br /><br />I didn't check these and my head is in C mode today, so you need to work on them.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=159">i-Bot</a> — Sat Aug 29, 2009 1:55 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-08-29T02:41:54+01:00</updated>
<published>2009-08-29T02:41:54+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21524#p21524</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21524#p21524"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21524#p21524"><![CDATA[
My issue is the compass address. NovaOne is using the CMPS03 which has an address of 0x60. I am using the HMC6352 which has a compass address of 0x42. I also have two more questions about NovaOne's code. He sets the I2cAddr in Main: too &amp;Hc0 which I think is a pointer variable, like in C. Can I use a hex number instead for my compass address which is 0x42 or do I need to use a pointer variable? The other question is I am not sure what I2cReg = 1 is doing in Main:.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sat Aug 29, 2009 2:41 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[NovaOne]]></name></author>
<updated>2009-08-25T13:07:32+01:00</updated>
<published>2009-08-25T13:07:32+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21453#p21453</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21453#p21453"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21453#p21453"><![CDATA[
I'd like to help Gort...but its all in this thread...my cards are on the table....<br /><br />as Dr.  Lanning said...&quot;I'm sorry. My responses are limited. You must ask the right questions.&quot;<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=663">NovaOne</a> — Tue Aug 25, 2009 1:07 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-08-23T22:29:29+01:00</updated>
<published>2009-08-23T22:29:29+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21443#p21443</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21443#p21443"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21443#p21443"><![CDATA[
My constants are<br /><br />CONST SDA = 46 'Use port 46 for Data, constant SDA <br />CONST SCL = 47 'Use port 47 for Clock, constant SCL <br /><br />I should have said that I am using the PWM connections 0 and 1 which are ports 46 and 47.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sun Aug 23, 2009 10:29 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[RoboJeronimo]]></name></author>
<updated>2009-08-23T14:56:11+01:00</updated>
<published>2009-08-23T14:56:11+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21439#p21439</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21439#p21439"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21439#p21439"><![CDATA[
At the beggining I had the same problem. That's wrong port conection. Are your constants...<br /><br />CONST SDA = 0 'Use port 0 for Data, constant SDA<br />CONST SCL = 1 'Use port 1 for Clock, constant SCL<br /><br />or <br /><br />CONST SDA = 1 'Use port 0 for Data, constant SDA<br />CONST SCL = 0 'Use port 1 for Clock, constant SCL<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1554">RoboJeronimo</a> — Sun Aug 23, 2009 2:56 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-08-23T04:09:48+01:00</updated>
<published>2009-08-23T04:09:48+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21435#p21435</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21435#p21435"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21435#p21435"><![CDATA[
I have had no luck so far getting my compass to work using NovaOne's code. I am using the PWM ports 0 and 1. The compass value being displayed on my LCD is always 255? Not sure what I am doing wrong.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sun Aug 23, 2009 4:09 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Gort]]></name></author>
<updated>2009-08-15T21:10:57+01:00</updated>
<published>2009-08-15T21:10:57+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21348#p21348</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21348#p21348"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21348#p21348"><![CDATA[
Still trying to find time to hook up my compass. I am curious to see the compass reading when displayed on the LCD.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=174">Gort</a> — Sat Aug 15, 2009 9:10 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ProblemChild]]></name></author>
<updated>2009-08-15T19:54:09+01:00</updated>
<published>2009-08-15T19:54:09+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21346#p21346</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21346#p21346"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21346#p21346"><![CDATA[
I would of expected that the distribution was largely equal but yes with out calibration you would not be able to know for sure that 127 was 180 degrees etc.<br />Isn't this the whole point of calibration. These values should be derived from the calibration lookup table not the  values direct from the sensor .<br /><br /><br />John<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1587">ProblemChild</a> — Sat Aug 15, 2009 7:54 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[RoboJeronimo]]></name></author>
<updated>2009-08-15T17:44:52+01:00</updated>
<published>2009-08-15T17:44:52+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21345#p21345</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21345#p21345"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21345#p21345"><![CDATA[
Hi, I found the problem of my code for turning 180º<br /><br />The error is I assumed the compass gives 127 (127=255/2) with a 180º angle, but the compass doesn't distribute de values proportinally around the full circle.<br /><br />So the sentence IF BRUJULA&lt;127 THEN GOSUB LEFT_TURN is wrong<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1554">RoboJeronimo</a> — Sat Aug 15, 2009 5:44 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ProblemChild]]></name></author>
<updated>2009-08-14T09:01:21+01:00</updated>
<published>2009-08-14T09:01:21+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21328#p21328</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21328#p21328"/>
<title type="html"><![CDATA[I2C Compass]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=1567&amp;p=21328#p21328"><![CDATA[
I'm under the impression supported by (1) that you only need one set of resistors for the entire bus. I ass -u-me it's on the Arduino .<br /><br /><br />(1) <!-- m --><a class="postlink" href="http://www.robot-electronics.co.uk/htm/using_the_i2c_bus.htm">http://www.robot-electronics.co.uk/htm/ ... 2c_bus.htm</a><!-- m --><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1587">ProblemChild</a> — Fri Aug 14, 2009 9:01 am</p><hr />
]]></content>
</entry>
</feed>