Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 3 
Send Topic Print
i2c compass (Read 11052 times)
admin
YaBB Administrator
*****




Posts: 3675
i2c compass
03/04/08 at 9:49am
 
I just got an i2c compass module based on the Honeywell HMC6352 sensor.  Sparkfun builds the breakout board -  
    http://www.sparkfun.com/commerce/product_info.php?products_id=7915
 
They seem to be out of stock, but I found one of the boards here -  
    https://www.zagrosrobotics.com/shop/item.asp?itemid=704
 
This particular chip is nice because it runs on 3.3V.  Hookup could not be easier - I just connected VCC to Blackfin S-32 pin 1, GND to pin 2, SCL to pin 14 and SDA to pin 15.  
 
The default device address is 0x42, which is actually sent as 0x21 (i2c can be a bit confusing).  0x21 is the hex for the ASCII '!' character, and the HMC6352 command to read the heading is an ASCII 'A'.  So the command 'ir!A' reads the upper byte of the heading.
 
This works perfectly.  However, I discovered that the 'ir' command doesn't provide a way to read the lower byte of the heading, as it only reads a single byte, so the 'ir' command needs to be revised somewhat to fix this.  Perhaps the easiest fix is to always have the i2c read command return multiple bytes.
 
In any case, it took about 5 minutes to set this up.  Once the 'ir' command is changed to handle a multi-byte return (the SRV-1 firmware can already do this), this little compass will be quite useful.
 
===================
 
update - I added an 'iR' command to read two bytes instead of one.  this looks to be a good general solution, but if anyone can think of examples of i2c devices that would to send longer data streams, let me know.
Back to top
 
« Last Edit: 03/04/08 at 10:50am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wmcnab
YaBB Newbies
*




Posts: 30
Re: i2c compass
Reply #1 - 03/10/08 at 6:34am
 
I was just wondering how the compass is working out?  How about accuracy around the electronics, in particular the motors?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: i2c compass
Reply #2 - 03/10/08 at 6:52am
 
The compass works quite well, and performance indoors is better than I expected.  I'm using it on a blimp where the motors are more than 6-inches from the sensor, and have not noticed any problems yet with magnetic interference.  If the motors were closer, there might be an issue.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
steve4891
Junior Member
**




Posts: 94
Re: i2c compass
Reply #3 - 01/31/09 at 11:29am
 
i wanted to know what the compass is used for..
 
i recognized and when the robot goes for a long range it's direction is not straight enough and i wanted to use something to keep the robot perfectly straight...
 
is this what i need or also an x-y recognization is suitable?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: i2c compass
Reply #4 - 01/31/09 at 1:38pm
 
A compass won't drift, so it gives you an absolute reference for direction.  Unless you have some other kind of beacon (you could use visual markers with the camera), a compass is very effective for this purpose.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
steve4891
Junior Member
**




Posts: 94
Re: i2c compass
Reply #5 - 02/01/09 at 2:06pm
 
hello,
in the net i found this kind of compass CMPS03
apart the voltage a wanted to know if it's suitable for srv1.
 
reading the calibration sheet i understood that in word type for example 1000 is 100.0°
 
i wanted to know if it's the same of the compass you suggested.
 
thanks
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: i2c compass
Reply #6 - 02/01/09 at 2:30pm
 
We use a Honeywell HMC6352, which is a 3.3V compass.  The CMPS03 appears to be a Philips compass, and it requires 5V.  I think you will have less difficulty with the HMC6352
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
steve4891
Junior Member
**




Posts: 94
Re: i2c compass
Reply #7 - 02/03/09 at 12:28pm
 
hello, i resolt my problem with laser detect and now it works fine.
to avoid the problem of low PWM of the motors, that sometimes didn't give enough power and motors stopped, i setted the PWM at 50 and for now i didn't have problem...
the only thing i noticed is that going faster the drift is very high and i wanted to do the next step buying the compass..
but before buying i wanted to know from someone who already got it the positive and negative points..
 
for example if i let run the robot for about 10 meters what is the real drift?
 
another question was if i drive ahead at 355° and my robot turn left at 002° i order him to turn again at 355° but the ideal line is not followed anymore. infact if i look ahead at the north i have a x coordinate, if i do step right and i look again in front of my i always look at the north but my x coordinate is changed, pratically i'm in a parallel line...
may i avoid this problem with just the compass or i need an optical mouse working togheter with the compass?  
 
thanks very much...
Back to top
 
 
  IP Logged
akeel.laila
YaBB Newbies
*




Posts: 3
Re: i2c compass
Reply #8 - 03/16/09 at 7:29pm
 
Hi,
 
I will be hooking up an HMC6352 to my SRV. I'm planning to attach it to the centre of the bottom of the chassis (this will help ensure the compass stays horizontal). I was wondering whether I should be worried about interference from the motors in this position. Is there another place for attachment that is recommended?
 
Thanks.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: i2c compass
Reply #9 - 03/16/09 at 10:52pm
 
There might be motor interference in that position.  I have not mounted the compass on the robot, but have mounted it on the blimp, and had best results when the compass was approx 12" from the motors.  However, you can turn off power to the motors while reading the compass and have better results.
 
By the way, you need to change the I2C address of your compass from 0x21 (42) to 0x22 (44) before using the latest version of firmware srv-blackfin-031509 (or later) - there is a conflict between our new camera module and the compass.   I will post instructions on how to change the I2C address once I have a chance to test the method.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
AndreiSk
Full Member
***




Posts: 168
Re: i2c compass
Reply #10 - 03/17/09 at 11:06am
 
Admin is right about interference.
I have HMC6343 (3 axis compas, advanced version of HMC6352). What I can say..
If you have something with magnets inside within range 30cm around compas then compas will show wrong data.
Without any magnetic things it shows good and stable values.
Compas lies when not connected servo motor moved by hand within 30-40cm.
I am using pan-tilt with servos for small robot and I have no enough additional 30cm for compas,  
so compas is wasted money only and it moved to box for next time Sad
Back to top
 
 
  IP Logged
ta_erog
YaBB Newbies
*




Posts: 30
Re: i2c compass
Reply #11 - 03/18/09 at 9:31am
 
Just to note there are all sorts of magnetic shielding that can be used.  Some are thin films and would seem to be the most useful here . .  
This should allow you to reduce error and needed distance if it is still a problem.
Back to top
 
« Last Edit: 03/18/09 at 9:32am by ta_erog »  
Email   IP Logged
AndreiSk
Full Member
***




Posts: 168
Re: i2c compass
Reply #12 - 06/19/09 at 4:20pm
 
If somebody wants to use compas together with OV7725,
I can recommend to use following device. It works with SRV1.
http://www.sparkfun.com/commerce/product_info.php?products_id=8656
 
I remember, admin told, there is some address collision between compas HMC6352 and camera OV7725 .
I have no HMC6352, but for HMC6343 you can make following:
 
wire pins from S32 to compas (4 wires)
1        3.3V               3.3V voltage regulator  
2        GND                ground  
14       I2C SCL            i2c scl    
15       I2C SDA            i2c sda
 
And also change srv.c:
 
void read_compass() {
           unsigned char i2c_data[10];
           short ix, i, head, pitch, roll;
           unsigned char addr;
           
           // HMC6343
           addr = 25;
           i2c_data[0] = 0x50; i2cwrite(addr, (unsigned char *)i2c_data, 1, SCCB_ON); delayUS(10000);
           for(i = 0; i <= 5; i++) i2c_data[i] = 0x00;
           i2cread(addr, (unsigned char *)i2c_data, 6, SCCB_ON);
           head = ((short) (i2c_data[0] * 256 + i2c_data[1])) / 10;
           pitch = ((short) (i2c_data[2] * 256 + i2c_data[3])) / 10;
           roll = ((short) (i2c_data[4] * 256 + i2c_data[5])) / 10;
           printf("##C head=%d pitch=%d roll=%d\n\r", head, pitch, roll);
}
 
Console command for compas data is: $C
That's all.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: i2c compass
Reply #13 - 06/19/09 at 4:23pm
 
HMC6343 looks like a nice device.  We are adding support for HMC5843, which is also 3-axis, but does not include the tilt sensor.  We have the ST LIS3LV02DQ for this purpose.
 
We also have found a solution for moving the HMC6352 from I2C address 0x21 to 0x22.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
andrew.kirillov
YaBB Newbies
*




Posts: 33
Re: i2c compass
Reply #14 - 11/30/09 at 12:15pm
 
Hello
 
Quote from admin on 03/16/09 at 10:52pm:

By the way, you need to change the I2C address of your compass from 0x21 (42) to 0x22 (44) before using the latest version of firmware srv-blackfin-031509 (or later) - there is a conflict between our new camera module and the compass.   I will post instructions on how to change the I2C address once I have a chance to test the method.

 
What it the procedure of changing compass' I2C address from 0x21 to 0x22? The topic seems to be stopped with no update regarding this.
 
Does current "$C" command use 0x22 address or 0x21? I just connected the compass and the command always gives me the same number (I did not change any addresses).
Back to top
 
 
WWW   IP Logged
Pages: 1 2 3 
Send Topic Print