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
Wrong sensor resistance calculation #2
Comments
Why should it be unnecessary? If you have a look at the official web site you can see that they use the same formula |
The formula in the tutorial is for the voltage on the analog pin, but we are calculating resistance (of the one member of the voltage divider): Sensor resistance and
where
We can replace
or
The formulas for a voltage divider are described e.g. here. |
Very good explanation, thank you! I wonder why this issue is open for over one year!? |
After recalculation I agree, the 5V should vanish. Even simpler: Dimension analysis reveals, that within the bracket there should be no units. |
Are there any another well-known mistakes in the GeorgeK’s code? Do you know the best fork? |
I am also trying this code and using the following formula: I get between 330 and 410ppm in the office where I am working. |
I'm also currently maintaining a fork. Is there any consensus yet on how the correct formula should look like? Unfortunately, I don't have a sensor module here to test it (ironically). @lorf's explanation definitely makes sense though. Another point that has bothered me for quite some time is that the ADC resolution is hard-coded here and thus only works if you use a 10-bit ADC. I don't think there is a way to read the used ADC resolution set via |
the ADC resolution depends of you VCC value, because analogReadResolution() return the tension depending of VCC. In my project I use 5volts. |
It seems that formula for calculating sensor resistance in getResistance() has an error, 5.0 multiplier (probably analog reference voltage) is unnecessary. The formula should read:
The text was updated successfully, but these errors were encountered: