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

Analog read shows non-linear behaviour #347

Open
elral opened this issue Jan 5, 2025 · 0 comments · May be fixed by #348
Open

Analog read shows non-linear behaviour #347

elral opened this issue Jan 5, 2025 · 0 comments · May be fixed by #348

Comments

@elral
Copy link
Collaborator

elral commented Jan 5, 2025

Using a potentiometer for reading the analog value shows that the values are not linear compared to the position of the potentiometer.
This was reported on discord

In the actual code a pin for reading analog values is initialized with pullups enabled. When connecting a potentiometer to the pin this internal resistor is always parallel to the "upper" part of the potentiometer. The internal pullup resistor is ~35kOhm.
The user who reported this issue used a 500kOhm potentiometer. If the pot is on the "upper" or "lower" end, the correct value is measured. An example for the mid position would be:
"upper" and "lower" part of the potentiometer is 250kOhm, parallel to the "upper" part is 35kOhm, the resulting value is 31kOhm which far away from the 250kOhm for mid position and a high non linearity.
For a 10kOhm Potentiometer it's quite better, the deviation in the mid position is "only" 3%. But it could be still visible espacially for closed loop controls of motorizes axis.

@elral elral self-assigned this Jan 6, 2025
@elral elral linked a pull request Jan 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant