Greetings - I have this working and the x and y axes read as expected depending on the orientation. The z axis reads 2g when resting flat, 0g when upside down, and 1g when resting on any of the x or y sides. In other words, the z axis always read 1g too high. Is this a common problem? Do I not understand how this is supposed to work, or, have I damaged it, or, is the part defective? Thank you for your time.
All magnetometers need to be calibrated to be useful. Yours has a rather severe Z offset, but that is not uncommon. At the minimum you need to estimate offsets and scale factors for each axis.
Simple procedure to calibrate a related magnetometer: https://appelsiini.net/2018/calibrate-magnetometer/
Much better, but more complicated procedure for another one: https://forum.pololu.com/t/correcting-t … eter/14315