Skip to content

Magic Number Explanation for S2/S3 ADC #2966

Open
@Stwerp

Description

@Stwerp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions