Skip to content

QMC5883L Magnetometer

The qmc5883l allows you to use your QMC5883L triple-axis magnetometers (datasheet) with ESPHome. This sensor is very similar to the HMC5883L sensor and is often found as a knock off replacement. The QMC5883L sensor performs on par to the HMC5883L sensor, though the configuration differs. The I²C Bus is required to be set up in your configuration for this sensor to work.

QMC5883L Magnetometer.
# Example configuration entry
sensor:
- platform: qmc5883l
address: 0x0D
field_strength_x:
name: "QMC5883L Field Strength X"
field_strength_y:
name: "QMC5883L Field Strength Y"
field_strength_z:
name: "QMC5883L Field Strength Z"
heading:
name: "QMC5883L Heading"
temperature:
name: "QMC5883L Temperature"
filters:
- offset: 34.0
range: 200uT
oversampling: 512x
update_interval: 60s
data_rate: 200Hz
drdy_pin: GPIOXX
  • address (Optional, int): Manually specify the I²c address of the sensor. Defaults to 0x0D.

  • field_strength_x (Optional): The field strength in microtesla along the X-Axis. All options from Sensor.

  • field_strength_y (Optional): The field strength in microtesla along the Y-Axis. All options from Sensor.

  • field_strength_z (Optional): The field strength in microtesla along the Z-Axis. All options from Sensor.

  • heading (Optional): The heading of the sensor in degrees. All options from Sensor.

  • temperature (Optional): The temperature of the sensor. Per the datasheet: “Temperature sensor gain is factory-calibrated, but its offset has not been compensated, only relative temperature value is accurate”. Above example has an offset that you need to calibrate. All options from Sensor.

  • range (Optional, enum): The range parameter for the sensor.

  • oversampling (Optional, enum): The oversampling parameter for the sensor.

  • update_interval (Optional, Time): The interval to check the sensor. To achieve the highest date rate of 200Hz this can be set to zero when drdy_pin is configured. Defaults to 60s.

  • id (Optional, ID): Manually specify the ID used for code generation.

  • drdy_pin (Optional, Pin): The data ready pin. It is recommended to connect the data ready pin when using a low update_interval.

  • data_rate (Optional, enum): The data rate parameter for the sensor.

By default, the QMC5883L data rate is 200Hz. You can, however, configure this amount. Possible values:

  • 200Hz (default)
  • 100Hz
  • 50Hz
  • 10Hz

NOTE

To achieve the maximum data rate, configure drdy_pin and set update_interval to zero.

By default, the QMC5883L sensor measurement range is 200µT. You can, however, configure this amount. Possible values:

  • 200µT (default)
  • 800µT

By default, the QMC5883L sensor measures each value 512 times when requesting a new value. You can, however, configure this amount. The result is the sensor will take the adverage of the x samples. Possible sampling values:

  • 512x (default)
  • 256x
  • 128x
  • 64x