SPI Magnetometer compass module

I’ve been trying to get a compass module to work in a project.

So far I’ve tried LSM303 and HMC5983 modules.

I use 4wire SPI.

I can get reading from the devices, and have spent a lot of time, with help from other forums, for programming and calculations. I’m fairly sure that I have been getting it right at least sometime, but I’ve haven’t been able to get correct results so far.

Suspecting that the modules themselves, may be not correct (Ebay!) I am next going to try these modules: GY-511.

The GY-511 modules have 14Pin magnetometer chips on the board. I’m trying to get the Data sheet for these chips.

Can anyone help or give me any results from these modules please?


Magnetometers must be carefully calibrated to be useful.

If you have not done that, study this overview: https://thecavepearlproject.org/2015/05/22/calibrating-any-compass-or-accelerometer-for-arduino/

If your eBay rejects don’t work at all, consider buying a magnetometer from Pololu, which provides excellent product support. Note: I don’t work for them.

Hi J,
I’m waiting to set the module up properly before calibrating, as it’s on a test PCB.
My results seem farther out then a calibration problem, and I hoped to find someone who knows how to add the ‘X’ component here.

If I can’t get any of my different Ebay modules to work, I will indeed buy from Pololu.

Thanks, C.