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, address=94, addr_reg=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
magnetic

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