Lis3mdl hexadecimal addres?

Hello, I can’t find the hexadecimal address of the magnetometer chip of my newly purchased pololu lis3mdl (non-smd).
It is said that this address is written on the module, but when I check the written number or letter groups from the product datasheet, it seems irrelevant.
Can you help with this issue?


As described in the “I2C communication” section of the LIS3MDL product page description, the slave address is 0011110b (0x1E) by default. Alternatively, you can drive the SA1 pin low to set the second-least significant bit to 0 changing the slave address to 0011100b (0x1C) .

Could you tell me where you read that the address would be written on the module?

- Patrick

Hi Patrick, Thanks for the reply. Generally, it is said to be written on the components placed on the module. For example, it says gy-80 and gy-521 as well.

Also, can I ask one more thing?
I need to connect 3 modules that will do i2c communication. my microcontroller is esp32 and i am using arduino ide platform.
In lis3mdl and other modules I also need to select adaptive peak performance values.
It seems possible to make adjustments in the .ccp, .ccp.bak and ccp.bak.bak files in the lis3mdl file.
So I’ve pasted below a section that is the same in all 3 files.
Even if I made a change in this section, it was not accepted on the ide side.
I may have done something wrong.
Any chance of editing?
So can you change it for ultra high?

Enables the LIS3MDL's magnetometer. Also:
- Selects ultra-high-performance mode for all axes
- Sets ODR (output data rate) to default power-on value of 10 Hz
- Sets magnetometer full scale (gain) to default power-on value of +/- 4 gauss
- Enables continuous conversion mode
Note that this function will also reset other settings controlled by
the registers it writes to.
void LIS3MDL::enableDefault(void)
  if (_device == device_LIS3MDL)
    // 0x70 = 0b01110000
    // OM = 11 (ultra-high-performance mode for X and Y); DO = 100 (10 Hz ODR)
    writeReg(CTRL_REG1, 0x70);

    // 0x00 = 0b00000000
    // FS = 00 (+/- 4 gauss full scale)
    writeReg(CTRL_REG2, 0x00);

    // 0x00 = 0b00000000
    // MD = 00 (continuous-conversion mode)
    writeReg(CTRL_REG3, 0x00);

    // 0x0C = 0b00001100
    // OMZ = 11 (ultra-high-performance mode for Z)
    writeReg(CTRL_REG4, 0x0C);

If you want to configure the settings on the LIS3MDL differently then I would suggest using the writeReg function from our library in your Arduino program instead of editing the library files. You can do this after calleing enableDefault to override the default settings. For example, if you want to reconfigure the sensitivity range of the sensor to ±16 gauss, you would write something like this:

// 0x60 = 0b01100000
// FS = 11 (+/- 16 gauss full scale)
mag.writeReg(LIS3MDL::CTRL_REG2, 0x60);

- Patrick

1 Like

That was very good information. It really made my job easier. So what do I need to do for the “ultra high performance” option in the code below?

// 0x70 = 0b01110000
// OM = 11 (ultra high performance mode for X and Y); DO = 100 (10 Hz ODR)
writeReg(CTRL_REG1, 0x70);

The enableDefault function in our LIS3MDL library configures the sensors for ultra-high-performance mode. If you want to reconfigure it to operate in one of the lower performance modes, then you could use the writeReg function similar to how I suggested in my last post; you would just write to a different register. You can find more information about the registers in the “Registers description” section (7) of the LIS3MDL datasheet.

- Patrick

Thanks Patrick