hello,
i recently bought a mpu 9150
its has a gyroscope accelometre and compass
idk how to use the first two but i want to use the compass
i made a program that reads the data coming from the compass and display them on the monitor and i got these reading
mx =-8 my = -70 mz =-32
where mx is the reading of x axis m y is reading of y axis etc
can u help me by telling me what are those readings? what do they efer to? degrees or something else? and how can a compass read the z axis?
how to turn them in a useful degrees?
thanks for the links but i
thanks for the links but i have already been there
i am now getting reading from the compass but i dont know how to turn them into degrees…
any idea? my regards
What kind of data are you getting?
Without seeing the data, telling you how to adjust it is difficult. I am a bit surprised if you are using a lib that you don’t have the option to format the output in a useful manner.
RTFDS!
Please, always read the funny datasheets. And the datasheet was available from the mail page of the github repository that you gave us a URL to. If you want help, please put the datasheet URLs on your query.
It is important to learn to read datasheets.
As far as I can see, the library you are using is decoding the ambient magnetic field in the x, y, z components using units of micro Teslas, which is a more natural way of measuring a magnetic field.
Have you studied any physics at all? I ask because of your question implying the impossibility of the z axis for the magnetic field. The magnetic field is not something that is normal to (that is is 90 degrees to) the z component of the gravitational field. The magnetic field surrounds all magnets, both artificial and natural and is distorted by most metals.
I cannot give you a simple equation to convert micro-Tessa’s to degrees, but you can do that yourself. Of course it will only work when far enough away from your robot.
- Hold your magnetometer absolutely and measure the three measurements. Compare to an accurate compass until both are on straight North. Save the readings.
- Now move the compass and the magnetometer the same amount, perhaps 10 degrees. Save and repeat until you’re back at 0 degrees again.
- Now make a table to convert the reading to whatever units you prefer.
Of course, this will only work when far enough from your robot’s electric motors.
Or go find another library for the 9050. It an extremely popular chip because it’s very inexpensive so I’m willing to bet somebody else has done the work so you don’t have to understand the chip.
thanks for ur replyi am
thanks for ur reply
i am using this library because its the library posted by the manufacturer company but i think i will search for another one
and u mean by seeing the data u want me to paste a picture for u over here?
regards
thanks for ur answer and yes
thanks for ur answer and yes i studied physics
i know that the magnetic field surrounds the magnet but what i dont know is how can a compass read the z axis and what is the z axis actually
if north is up and south is down where does the x axis point to? the center of the earth? thats my question
and its 9150 not 9050
i will try to look for another library and if u have a library that has a better easier output feel free to post it
Sorry I got the number
Sorry I got the number wrong, but I’ve never used that device, but rather similar ones.
If you’ve studied physics and don’t understand that an electromagnetic field is really in 3 dimensions (if not more, but let’s stick with 3) then I have no idea about what other major misconceptions you are laboring under that I might as well not bother. Just as gravity and rotation are also in three dimensions, so is magnetism.
The north and south poles in a compass are a simplifications so we can use 2 dimensional maps. You will need to read the datasheet or talk with your instructor on how to turn micro Henries into a more compass-like reading. The devices I’ve used have already done much of this for me. One problem with any magnetometer is that the largest magnets on a robot will probably be the motors. This will distort the reading unless you can compensate for it. I don’t bother; I usually only read the magnetetometer when the motors are off or the magnetometer is away from the motor. It’s best if you don’t think Compass directions until you understand more about magnetic fields.
If you’re asking for help here, please help us. Many of us have little time to do basic research for you.
- Give us links to the product, it’s datasheet, and anything else useful on it.
- Include your formatted code as a text file.
- Include formatted output also as a text file.
- Make sure there is a good shot of the device both top and bottom, and one or more with your wireing.
- A quick list of other resources you’ve already used (Google searches, the datasheet, looking up the unit Henry in Wikapedia, etc.)
Until then we are just guessing. And why should we be familiar with your device unless you make an effort to make us familiar with it?
Heck, you still haven’t even said what processor you’re using and that could matter a lot!
If you can find out this information, it might help you to an answer yourself, or make it easier for the best people who can answe your question to do so.
I am also recommend adding the new information to your first post in the thread by editing it.
thanks for ur answer i will
thanks for ur answer i will add more to my questions but i dont really how to ask questions and u gave me a boost
as i mentioned i know that the magnetic field is in three diesminsions but i dont know how can the z axis can be useful for me thats all
thanks for ur answer and i will edit my post shortly