I see you are using the Steinhart-Hart equation, very nice!
I follow what your code does except could you explain this equation please?
var ohms=10000*val/(1-val);
It seems like there should be a factor of 1023 in there somewhere (see here) and maybe something for the voltage too (see here), but perhaps I just don't understand it all (haven't actually tried it myself yet).
Currently, val is some number between 0 and 1023. Lets see what happens to val/(1-val) for some example values:
I think you see that something must be wrong here. I am thinking val needs to be normalized to a fraction of 1, ie, something like val/1023.
Also, I am curious how you went about calculating A, B, and C, ie, how did you stabilize and accurately measure the 3 temperature points as well as the 3 resistance values at those temperatures?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I see you are using the Steinhart-Hart equation, very nice!
I follow what your code does except could you explain this equation please?
It seems like there should be a factor of 1023 in there somewhere (see here) and maybe something for the voltage too (see here), but perhaps I just don't understand it all (haven't actually tried it myself yet).
Currently, val is some number between 0 and 1023. Lets see what happens to val/(1-val) for some example values:
I think you see that something must be wrong here. I am thinking val needs to be normalized to a fraction of 1, ie, something like val/1023.
Also, I am curious how you went about calculating A, B, and C, ie, how did you stabilize and accurately measure the 3 temperature points as well as the 3 resistance values at those temperatures?
Thanks!