HMC5883L Compass Readings Not Updating

I am using the in-built HMC5883L compass on the BN-880 GPS Module (https://www.amazon.com/Geekstory-Navigation-Raspberry-Aircraft-Controller/dp/B078Y6323W). To get compass readings I am using the example Adafruit code. However, recently my compass readings never change, no matter where I point the compass. I have already calibrated the compass and it worked fine for a while, but now the values won't update. I have tried using different HMC5883L libraries, but they all do the same thing or say they don't detect a valid compass. I have also tried QMC5883L libraries, but had no luck with those. My wiring is:

SDA - A4
SCL - A5
TX - 0
RX - 1
VCC - 5V
GND - GND

Did I do something wrong with my wiring, or is my compass just not working?

Probably but you need to post an annotated schematic, showing exactly how you have wired it with links to technical information on all the hardware items that may be connected. Be sure to show Power, Grond, Poser sources etc.

I just followed this site's tutorial. I did everything exactly as shown.

I do not have the time to search the internet for your schematic. Your link shows a frizzy, not a schematic. I do not do well with word problems or frizzys. Maybe somebody will be able to help.

Okay, I figured out the issue. For anyone else who has this issue, all you need to do is add
if (!mag.begin()) { while (1); }
in your void setup()
It initializes the sensor or something, I'm not totally sure. Also, it turns out my BN-880 compass did burn out, and I figured out you need this line after getting a new compass and having the same issue, so if you are using a BN-880, maybe don't connect it to 5v.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.