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

Magic Number Explanation for S2/S3 ADC #2966

Open
Stwerp opened this issue Feb 11, 2025 · 0 comments
Open

Magic Number Explanation for S2/S3 ADC #2966

Stwerp opened this issue Feb 11, 2025 · 0 comments

Comments

@Stwerp
Copy link

Stwerp commented Feb 11, 2025

I am referencing this line:
return (pin.value * 3.1) / 61000. A similar line is in the S2 code.

The magic number is not explained. It would seem to imply that there is a 15.53 bit ADC? Or that a reference voltage is 3.1 V?

My guess is that the limitations of the ADC on these chips see espressif read the docs limits the range to 3.1 V, but I believe the reference being used on the feathers is still 3.3 V.

3.1 V / 3.33 V * 65535 ADC counts ~= 61008 counts

I assume this is where the values in the line come from ... but rounded ... so why not just use the more standard equation? That matches they physical reference, and is a power of 2. Otherwise, an explanation for these magic numbers and why this is there would be really helpful, especially in learning documents for people new to things like ADC.

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

No branches or pull requests

1 participant