“The 3-Axis HMC5883L Compass Module is designed for low-field magnetic sensing with a digital interface. This compact sensor fits into small projects such as UAVs and robot navigation systems. The sensor converts any magnetic field to a differential voltage output on 3 axes. This voltage shift is the raw digital output value, which can then be used to calculate headings or sense magnetic fields coming from different directions.”
Here is a photo of the HMC5883L mounted on the Rover. Since it is affected by magnetic fields such as those generated by electronics and motors, it’s been mounted on a wooden dowel to distance it somewhat from the Rover. This way I can test with some assurance I’m decreasing interference from the Rover components. After extensive testing, I plan on repeating the tests with the HMC5883L mounted on the Rover.
The HMC5883L must be calibrated before you can use it. Here are two photos of the compass readings. Square is pointing North, so Rover should be showing East 90 degrees.
The first is showing the uncalibrated reading (showing incorrect 54 degrees), the second shows the reading after proper calibration has been performed (showing correct 90 degrees).
Thanks. I’ll play with that and see what a difference it makes in my readings.
I was aware of all the theory from the owners manual of my old Nissan Pathfinder ( pre-GPS, talking about how to calibrate the onboard digital compass ), so I was pleased when my simple calibration worked “good enough” here. It depends where you live.
I have no illusions that my current readings would, say, find a downed airliner in the Indian ocean, but I can trust it enough to drive the Rover around the room , ha ha.
The calibration largely depends on the geography. While calibrating we always need to take care of - Declination, Inclination, North Intensity, East Intensity, Horizontal Intensity, Vertical Intensity, and total Intensity.
Here is the program that will allow you to calibrate your HMC5883L. Once properly calibrated, your compass will give accurate-ish readings, useful for your attempts at coding complicated navigation tasks.
This is just a calibration program, nothing more. Instructions on calibrating are in the program.