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

wrong temperature value with 100k NTC #2500

Closed
hamed-ta opened this issue Jan 21, 2022 · 7 comments
Closed

wrong temperature value with 100k NTC #2500

hamed-ta opened this issue Jan 21, 2022 · 7 comments

Comments

@hamed-ta
Copy link
Contributor

hamed-ta commented Jan 21, 2022

Hello,

I use 100k NTC and a downstream resistor of 10K ohm, to read the LED board temperature, my configs and parameters are as below:

#define SENSOR_SUPPORT     1
#define NTC_SUPPORT        1
#define NTC_BETA           3950
#define NTC_R_UP           0
#define NTC_R_DOWN         10000
#define NTC_R0             100000

but what I read in 25C room temperature is about 80 Celsius, what is the problem?

here is the NTC that I use:
Screen Shot 2022-01-21 at 19 40 56

here is my circuit:
Screen Shot 2022-01-21 at 19 43 24

and what I read in room temp:

Screen Shot 2022-01-21 at 19 45 55

other configs:

#ifndef ANALOG_SUPPORT
#define ANALOG_SUPPORT                  0
#endif

#ifndef ANALOG_SAMPLES
#define ANALOG_SAMPLES                  10      // Number of samples
#endif

#ifndef ANALOG_DELAY
#define ANALOG_DELAY                    0       // Delay between samples in micros
#endif

//Use the following to perform scaling of raw analog values
//   scaledRead = ( factor * rawRead ) + offset
//
//Please take note that the offset is not affected by the scaling factor

#ifndef ANALOG_FACTOR
#define ANALOG_FACTOR                    1.0       // Multiply raw reading by this factor
#endif

#ifndef ANALOG_OFFSET
#define ANALOG_OFFSET                    0.0       // Add this offset to *scaled* value
#endif

// Round to this number of decimals
#ifndef ANALOG_DECIMALS
#define ANALOG_DECIMALS                  2
#endif
@mcspr
Copy link
Collaborator

mcspr commented Jan 26, 2022

Physical down & up values might be off? This is c/p from the sensor code
https://godbolt.org/z/qPd3vcTjf
https://godbolt.org/z/8qMn568Kr
Should the downstream resistance be 100k as well?

433     350.95  77.8

where ADC reading of 433 aka 0.42V results in your number. you can see the result when chancing the Down or Up resistances (in ohm)

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
@hamed-ta
Copy link
Contributor Author

hamed-ta commented Apr 29, 2022

This still doesn't work in the latest commit, I checked everything, measured resistances, and even calculate the NTC Beta, but still, this calculates the wrong temp.

what should be the problem?

Screen Shot 2022-04-29 at 18 43 31
Screen Shot 2022-04-29 at 18 35 35
Screen Shot 2022-04-29 at 18 35 44

@stale stale bot removed the stale label Apr 29, 2022
@mcspr
Copy link
Collaborator

mcspr commented Apr 30, 2022

^ see the godbolt link above with the code reproducing the values from the sensor, and how things change depending on the rdown value (constants at the top)
shouldn't it be 100k down as well?

@hamed-ta
Copy link
Contributor Author

hamed-ta commented May 2, 2022

^ see the godbolt link above with the code reproducing the values from the sensor, and how things change depending on the rdown value (constants at the top) shouldn't it be 100k down as well?

No, the R down can't be 100K because in that way the divided voltage would be higher than 1V which ADC can measure.

@mcspr
Copy link
Collaborator

mcspr commented May 2, 2022

What voltage are you seeing right now, with 10k and with 100k?

@hamed-ta
Copy link
Contributor Author

hamed-ta commented May 2, 2022

What voltage are you seeing right now, with 10k and with 100k?

In room temp (26 Celcius), it's about 0.39V which is correct, and the corresponding ADC value is about 416 which is correct so the problem can only be the temp calculation.

Screen Shot 2022-05-02 at 20 44 20

@mcspr mcspr closed this as completed in 1b49326 Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants