Asked — Edited
Resolved Resolved by Jeremie!

Hmc5883

Hi,

Has anyone successfully connected and used a HMC5883L compass on I2C port without systematically crashing at init ?

I'm kind of stuck and wish to know if I should go on trying again or give up.

Did read former threads about same topics Did find datasheet and Hex address of chip DId use I2Cwrite and Read commands Did use tutorial's script did use everything I can think of. Wires are connected sda to sda scl to scl and then 3.3V.

Let me know if any of you guys have a robot capable to know where it's heading thanks to a compass.

Is there not a more simple compass hardware like with an analog output readable on ADC ? Just asking in case it makes any sense.

Thanks in advance.


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

#17  

@Alan wouldnt you be better off using encoders equipped motors for this? (Hooping that this time I'll be the one helping!):)

Elfege

#18  

@elfege,

Probably, and when I build my large robot, I very well may go that way (although that doesn't resolve the issue of wheel slip on some surfaces), but for now, I am trying to do this with a modified RoLi revolution bot.

The goal of the project, which involves a lot of different functions, is to randomly wander around the house picking up cat toys when it recognizes them (which my cat leaves at random places, and I need to go around picking up so I have them available to throw.. My last cat would fetch and return, or just bring toys when she wanted to play, but my current cat is an idiot). When it has picked up a certain number, it will send me a notification (probably an email for now) and wait for instructions, at which point I would probably manually drive it to my location or wherever I want the toys dropped off. At some point I would add the ability to automatically navigate to a particular place automatically, but baby steps.....

Rich's Ping Roam script does a pretty good job on the randomly wandering piece, but occasionally it gets itself helplessly stuck in a corner or behind a piece of furniture. The compass would be used to determine if the turn was successful and allow alternate actions until free or until it has tried too many times and calls me for help.

Alan

PRO
Canada
#19  

Hey @Alan

Just wanted to let you know I haven't forgotten about this. I have also observed some inconsistencies in the raw compass values coming from the 4-in-1. We will be working on an optimized solution soon.

I also wanted to note (as a just-in-case) that with compass readings you do have to be mindful of ferrous metal and magnetic objects around the sensor. A compass is also called a magnetometer due to the fact that it can give you rough gauss readings of materials around the sensor. We are using the 4-in-1 as a true compass so you'll have to be mindful that a even servo output gear in close proximity to the sensor can effect compass readings.

#20  

@Jeremie I have the same issues as Alan... I don't think the random readings have anything to do with metallic interference. I have tried mine in several different areas in my house with the same results... .. We really appreciate you looking into this...

#21  

@Jeremie,

Thanks for the update. Yeah, I thought about the possible interference from the servos, so I hooked it up to an EZ-B on a power shell with nothing else connected or near it, and it still had numbers that made no sense. Putting my Android phone with a compass application in the same location, had dead-on readings as did a real magnetic compass.

Personally, I am not as concerned with accuracy as precision. ie, I don't care what direction is north, but if I move 10 degrees to the left, I want it to reflect that I have moved 10 degrees.

Alan

PRO
Canada
#22  

Cool, thanks for the info guys.

Just so I know that we are all on the same page you guys are monitoring the $CompassHeading variable, correct?

#23  

Correct, although the X, Y, and Z variables also don't seem to have any consistency to them. Not knowing the scale or exactly what they are trying to show doesn't help, but moving the same direction, the same difference, gets different results, so they are also not currently valuable.

Alan