TMAG5273 Sparkfun have no value for data on x,y,z axis

I connect the TMAG5273 directly on the arduino mega 2560. It can show the data but the data is always around 0 even if I move the magnet next to it.

The code I use is the same as the code shown in the github:

It would be so nice if someone can help me with it. Thank you!

Are you following the hookup guide?

Here are some things it might be:

  1. Wiring: Ensure that the TMAG5273 is correctly wired to the Arduino Mega 2560. The SDA and SCL pins should be connected to the appropriate I2C pins on the Mega, which are pins 20 (SDA) and 21 (SCL). Share a photo if the suggestions below don’t fix it first
  2. I2C Bus: The Arduino Mega 2560 has multiple I2C buses. By default, the Wire library uses the I2C bus on pins 20 and 21. If you’re using different pins, you may need to use ‘Wire1’ instead of ‘Wire’
  3. Sensor Configuration: Check if the sensor is properly configured. The TMAG5273 has configurable ranges and sensitivities. Make sure the range is set appropriately for your application.
  4. Magnet Strength: The sensor’s output depends on the strength of the magnetic field. If the magnet is too weak or too far from the sensor, it may not register significant changes.
  5. Code Modification: You might need to adjust the code to increase sensitivity or change the measurement range. The registers “MAG_OFFSET_CONFIG_1” and “MAG_OFFSET_CONFIG_2” can be used to modify the sensor’s behavior.

To troubleshoot:

  1. Double-check all connections, ensuring the TMAG5273 is correctly wired to the Arduino Mega 2560.
  2. Verify that you’re using the correct I2C bus in your code. If using pins other than 20 and 21, modify the code to use Wire1 instead of Wire…also run i2cdetect or similar
  3. Try increasing the sensitivity of the sensor by modifying the configuration in the setup function of your Arduino sketch.
  4. Use a stronger magnet or bring it closer to the sensor to see if you can detect any changes in the readings.
  5. Add debug print statements in your code to ensure that the sensor is being initialized correctly and that you’re receiving data from it.

Thank you for your help.
Below is my circuit. (I don’t need to use pull up resistors right? ) and I didn’t connect disable and INT pins.

I used Arduino I2C detector to detect the device and the address is 0x22. So I suppose it connected successfully.
I used NdFeB N52 magnet for this system. However, even though I put if just next to the sensor, the output still looks like this:
(-0.05, -0.86, 0.65) mT

28.74 C

(0.02, 0.29, 0.22) mT

28.74 C

(-0.70, 0.86, 0.43) mT

28.74 C

(-0.61, -0.02, -0.61) mT

28.74 C

(0.95, 0.49, 0.46) mT

28.74 C

(0.02, 0.63, 0.47) mT

28.74 C

(-0.83, -0.31, -0.12) mT

28.74 C

(0.16, 0.20, -0.82) mT

28.74 C

(-0.16, -0.27, 0.23) mT

15.92 C

(-0.90, -0.90, 0.90) mT

28.74 C

(0.52, 0.12, 0.35) mT

28.74 C

Could you give me more hint on this? Thank you.

PS: could you also explain more about the sensor configuration and code modification part? how to increase the sensitivity and change the offset? I didn’t find very good information for that.

For more information, I use HMC5883L to test the field and the magnetic field can reach to around 100mT when I move magnet closer to the sensor. So it’s very weird to have no data on TMAG5273.

Hello Russell, I follow the hookup guide and it can not work. I’ve uploaded my circuit in this post. Can you help me check it? Thank you.

You readings actually match the example
Data stream in the serial monitor

I think the units might be wrong, though? it looks like those are some scalar from -1:1?

It might need some attention Issues · sparkfun/SparkFun_TMAG5273_Arduino_Library · GitHub

But it didn’t change in some pattern at all. So I think it’s not because of the scale. Could you help me check the circuit? Thank you.

  1. Mount the sensor, preferably AWAY from sources of EMF
  2. Run a calibration routine
  3. Re-test

and see how that goes

Thank you for your reply.
Sorry I didn’t fully understand it. The source of EMF, does it mean the Arduino? And the calibration routine is which one? And do I have some method to increase the sensitivity or change the offset of the sensor?
So sorry to ask so many questions. I’m still newbie in electronics.
Thank you so much for your kind help.