United Kingdom
Asked — Edited

Hmc5883l Triple Axis Magnetometer Help

Hi

So finally I got may HMC5883L Triple Axis Magnetometer through. But I can't seem to get it working and there doesn't seem to be any reference to it only a dual axis one.

All connections were obvious so I know they are right. It's connected to the 3.3v not 5v.

I can't say much more than that.

I tried using the dual axis options but it only returns a heading of 44 all the rest of the values return -1.

I'd prefer to be using c# scripting if this helps at all.


ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

United Kingdom
#1  

The datasheet should tell you how to use it. Do you have the datasheet?

United Kingdom
#2  

er..... no I don't. Got it off ebay. ill do a quick search now confused

United Kingdom
#3  

The number one rule, always make sure you can get a datasheet:) I learnt that the hard way too.

If it's a breakout board you may need the schematic from the company who made the board too if connections, voltages etc. aren't clear.

United Kingdom
#4  

connections and stuff are all marked ok gnd,vcc,scl,sda etc just don't get how to read it

United Kingdom
#5  

Find the datasheet first, on it it should (however it's not guaranteed) tell you what you need to do to get the data from the sensor.

You use the i2cread command (I believe it is currently not working like it should though so be aware of that possible bug in 2013.07.10) to store the data i.e. (this isn't the actual code, I don't have the datasheet to check)

$raw = I2CRead(0, auto, 0x4a, 3)

Have a read of the script help in ARC for the i2c read command, hopefully it'll make sense to you.

I can't help with c# though, I don't know it well enough yet although I suspect it'll be similar.

United Kingdom
#6  

Will do. been waiting ages for this its gonna work whether it wants to or not

Canada
#7  

When you find the Datasheet go ahead and post the link here. That way we can all take a look at what is going on, and give you some guidance :)

United Kingdom
#9  

That'll do, I think... I only had a quick look as I really should be doing some work but when I get chance I'll have another look if you need it.

Look at page 11 and the last few pages, they should help you. From a very quick look it looks like it's a good datasheet which is half the battle.

United Kingdom
#10  

excellent thank you. knowing its a good start is a great help. I'll leave this thread unresolved for a bit incase anyone can advise a bit more if I get stuck

United Kingdom
#11  

Hi guys

Still can't figure out how to get this working confused its driving me nuts

United Kingdom
#12  

Have you tried with the latest ARC update, I briefly read the notes and noticed something about I2C Read being fixed... that may be something.

Other than that, what can't you do?

United Kingdom
#13  

No I haven't let it update yet actually. I do remember talking with DJ about some usefull things we could do with when it came to i2c and he mentioned there was some changes coming. I'll check it out now.

If it don't work with it it only cost my £3 including postage. No real loss. It works with other controllers like arduino but they have a dedicated library.

United Kingdom
#14  

All the commands are in the datasheet you linked to.

I2C Address for read is 0x3D so,

$raw = I2CRead(0, auto, 0x3D, 8)

should store the sensor values in the variable $raw.

United Kingdom
#15  

Ah right, thought you had to send request commands to it and such

United Kingdom
#16  

You may need to do some I2CWrites to initialise it and get it in the correct mode, the details are in the datasheet.

Where did you get it? I can always get one and have a play too, £3 isn't going to break the bank.

United Kingdom
#18  

@Jaychadw interested to know what you want a magnetometer for? If you have an Iphone the new sensor stream can display the Teslameter in 3 axis its kinda fun waving a magnet near my phone and watching the figures change. Very sensitive as well

#19  

Hi,

Old discussion but apparently no solution has been found. I'm also Struggling trying to use HMC5883L chip which crashes my EZB everytime I try to initialize it, using the EZB tutorial's script.

I get that I have to write something, using the datasheet but I can't figure what I'm suppose to send to this i2C device... what hex data am I suppose to write?

Well, I'm totally lost. I'd love my robots to know which direction they're heading though.

Rich? Any help? TheTechguru? Someone?:)