uploaded 1 year ago
I2C driver for MAG3110 3-axis digital magnetometer


# Component: MAG3110

[![Component Registry](https://components.espressif.com/components/espressif/mag3110/badge.svg)](https://components.espressif.com/components/espressif/mag3110)

* I2C driver and definition of MAG3110 3-axis digital magnetometer
* See [datasheet](https://www.nxp.com/docs/en/data-sheet/MAG3110.pdf)

## Instructions and details
* Interrupt mode via `INT` pin is not supported. User must periodically read the data
* Before reading new data from MAG3110 a calibration is encouraged to eliminate infulences of hard-iron and PCB
* During the calibration, user must rotate the sensor in every axis to guarantee accurate calibration

## Code snippet
#include "mag3110.h"

mag3110_result_t mag_induction; // in units of 0.1[uT]

mag3110_handle_t mag3110_dev = mag3110_create(I2C_NUM_1);
mag3110_calibrate(mag3110_dev, 10000);
mag3110_start(mag3110_dev, MAG3110_DR_OS_10_128);

mag3110_get_magnetic_induction(mag3110_dev, &mag_induction);
ESP_LOGI("MAG3110 snippet", "mag_x:%i, mag_y:%i, mag_z:%i", mag_induction.x, mag_induction.y, mag_induction.z);


Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif/mag3110^1.0.7"

or download archive


  • Downloaded in total
    Downloaded in total 3.4k times
  • Downloaded this version
    This version: 1.3k times


espressif/mag3110 version: 1.0.7