Code Monkey home page Code Monkey logo

Comments (2)

miguel5612 avatar miguel5612 commented on June 13, 2024 1

Hello,

Your observation is correct in the sense that there are 1024 possible values the ADC can take, ranging from 0 to 1023 (inclusive). However, the formula you mentioned:

v = ADC * A0_max_voltage / 1023

Is correct and is widely used when converting ADC readings to voltages. The reason why it's divided by 1023 instead of 1024 is because you're looking for a range that goes from 0 to A0_max_voltage. So, when the ADC reads 1023 (its maximum value), you want that to translate into the maximum voltage. If you divided by 1024, an ADC reading of 1023 would be slightly less than the maximum voltage, which wouldn't be correct.

As for your question about whether a different value can be set on the ADC, it will depend on the board and development platform you're using. Some microcontrollers allow you to configure the ADC resolution, which would change the range of values it can take. In the case of the ESP8266, the ADC resolution is fixed and cannot be changed. The ESP8266's ADC has a 10-bit resolution, which means it outputs 1024 (2^10) different values.

Can you provide me with an example of ADC whose minimum value is not zero to consider the change to 1024 in the library?

from mqsensorslib.

voblaunsane avatar voblaunsane commented on June 13, 2024

you are right!

from mqsensorslib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.