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


Component: MAG3110

Component Registry

  • I2C driver and definition of MAG3110 3-axis digital magnetometer
  • See datasheet

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: add-dependency "espressif/mag3110^1.0.7"

or download archive


  • ESP-IDF >=4.0
  • Stats

    • Downloaded in total
      Downloaded in total 2.0k times
    • Downloaded this version
      This version: 37 times


    espressif/mag3110 version: 1.0.7 |