TMAG5173-Q1: Angle result deflection on rotary application

Part Number: TMAG5173-Q1
Other Parts Discussed in Thread: TMAG5173EVM

Tool/software:

Hi,

I am using this sensor for angle measurement in rotary application for XY.

I am using example code. I am getting weird result for angle like in these pictures.

angle: Sensor angle results
angleA: calculated with atan2f(By,Bx)
angleC: calculated calcCORDIC()

All angle results are matching. Mechanical angle is ±30 degree.  

For some mechanical angles there is deflection in angle results. I have changed mechanics, but it still has deflection in random angles and random times.

What can be the problem?

Which magnetic channel setting should I choose for absolute angle calculation?( XY,XYX,YXY or other)

Thanks

  • Hi Mesult,

    Thank you for posting to the Sensors forum!

    Are you seeing this deflection throughout the full 360 degrees of rotation (or the full range of rotation of what your application is if it's not doing a full 360 spin)? Or is it the case that this deflection is only seen in one spot? 

    Have you tried increasing the device's sampling rate (via the CONV_AVG bit in DEVICE_CONFIG_1) to see if this helps? What are your current device configuration settings?

    Best,

    ~Alicia

  • Hi Alicia,

    Thank you for your answer.

    Our application is limited to 240-300 degrees. I see deflections on random places. But a lot of these are in about limit points as you can see in the first post. 240, 270, 300 degrees. 

    I am currently using 8x average. increasing sample rate to 32x average reduced the deflections. But still has it. 

    In our angle calculations, atan2 and calcCORDIC, there is no deflections.

    My current init code is:

    void init()
    {
      TMAG5x73disableInterruptModes();
    
      TMAG5x73disableMaskINTpin();
    
      TMAG5x73disableTemperatureMeasurement();
    
      TMAG5x73enableMagChannels(MAG_CH_EN_XYX);
    
      TMAG5x73enableAngleMeasurement(ANGLE_EN_X1stY2nd);
    
      TMAG5x73setTempCoefficient(MAG_TEMPCO_SmCo);
    
      TMAG5x73setSampleRate(CONV_AVG_8xAverage);
    
      TMAG5x73setRanges(RANGE_80mTor266mT, RANGE_80mTor266mT);
    }

    I have another question about CORDIC algorithm. What is the angle resolution for in chip algorithm and calcCORDIC() function? 

    Thanks

  • Hi Mesut,

    The angle resolution for the TMAG5173-Q1 is 1/16 or 0.0625 given Equation 14 in the datasheet should the stored fractional value be b0001, as shown below.

    Regarding the resolution of the calcCORDIC function, this is going to be based off of the sensitivity errors of the relevant channels (X & Y) as well as the sensitivity mismatch as specified in the datasheet, snippet of A1 is shown below. 

    Regarding the deflection that you are seeing, are you seeing it on multiple devices or just the one? Also are you using your own PCB or the TMAG5173EVM?

    Best,

    ~Alicia

  • Hi Alicia,

    Thank you for your answer.

    I have only one pcb on this configuration.

    I have a custom pcb and magnet like in this picture below.

    Our magnet is SmCo, H24, 3/6/9mm. 

    Could you please try on the evaluation board and check if it has deflection or not?

    Thanks,

  • Hi Mesut,

    Just to make sure that I have the correct magnet movement, the magnet is just being slightly twisted from side-to-side, correct?

    Best,

    ~Alicia

  • Hi Alicia,

    My problem does not resolved. I accidentally clicked. 

    Here is the technical drawing of our magnet.

    Thanks

  • Hi Mesut,

    My question has more to do with the way that the magnet moves. Given the previous descriptions, it sounds as though the magnet is moving similar to the below with the sensor being placed beneath the magnet, is this correct?

    I just wanted to verify this to make sure was the correct movement .

    Assuming that the above rotation is correct, I was able to use a bar magnet that I had on hand to replicate this movement above the EVM and collect the following plots using the GUI:

    And while there is some noise (which can be attributed to any potential shakiness with my hand as I slightly rotated the magnet), there does not appear to be any deflection.

    Best,

    ~Alicia

  • Hi Alicia,

    Thank you for your answer.

    I want to ask what is your settings when getting these measurement? 

    What is the impact of magnetic channel selection when calculating angle?( XY,XYX,YXY) Which one should I use for absolute angle calculation?

    I also noticed that the example code triggers conversion on every measurement readings. Would this cause a problem on angle calculation? 

    I read the all results on one trigger and there is no deflection.

    Thanks

  • Hello Mesut,

    Alicia is out of office until next week so I am not certain what settings she used for her measurements above but I can certainly help you with the rest of your questions.

    1. What is the impact of magnetic channel selection when calculating angle?( XY,XYX,YXY) Which one should I use for absolute angle calculation?
      1. Any of these configurations will work for angle calculation. The selection of XY, XYX, or YXY determines the order in which the magnetic samples are collected and since the samples are not collected simultaneously this could introduce errors for angle calculations so the pseudo simultaneous capture of this data reduces the possibility of this error.  
    2. I also noticed that the example code triggers conversion on every measurement readings. Would this cause a problem on angle calculation? 
      1. This shouldn't cause any issues on the calculation since its relatively fast, it it just means a new angle measurement will be calculated everytime the data is read from the device. You can certainly change this to trigger in a different method if that is more suitable for your application.

    I am not sure what you mean by there is no deflection comment above.

    Best,

    Isaac