adafruit_tlv493d

CircuitPython helper library for the TLV493D 3-axis magnetometer

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_tlv493d.TLV493D(i2c_bus: I2C, address: int = 94, addr_reg: int = 0)

Driver for the TLV493D 3-axis Magnetometer.

Parameters:
  • i2c_bus (I2C) – The I2C bus the device is connected to

  • address (int) – The I2C device address. Defaults to 0x5E

  • addr_reg (int) – Initial value of the I2C address register. Defaults to 0.

Quickstart: Importing and using the device

Here is an example of using the TLV493D class. First you will need to import the libraries to use the sensor

import board
import adafruit_tlv493d

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
tlv = adafruit_tlv493d.TLV493D(i2c)

Now you have access to the magnetic attribute

acc_x, acc_y, acc_z = tlv.magnetic
property magnetic: Tuple[float, float, float]

The processed magnetometer sensor values. A 3-tuple of X, Y, Z axis values in microteslas that are signed floats.