Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the bug in the getAngleSpeed function #16

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Fixed the bug in the getAngleSpeed function #16

merged 1 commit into from
Jul 12, 2021

Conversation

djaumann
Copy link
Contributor

Fixed the bug inside the getAngleSpeed function mentioned in #15.

Was already tested on hardware by @9Volts9er.

Copy link

@9Volts9er 9Volts9er left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this with the TLE5012B MS2Go kit. It works perfectly fine now.

With numOfData = 0x5; the speed value had some strange values and did not react to speed changes. With numOfData = 0x6; it works as expected.

I even printed out the values of rawData[5]. As expected it gave me random-like numbers for numOfData = 0x5;, but with numOfData = 0x6; I always get 0x0801 which equals the correct standard configuration for the sensor (360° angle range and prediction disabled).

@akfheaven
Copy link

I try readAngleSpeedRevolutions.ino with IDLE motor.
But The angle_speed data seems get a lot of huge noise like my log below.
I don't know if it's only behavior on my chip..

init done!
AngleSpeed AngleValue revolutions AngleRange
0.00 -57.18 11 360.00
-385.94 -57.15 11 360.00
0.00 -57.08 11 360.00
0.00 -57.11 11 360.00
0.00 -57.12 11 360.00
0.00 -57.08 11 360.00
-128.65 -57.14 11 360.00
0.00 -57.11 11 360.00
-128.65 -57.17 11 360.00
0.00 -57.12 11 360.00
-128.65 -57.18 11 360.00
-128.65 -57.12 11 360.00
0.00 -57.17 11 360.00
257.29 -57.15 11 360.00
128.65 -57.13 11 360.00
0.00 -57.13 11 360.00
0.00 -57.17 11 360.00
-128.65 -57.10 11 360.00
-128.65 -57.24 11 360.00
0.00 -57.16 11 360.00
0.00 -57.10 11 360.00
0.00 -57.15 11 360.00
-128.65 -57.13 11 360.00
0.00 -57.15 11 360.00
0.00 -57.11 11 360.00
-128.65 -57.13 11 360.00
-257.29 -57.13 11 360.00
-128.65 -57.12 11 360.00
128.65 -57.22 11 360.00
0.00 -57.07 11 360.00
0.00 -57.14 11 360.00
0.00 -57.10 11 360.00
-128.65 -57.13 11 360.00
0.00 -57.17 11 360.00
0.00 -57.17 11 360.00

@9Volts9er
Copy link

The noise you see on the speed value is not unusually high. 128.65 °/s is equal to 1 LSB of the Speed register in the sensor.
So actually you have just a few LSB noise.
And for motor applications I think 128.65°/s = 21.44 RPM is not a very high speed.
But if this is too much for your application, you can average the value over multiple readouts, then the noise will decrease

@akfheaven
Copy link

@9Volts9er Thanks for the detailed explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants