![]() |
SparkFun TMAG5273 Arduino Library
v1.0.3-44-g48e0e80
Library for the SparkFun TMAG5273 Arduino Library
|
This is the SparkFun Arduino library for the Texas Instruments TMAG5273 low-power linear 3D Hall-effect sensor with I2C interface.
This SparkFun Arduino Library for the Texas Instruments TMAG5273 linear 3D Hall-effect sensor provides access to the core functionality of the sensor. The sensor itself includes three Hall-effect sensors, providing readings around the X, Y and Z axes of the device.
The Texas Instruments TMAG5273 is available on the following SparkFun breakout development boards:
SparkFun Arduino Library for the TMAG5273 provides access to the a majority of the functionality provided by the the TMAG5273 device. This includes:
0x22The TMAG5273 supports several advance features that this library does not support. These are namely:
| Feature | Notes |
|---|---|
| CRC Communication Checks | This library contains a method to enable and disable this feature on the device, but the I2C communication implemented by the library will not read or check any provided CRS values |
| I2C Read/Write Methods | The TMAG5273 supports different format options for I2C operations. While this library provides a method to change the I2C configuration on the device, this library only uses standard I2C operations |
While the library include configuration methods for the above features, these features are not supported. The methods are maintained only to provide backward compatibility with earlier versions (< 2.0) of this library.
Version 2.0 of this library involved a large "refactor" of the library to address existing issues, improve the overall implementation and form a foundation for easier library maintenance in the future. As part of this effort, several existing library methods were modified such that they are not backward compatible with earlier (1.*) library versions. These changes include the following:
readWakeUpAndSleepData() no longer takes pointers as parameters. References are used to simplify use.float type parameters and return values, now use int8_t types to reflect the actual sensor data.The first step is to add the class named TMAG5273 to the implementation. An example of how to declare the sensor object is as follows:
In the startup section of the implementation, the sensor is initialized by calling the begin() method with the address of the sensor and the Arduino Wire port to use.
Note: If using the defaults, the begin method can be called with no parameters.
At this point the sensor can be configured for your specific use.
Values from the sensor are read as follows:
| Reference | Description |
|---|---|
| Quick Reference | A quick reference API for the the main library object |
| Full Documentation | The full documentation and API for this Arduino library |
| SparkFun Hall-Effect Sensor - TMAG5273 | Hardware GitHub Repository |
| Hall-Effect Sensor Hook Up Guide | Hardware Overview and Quick Start for the SparkFun Hall-Effect Sensor - TMAG5273 |
| SparkFun IoT Brushless Motor Driver (ESP32 WROOM, TMC6300) | Hardware GitHub Repository |
| SparkFun IoT Brushless Motor DriverHook Up Guide | Hardware Overview and Quick Start for the SparkFun IoT Brushless Motor Driver |
The following examples are provided with the library
| Example | Description |
|---|---|
| Basic Readings | Shows basic sensor setup and value reading |
| Interrupt Triggered Reading | Demostraights how to use a interrupt to trigger data reading |
| Angle Calculations | Setting up and reading Angle Calculations from the sensor |
| I2C Address Setting | How to change the I2C address of the sensor |
| IOT Motor Driver Readings | Using the TMAG5273 with the SparkFun IoT Brushless Motor development board |
This product is open source!
This product is licensed using the MIT Open Source License.