HMC5883L vs MPU-6050

I've spent more than an hour searching for the differences between those 2 sensors without result but with a lot of weird examples, rubbish and other mumbojumbo.

Am I correct when I say:

HMC5883L : Magnetometer (compass) and Gyro
MPU-6050: Gyro and Acc. meter?

So MPU no magnet and HMC no acc meter? In other words with the MPU I cannot make a compass?

If I am right, is it very hard to have those 2 work together?

The HMC5883L is a magnetometer, and is no longer being manufactured.

If you want to make a tilt-compensated compass, I recommend the LSM303D magnetometer/accelerometer. Pololu has code that will get you started.

It is extremely important that the magnetometer be properly calibrated, or it will be useless for a compass. The most comprehensive calibration tutorial is Tutorial: How to calibrate a compass (and accelerometer) with Arduino | Underwater Arduino Data Loggers.

I know that the hmc is end of sale but i have a few.

does the lsm also measure g-forces and gyro?

As you can see on the product page I linked, the LSM303D does not include a gyro. You don't need one to make a compass.

True but I need gyro in my project.

I would have to combine something. Right?

I have both 6050 and 5883. Before I buy the 303 I need some advice.

Needed:
Gps, I have Neo6m
Accelero
Gyro
Compass

I am not sure if a 1 chip fits all is the best way. It is for RC car and boat.

If you want advice about a project, describe the project.

jremington:
If you want advice about a project, describe the project.

I thought I was asking for advice on sensors. Because it wasnt clear to me what the difference between those 2 was/is. I appreciate that you give me an alternative but my question isnt answered.

Anyway, the project is not so complicated;

I want to log the heading (compass), location (gps), G-forces(accel) and tilt/roll/pitch(gyro) of a remote controlled vehicle. Outdoors.

This information will be written onto SD so I can read the data on my pc.

Maybe it is a bit older material but this is what I have around:

HMC5883L
MPU-6050
NEO-6M (GPS)

Although older, is this hardware useable?

This question was answered, but to be completely clear, the HMC5883L does NOT have a gyro.

HMC5883L : Magnetometer (compass) and Gyro

In other words with the MPU I cannot make a compass?

Correct.

So MPU no magnet and HMC no acc meter?

The MPU6050 has no magnetometer. The HMC5883L is a magnetometer.

is it very hard to have those 2 work together?

Not for some people, but that strongly depends on your preparation and coding skills.

Although older, is this hardware useable?

Yes.

Anyway, the project is not so complicated;

I suspect that you will find this to be an extremely difficult project, given that you are so unsure about the sensors you have. There are few, if any, Arduino project examples that combine those two particular sensors to determine body orientation (yaw, pitch and roll).

Since the information from the two sensors has to be combined to get body orientation, you will have a rather difficult problem just to mount the two modules and determine (and account for) their relative orientations.

I've spent more than an hour searching for the differences between those 2 sensors

It would have been much more productive and taken much less time to read the introductions in the sensor data sheets.

I did read it but I was confused because of this video about the 5883, it looks like it has gyro:

This guy uses the axis for something else than a compass. So I thought I could use it as a gyro.

Do you understand what I mean by watching (a part) of this video?

Videos can be entertaining but in my opinion, most are a waste of time.

The data sheets are almost always accurate and reliable.

I know, I know..

But these sensors are fairly new to me so after reading datasheets I try a few tutorials and codes to understand its working. This particular video put me on the wrong foot I guess.

What I am trying to achieve is (maybe I'd have to put this in another part of the forum?)

location and heading tracking during a day of driving outdoors with this RC car. At this point it is basically of no use but I want/need to learn so I can create a drive-back-to-me function when I get better at it. Next summer I want to implement this in boats as well so I can have them make preset routes on the water.

What I DO want/need now/coming weeks is:

I want to track/log how my car pitches and rolls and compare it to (for example) how much throttle/brake/steer I give the car.

I would also like to measure the G-Forces because when I read that the wheels are going @4000 RPM but there is no G force measured, it means that the car is spinning on at least 3 wheels. This way I can amend the setup of shocks, launch control etc.

For the RPM's per wheel I already have hall sensors working that detect RPM and they also monitor the difference between the various wheels and shafts. So, as long there are forces on the car, there is movement. If shafts/wheels are turning but there is no force, there is no grip.

Hall sensors and its calculations are pretty much under control (for now) but I could use some help understanding the other sensors mentioned.

If you happen to know good documents or video's about this, please share. I do not only want to copy/paste code for converting raw data to information but I really would like to understand why that code is made like it is.

Plan on months to a year or two of determined study, starting from scratch, to fully understand 3D sensors and the calculations required to determine yaw, pitch and roll, but one can start with this overview. A decent understanding of trigonometry and matrix algebra is required.

I suggest to buy the BNO055 absolute orientation sensor and use that for yaw, pitch and roll. It will also report any of the 9 individual sensor readings (3 each for gyro, accelerometer and magnetometer), if they are of interest. Not the most accurate of consumer grade 9DOF sensors, though. CHRobotics has better ones, for a price.

jremington:
Plan on months to a year or two of determined study, starting from scratch,

Why do I get the feeling that you're not taking me seriously? So all those kids on YT that have it figured out did these kind of studies?

I dont need the whole theory behind the theory, just enough understanding of the output of the things and how to convert it to real life information. I am not planning to invent the wheel again, I want to understand the wheel. Just fact vs fact, if this than that and maybe a LITTLE bit of the why so I can debug a bit.

Sorry I bothered. Good luck with your project.

jremington:
Sorry I bothered. Good luck with your project.

Please dont be offended that quickly. I hope you understand there is a difference between knowing/learning how to use a sensor instead getting a PHD on that subject?

Hi Sareno,

The issue is that 3D spatial orientation can become very mathematical, I imagine somewhat akin to video games programming.

Measuring rotational speed in terms of roll, pitch and yaw using a 3-axis gyroscope is straightforward enough. However measuring angular rotation of a body, which a first seems very similar, is actually quite a difficult problem to solve.

If a body is rotated in 3D space then needs to be with respect to a world reference point. Roll, pitch and yaw angles are not indepedent variables. For example you pitch up 45º, then yaw to the left 90º, you're now in 45º roll position. Measuring and estimating the angle requires sensor fusion of the gyroscope, accelerometer and magetometer data.

At a basic level it's possible do this either using Euler angles and some 3D trigonometry, or by employing more complex methods such as the Direction Cosine Matrix (DCM) or quaternion mathematics.

On the MPU6050 it's possible to either acquire the raw gyroscope and accelerometer data and process it using your own 3D rotation algorithms, or use its on-chip Digital Motion Processor (DMP) to provide the angles for you.

Here are some articles that I found useful:

http://www.geekmomprojects.com/gyroscopes-and-accelerometers-on-a-chip/

And for some quaternion mathematics:

Well, thank you sir!!! Karma!

Very good tutorial about the MPU-6050!!!

Hi Sareno,

Thanks for the link to the tutorial.

There's also some excellent videos about the MPU-6050 made by Joop Brokking for his Arduino based quadcopter, although the same principles apply to a land vehicle or boat. His video series also goes on to describe magnetometer, barometer and GPS implementation. His method uses the simpler and intuative Euler angle approach.

Here's a link to part 1 of the MPU-6050 tutorial: MPU-6050 6dof IMU tutorial for auto-leveling quadcopters with Arduino source code - YouTube.