The Adafruit HMC5883L is a surface-mount, multi-chip module designed for low-field magnetic sensing with a digital interface for applications such as low-cost compassing and magnetometry. The HMC5883L includes our state-of-the-art, high-resolution HMC118X series magneto-resistive sensors plus an ASIC containing amplification, automatic degaussing strap drivers, offset cancellation, and a 12-bit ADC that enables 1° to 2° compass heading accuracy. The I²C serial bus allows for easy interface.
Explore Projects Built with Adafruit HMC5883L Triple-axis Magnetometer
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit connects an HMC5883L compass module to an Arduino Uno R3 for the purpose of reading magnetic field data. The Arduino is programmed to initialize the compass module, continuously read its X, Y, and Z magnetometer data, and output the readings to the Serial Monitor. The compass module is interfaced with the Arduino via I2C communication, using the SDA and SCL lines, and powered through the Arduino's VIN pin.
This circuit connects an Adafruit LSM303DLHC Triple-axis Accelerometer+Magnetometer (Compass) to an Arduino Board Ethernet using I2C communication protocol. The SCL and SDA pins of the sensor are connected to the A5 and A4 pins of the Arduino, respectively, for serial clock and data transfer. The sensor is powered by the Arduino's 5V output, and both devices share a common ground.
This circuit features an Arduino Mega 2560 microcontroller interfaced with multiple VL53L0X distance sensors, an OV7725 camera module, and an Adafruit LIS3MDL triple-axis magnetometer. The Arduino reads data from these sensors and the camera, likely for a robotics or environmental sensing application, and processes the data for further use or transmission.
This circuit consists of an Arduino UNO R4 WiFi connected to an Adafruit LIS3DH Triple-Axis Accelerometer via I2C communication. The Arduino reads acceleration data from the LIS3DH sensor and outputs it to the serial monitor for further analysis or processing.
Inaccurate Readings: Ensure that the magnetometer is calibrated and that there are no nearby magnetic sources affecting the readings.
No Data on I²C: Check the connections and ensure pull-up resistors are in place. Also, verify that the correct I²C address is being used.
Solutions and Tips for Troubleshooting
Calibration: Perform a calibration routine to account for any magnetic interference in your environment.
Connection Issues: Double-check wiring, solder joints, and ensure that the microcontroller's I²C lines are functioning correctly.
FAQs
Q: What is the I²C address of the HMC5883L?
A: The default I²C address of the HMC5883L is 0x1E.
Q: Can the HMC5883L be used with a 5V microcontroller?
A: Yes, but a level shifter is recommended for the I²C lines to ensure compatibility with the HMC5883L's voltage levels.
Q: How do I know if the HMC5883L is functioning correctly?
A: Run the testConnection() method in the setup routine to verify communication with the device. If it returns true, the device is functioning correctly.
Q: How often should I calibrate the magnetometer?
A: Calibration should be performed whenever the device is placed in a new environment or if there is a significant change in the surrounding magnetic field.