Home » TLV493D magnetic sensor and ESP32 board example

TLV493D magnetic sensor and ESP32 board example

by shedboy71
ESP32 and TLV493D layout

In this article we look at a TLV493D magnetic sensor and we will connect it to an ESP32 development board, its a Lolin D32 pro but pretty much any ESP32 board will do.

First lets look at the sensor

The 3D magnetic sensor TLV493D offers accurate three-dimensional sensing with extremely low power consumption in a small 6-pin package.

With its magnetic field detection in x, y, and z-direction the sensor reliably measures three dimensional, linear and rotation movements.

Applications include joysticks, control elements (white goods, multifunction knops), or electric meters (anti tampering) and any other application that requires accurate angular measurements or low power consumptions.


• 3D magnetic sensing
• Very low power consumption = 10 µA during operations (10 Hz, typ.)
• Power down mode with 7 nA power consumption
• Digital output via 2-wire based standard I2C interface up to 1 MBit/sec
• 12-bit data resolution for each measurement direction
• Bx, By and Bz linear field measurement up to +130 mT
• Excellent matching of X/Y measurement for accurate angle sensing
• Variable update frequencies and power modes (configurable during operation)
• Supply voltage range = 2.8 V…3.5 V, Temperature range Tj = -40°C…125°C
• Triggering by external µC possible
• Interrupt signal available to wake up a microcontroller
• Temperature measurement


Parts Required


Name Link
Connecting cables



I used the Adafruit TLV493 sensor and in this case used the Stemma connection on the sensor

For the STEMMA QT cables, it uses the Qwiic convention:

Black for GND
Red for V+
Blue for SDA
Yellow for SCL

So color coded for ease of use, this layout shows a connection to the module

This example shows an Adafruit ESP32 board connected to the sensor

ESP32 and TLV493D layout

ESP32 and TLV493D layout

Code Example

This uses the library from Infineon installed using the Library Manager in the Arduino IDE. search for Infineon TLV493, and select theTLV493D-A1B6 library

This is the cartesian example which reads the X, Y, and Z axis measurements in milli-teslas (mT), there are a few examples to investigate

[codesyntax lang=”cpp”]

#include <Tlv493d.h>

// Tlv493d Opject
Tlv493d Tlv493dMagnetic3DSensor = Tlv493d();

void setup() 

void loop() {

  Serial.print("X = ");
  Serial.print(" mT; Y = ");
  Serial.print(" mT; Z = ");
  Serial.println(" mT");



Open the serial monitor and you should see something like this.



Infineon datasheet




You may also like

Leave a Comment

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.