TLV493D magnetic sensor and ESP32 board example

ESP32 and TLV493D layout
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
ESP32 ESP32 ESP32-WROOM-32 Lua WIFI IOT Development Board
TLV493D ADA Adafruit (PID 4366) TLV493D Triple-Axis Magnetometer – Stemma QT/Qwiic
Connecting wire Male to Male + Male to Female and Female to Female Jumper Wire Dupont Cable



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

#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




Previous articleThe FeatherS2 NEO an ESP32 board in Feather format
Next articleHTU31 Humidity and Temperature Sensor and ESP32 board example