- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
I evaluate TLE493D Magnetic Sensor.
I want to write code to calculate R, Phi and Theta just like infineon tool(Joystick View).
Please confirm “calc_R_Phi_Theta.PNG”.
I calculated with code of “code1.PNG”, but Phi value does not match the value of infineon tool.
The calculation results of R and Theta seem to match.
The calculation results are different only for Phi, and the angle seems to be off.
The calculation of code1 is the same as the calculation formula displayed in infineon tool.( atan(y/x) )
And when I changed the calculation formula, this calculation result and the value of infineon tool matched.
The calculation formula is code of “code2.PNG”.( atan(x/y) )
This formula is different from the formula displayed in infineon tool, with X and Y swapped.
Please tell me the formula when calculating Phi at infineon tool.
Best Regards.
YuMa
Solved! Go to Solution.
- Labels:
-
3D Hall Sensors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
Apologies for the delay !
It's actually a bug in the GUI and it will be fixed in the next update and as told before, please use the formula Phi = atan2(y,x) which is stated in the appnote.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
Please check Page 26-27 of this application note : https://www.infineon.com/dgdl/Infineon-3D_Magnetic_Sensor_Joystick-AN-v01_00-EN-AN-v01_00-EN.pdf?fil... for cartesian to spherical coordinates conversion formulas.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deepa-san.
I already know that there is a calculation formula in the application note.
The calculation formula of the application note is the same as the calculation formula displayed in infineon tool.
And it is the same as the first formula I implemented(“code1.PNG”).
However, there was a difference between the calculation result and the display of infineon tool(Joystick View).
As described in the first question, after changing the calculation formula(“code2.PNG”), the calculation result and the display of infineon tool matched.
Infineon may calculate Phi using a formula different from the one described in the application note.
Please tell me Phi calculation formula that infineon tool actually uses internally.
Unlike the application note, it looks like the X and Y coordinates are interchanged.
The formula it uses internally seems to be “Phi = atan2(x, y)”, not “Phi = atan2(y, x)”.
Please tell me the internal calculation formula that infineon tool(Joystick View) is actually doing.
Best Regards.
YuMa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
You're right, the phi value is calculated by atan2(x,y) in the GUI. That means the angle value of phi will be 90° phase shifted because sine (=y-value) and cosine(=x-value) are also shifted by 90°.
However, the official definition of the atan2-function is atan2(y,x), so the AppNote is right in that sense.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deepa-san.
Thank you for your support.
I have additional questions.
Please confirm below.
Q1)
Why is there a difference between the formula in the application note and the formula actually used by infineon tool?
Q2)
Which formula should the customer use when using Magnetic Sensor?
atan2(y, x)? Or atan2(x, y)?
Best Regards.
YuMa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
For your 1st question, we are looking into it from our side and will soon get back to you.
As for the formula you should use, it should be Phi = atan2(y,x).
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deepa-san.
Can you update this thread?
Best Regards.
YuMa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
Apologies for the delay !
It's actually a bug in the GUI and it will be fixed in the next update and as told before, please use the formula Phi = atan2(y,x) which is stated in the appnote.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deepa-san.
Thank you for your support.
Do you have any information at this time, such as the planned date of the next update?
Best Regards.
YuMa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @YuMa_1534086 ,
The date of release isn't fixed yet. Do look out for the update.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deepa-san.
Thank you for your response.
I understand.
Best Regards.
YuMa