# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Overview

Info: This guide is for both the A1 and A2 variants. Both use the exact same firmware and pinout. The A1 type has a ±40mT / ±80mT range and the A2 has a wider ±133mT / ±266mT range.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/097/medium800thumb/adafruit_products_6489-05.jpg?1773928884)

Primary: This sensor is meant for sensing rotation or motion of an object nearby with a magnet embedded inside. It is not meant for measuring the magnetic field of the earth.

The **Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout** is a low-power linear 3D Hall-effect sensor designed for a wide range of industrial and personal electronics applications. It integrates three independent Hall-effect magnetometer sensors in the X, Y, and Z axes for full 3D orientation detection. The built-in 12-bit ADC can read the signal from each axis for read-out over I2C, it even has a thermometer built in for basic temperature reading!

![](https://cdn-learn.adafruit.com/assets/assets/000/143/098/medium800/adafruit_products_6490-01.jpg?1773928994)

An integrated angle calculation engine (CORDIC) provides full 360° angular position information for both on-axis and off-axis angle measurements. The angle calculation is performed using two user-selected magnetic axes over I2C. The TMAG also features magnetic gain and offset correction - note you'll have to manage the values and write them into the chip on boot-up.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/099/medium800/adafruit_products_6489-04.jpg?1773929014)

3D Hall effect sensors are great for sensing rotation or motion of an object nearby with a magnet embedded inside: often used for magnetic rotary encoders or joysticks that don't have mechanical switches and thus are more reliable and don't fail from wear.

This sensor comes in two flavors, the **A1** type is ±40mT / ±80mT range (you can pick either range), and the **A2** has a wider ±133mT / ±266mT range. Both use the exact same firmware and pinout - the firmware we've written can detect which one you have plugged in and automatically scale the readings as necessary. This isn't a great sensor for measuring the magnetic field of the earth, much better for magnets of the ferric or rare-earth persuasion.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/100/medium800/adafruit_products_6489-02.jpg?1773929030)

To make life easier so you can focus on your important work, we've taken the TMAG5723 and put it onto a breakout PCB along with support circuitry to let you use this little wonder with 3.3V (Feather/Raspberry Pi) or 5V (Arduino/ Metro328) logic levels. Additionally, since it speaks I2C, you can easily connect it up with two wires (plus power and ground!). We've even included [SparkFun qwiic](https://www.sparkfun.com/qwiic) compatible **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)** connectors for the I2C bus so **you don't even need to solder!** Just wire up to your favorite micro and you can use our CircuitPython/Python or [Arduino drivers to easily interface with the TMAG](https://github.com/adafruit/Adafruit_TMAG5273) and get magnetic measurements ASAP.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/101/medium800/adafruit_products_6489-03.jpg?1773929047)

It's fully assembled and tested. Comes with a bit of 0.1" standard header in case you want to use it with a breadboard or perfboard. Four 2.5mm (0.1") mounting holes for easy attachment.

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Pinouts

Info: This guide is for both the A1 and A2 variants. Both use the exact same firmware and pinout. The A1 type has a ±40mT / ±80mT range and the A2 has a wider ±133mT / ±266mT range.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/191/medium800/adafruit_products_double.jpg?1774273994)

The default I2C address is **0x35**.

## Power Pins

- **VIN** - this is the power pin. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V. For a 3.3V microcontroller, use 3.3V.
- **3Vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like.
- **GND** - common ground for power and logic.

## I2C Logic Pins

- **SCL**** &nbsp; **- I2C clock pin, connect to your microcontroller I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a&nbsp;** 10K pullup**&nbsp;on this pin.
- **SDA**** &nbsp; **- I2C data pin, connect to your microcontroller I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a&nbsp;** 10K pullup**&nbsp;on this pin.
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-&nbsp;**These connectors allow you to connect to dev boards with&nbsp; **STEMMA QT** &nbsp;connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204).

## Interrupt Pin

- **INT** - This is the interrupt pin. It can be configured as an input or an output.

## Power LED

- **Power LED -** In the upper left corner, above the STEMMA QT connector, on the front of the board, is the power LED, labeled **on**. It is a green LED.

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## CircuitPython and Python

It's easy to use the&nbsp; **TMAG5273** &nbsp;with Python or CircuitPython, and the&nbsp;[Adafruit\_CircuitPython\_TMAG5273](https://github.com/adafruit/Adafruit_CircuitPython_TMAG5273) module. This module allows you to easily write Python code that allows you to read the **TMAG5273** magnetometer. You can use this magnetometer with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

Primary: This sensor is meant for sensing rotation or motion of an object nearby with a magnet embedded inside. It is not meant for measuring the magnetic field of the earth.

Featured
### High-strength 'rare earth' magnet

[High-strength 'rare earth' magnet](https://www.adafruit.com/product/9)
Yow! These things are super powerful. .47" diameter and .18" thick discs. Great for use with your SpokePOV Kit. If you have an aluminium frame, use tape/foam sticky tape to attach it.

Out of Stock
[Buy Now](https://www.adafruit.com/product/9)
[Related Guides to the Product](https://learn.adafruit.com/products/9/guides)
![Angled Shot of the High-strength 'rare earth' magnet.](https://cdn-shop.adafruit.com/640x480/9-04.jpg)

## CircuitPython Microcontroller Wiring

First, wire up an TMAG5273 to your board exactly as shown below. Here's an example of wiring a Feather RP2040 to the TMAG5273 with I2C using one of the handy&nbsp;[**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;connectors:

- **Board STEMMA 3V** to **breakout STEMMA&nbsp;**** VIN (red wire)**  
- **Board STEMMA GND** to **breakout**  **STEMMA** **GND (black wire)**  
- **Board STEMMA SCL** to **breakout**  **STEMMA** **SCL (yellow wire)**  
- **Board STEMMA SDA** to **breakout**  **STEMMA** **SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/201/medium640/adafruit_products_feather_stemma_bb.jpg?1774280271)

You can also use standard&nbsp; **0.100" pitch** &nbsp;headers to wire it up on a breadboard:

- **Board 3V** to **breakout** **VIN (red wire)**  
- **Board GND** to **breakout** &nbsp;**GND (black wire)**  
- **Board SCL** to **breakout** **SCL (yellow wire)**  
- **Board SDA** to **breakout** **SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/202/medium640/adafruit_products_feather_bb_bb.jpg?1774280297)

## Python Computer Wiring

Since there's&nbsp;_dozens_&nbsp;of Linux computers/boards you can use, below shows wiring for Raspberry Pi. For other platforms,&nbsp;[please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired to the magnetometer using I2C and a&nbsp;[**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;connector:

- **Pi 3V** to **breakout STEMMA** **VIN (red wire)**  
- **Pi GND** to **breakout**  **STEMMA** **GND (black wire)**  
- **Pi SCL** to **breakout**  **STEMMA** **SCL (yellow wire)**  
- **Pi SDA** to **breakout**  **STEMMA** **SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/203/medium640/adafruit_products_piStemma_bb.jpg?1774280338)

Finally, here is an example of how to wire up a Raspberry Pi to the magnetometer using a solderless breadboard:

- **Pi 3V** to **breakout** **VIN (red wire)**  
- **Pi GND** to **breakout** &nbsp;**GND (black wire)**  
- **Pi SCL** to **breakout** &nbsp;**SCL (yellow wire)**  
- **Pi SDA** to **breakout** &nbsp;**SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/205/medium640/adafruit_products_piBB_bb.jpg?1774280463)

## Python Installation of TMAG5273 Library

You'll need to install the&nbsp; **Adafruit\_Blinka** &nbsp;library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `pip3 install adafruit-circuitpython-tmag5273`

If your default Python is version 3, you may need to run&nbsp;`pip`&nbsp;instead. Make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython Usage

To use with CircuitPython, you need to first install the TMAG5273 library and its dependencies into the&nbsp; **lib** &nbsp;folder on your&nbsp; **CIRCUITPY** &nbsp;drive. Then you need to update&nbsp; **code.py** &nbsp;with the example script.

Thankfully, we can do this in one go. In the example below, click the&nbsp; **Download Project Bundle** &nbsp;button below to download the necessary libraries and the&nbsp; **code.py** &nbsp;file in a zip file. Extract the contents of the zip file, and copy the&nbsp; **entire&nbsp;**** lib **&nbsp;** folder **&nbsp;and the&nbsp;** code.py **&nbsp;file to your&nbsp;** CIRCUITPY**&nbsp;drive.

Your&nbsp; **CIRCUITPY/lib** &nbsp;folder should contain the following folders and file:

- **adafruit\_bus\_device/**
- **adafruit\_register/**
- **adafruit\_tmag5273.mpy**

![CIRCUITPY drive](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/tmag5273_tmag5273_simpletest.py.png )

## Python Usage

Once you have the library&nbsp;`pip3`&nbsp;installed on your computer, copy or download the following example to your computer, and run the following, replacing&nbsp; **code.py** &nbsp;with whatever you named the file:

`python3 code.py`

## Example Code

**If running CircuitPython:** &nbsp;Once everything is saved to the&nbsp; **CIRCUITPY** &nbsp;drive,&nbsp;[connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console)&nbsp;to see the data printed out!

**If running Python:&nbsp;** The console output will appear wherever you are running Python.

https://github.com/adafruit/Adafruit_CircuitPython_TMAG5273/blob/main/examples/tmag5273_simpletest.py

In the example, the temperature sensor is&nbsp;instantiated on I2C. Then,&nbsp;in the loop, the X, Y and Z readings from the magnetometer, along with temperature readings, are printed to the serial console every second. This sensor is meant for sensing rotation or motion of an object nearby with a magnet embedded inside. It is not meant for measuring the magnetic field of the earth.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/231/medium800/adafruit_products_Screenshot_2026-03-23_160541.png?1774296355)

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Python Docs

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Arduino

Using the TMAG5273 magnetometer&nbsp;with Arduino involves wiring up the magnetometer to your Arduino-compatible microcontroller, installing the&nbsp;[Adafruit\_TMAG5273](https://github.com/adafruit/Adafruit_TMAG5273)&nbsp;library and running the provided example code.

Primary: This sensor is meant for sensing rotation or motion of an object nearby with a magnet embedded inside. It is not meant for measuring the magnetic field of the earth.

Featured
### High-strength 'rare earth' magnet

[High-strength 'rare earth' magnet](https://www.adafruit.com/product/9)
Yow! These things are super powerful. .47" diameter and .18" thick discs. Great for use with your SpokePOV Kit. If you have an aluminium frame, use tape/foam sticky tape to attach it.

Out of Stock
[Buy Now](https://www.adafruit.com/product/9)
[Related Guides to the Product](https://learn.adafruit.com/products/9/guides)
![Angled Shot of the High-strength 'rare earth' magnet.](https://cdn-shop.adafruit.com/640x480/9-04.jpg)

## Wiring

Wire as shown for a&nbsp; **5V** &nbsp;board like an Uno. If you are using a **&nbsp;3V** &nbsp;board, like an Adafruit Feather, wire the board's 3V pin to the TMAG5273 VIN.

Here is an Adafruit Metro wired up to the TMAG5273 using the STEMMA QT connector:

- **Board 5V** to **breakout STEMMA** **VIN (red wire)**  
- **Board GND** to **breakout**  **STEMMA** **GND (black wire)**  
- **Board SCL** to **breakout**  **STEMMA** **SCL (yellow wire)**  
- **Board SDA** to **breakout**  **STEMMA** **SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/198/medium640/adafruit_products_metroSTEMMA_bb.jpg?1774279647)

Here is an Adafruit Metro wired up using a solderless breadboard:

- **Board 5V** to **breakout** **VIN (red wire)**  
- **Board GND** to **breakout** &nbsp;**GND (black wire)**  
- **Board SCL** to **breakout** &nbsp;**SCL (yellow wire)**  
- **Board SDA** to **breakout** &nbsp;**SDA (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/143/199/medium640/adafruit_products_metroBB_bb.jpg?1774279668)

## Library Installation

You can install the **Adafruit TMAG5273** library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/194/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1774275282)

Click the **Manage Libraries ...** menu item, search for **Adafruit TMAG5273** , and select the **Adafruit TMAG5273** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/143/195/medium800/adafruit_products_Screenshot_2026-03-23_101836.png?1774275575)

If asked about dependencies, click " **Install all**".

![](https://cdn-learn.adafruit.com/assets/assets/000/143/196/medium800/adafruit_products_Screenshot_2026-03-23_101916.png?1774275595)

If the "Dependencies" window does not come up, then you already have the dependencies installed.

Warning: If the dependencies are already installed, you must make sure you update them through the Arduino Library Manager before loading the example!

## Example Code
https://github.com/adafruit/Adafruit_TMAG5273/blob/main/examples/simpletest/simpletest.ino

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. You should see that the sketch has found your connected TMAG5273 sensor. It will also print out the variant type (A1 or A2). Then, you'll see the X, Y and Z readings along with the temperature reading printed to the Serial Monitor every second. This sensor is meant for sensing rotation or motion of an object nearby with a magnet embedded inside. It is not meant for measuring the magnetic field of the earth.

![](https://cdn-learn.adafruit.com/assets/assets/000/143/230/medium800/adafruit_products_Screenshot_2026-03-23_152723.png?1774294064)

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Arduino Docs

# Adafruit TMAG5273 3D Hall Effect Magnetometer Breakout

## Downloads

## Files

- [TMAG5273 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/143/092/original/tmag5273.pdf?1773926789)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-TMAG5273-3D-Hall-Effect-Magnetometer-Breakout-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20TMAG5273%203D%20Hall%20Effect%20Magnetometer%20Breakout.fzpz)

## Schematic and Fab Print
Info: The A1 and A2 variants have identical schematics and board layouts. The only difference is the silkscreen.

### A1
![](https://cdn-learn.adafruit.com/assets/assets/000/143/094/medium800/adafruit_products_schem_a1.png?1773927144)

![](https://cdn-learn.adafruit.com/assets/assets/000/143/093/medium800/adafruit_products_fab_a1.png?1773927157 dimensions are in inches)

### A2
![](https://cdn-learn.adafruit.com/assets/assets/000/143/095/medium800/adafruit_products_schem_a2.png?1773927301)

![](https://cdn-learn.adafruit.com/assets/assets/000/143/096/medium800/adafruit_products_fab_a2.png?1773927315 dimensions are in inches)


## Primary Products

### Adafruit TMAG5273 (A1) 3D Hall Effect Magnetometer Breakout

[Adafruit TMAG5273 (A1) 3D Hall Effect Magnetometer Breakout](https://www.adafruit.com/product/6489)
The **Adafruit TMAG5273 (A1) 3D Hall Effect Magnetometer Breakout** is a low-power linear 3D Hall-effect sensor designed for a wide range of industrial and personal electronics applications. It&nbsp;integrates three independent Hall-effect magnetometer sensors in the X, Y, and Z...

In Stock
[Buy Now](https://www.adafruit.com/product/6489)
[Related Guides to the Product](https://learn.adafruit.com/products/6489/guides)
### Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer

[Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer](https://www.adafruit.com/product/6490)
The **Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer Breakout** is a low-power linear 3D Hall-effect sensor designed for a wide range of industrial and personal electronics applications. It&nbsp;integrates three independent Hall-effect magnetometer sensors in the X, Y, and Z...

In Stock
[Buy Now](https://www.adafruit.com/product/6490)
[Related Guides to the Product](https://learn.adafruit.com/products/6490/guides)

## Guide Products

### High-strength 'rare earth' magnet

[High-strength 'rare earth' magnet](https://www.adafruit.com/product/9)
Yow! These things are super powerful. .47" diameter and .18" thick discs. Great for use with your SpokePOV Kit. If you have an aluminium frame, use tape/foam sticky tape to attach it.

Out of Stock
[Buy Now](https://www.adafruit.com/product/9)
[Related Guides to the Product](https://learn.adafruit.com/products/9/guides)

## Related Guides

- [Tree with Animated Eyes and Motion Sensor](https://learn.adafruit.com/tree-ent-sculpture-with-animated-eyes.md)
- [Zelda Guardian Robot Terrako Companion](https://learn.adafruit.com/terrako.md)
- [Magic Storybook with ChatGPT](https://learn.adafruit.com/magic-storybook-with-chatgpt.md)
- [3D Printed Fabric Face Mask Clips](https://learn.adafruit.com/filti-face-mask.md)
- [Annoy-O-Matic Sound Prank Device](https://learn.adafruit.com/annoy-o-matic-sound-prank-device.md)
- [Ocean Epoxy Resin Lightbox with RGB LED Matrix Image Scroller](https://learn.adafruit.com/ocean-epoxy-resin-lightbox-with-rgb-led-matrix-image-scroller.md)
- [Adafruit AS5600 Magnetic Angle Sensor](https://learn.adafruit.com/adafruit-as5600-magnetic-angle-sensor.md)
- [Musical Walking Stick with Circuit Playground](https://learn.adafruit.com/musical-cane-walking-stick.md)
- [Robotic Creatures ](https://learn.adafruit.com/robotic-creatures.md)
- [micro:bit Lesson 1. Using the Built-in Sensors](https://learn.adafruit.com/micro-bit-lesson-1-using-the-built-in-sensors.md)
- [TRON DISC](https://learn.adafruit.com/trondisc.md)
- [Combo Dial Safe with Circuit Playground Express](https://learn.adafruit.com/combo-dial-safe-with-circuit-playground-express.md)
- [HalloWing Jump Scare Trap](https://learn.adafruit.com/hallowing-jump-scare-trap.md)
- [Adafruit ESP32-S2 Feather](https://learn.adafruit.com/adafruit-esp32-s2-feather.md)
- [Adafruit 555 PWM Output STEMMA](https://learn.adafruit.com/adafruit-555-pwm-output-stemma.md)
