TLV493D magnetic sensor and ESP8266 example using the Arduino IDE

In this article we look at a TLV493D magnetic sensor and we will connect it to a Wemos Mini

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 List

Here are the parts I used

Name Links
Wemos Mini
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

ESP8266 and TLV493D layout
ESP8266 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.

X = 0.00 mT; Y = 0.00 mT; Z = -0.10 mT
X = -0.20 mT; Y = 0.10 mT; Z = 0.00 mT
X = 0.29 mT; Y = 0.00 mT; Z = 0.00 mT
X = -0.10 mT; Y = 0.10 mT; Z = 0.00 mT
X = -0.10 mT; Y = 0.00 mT; Z = 0.00 mT


Infineon datasheet






Please enter your comment!
Please enter your name here