Fun with NTCs
I'm toying with WS2812B muti colored LEDs and wanted to do a "smart" thermometer with them.
At first i used a DHT11/12 i2C temperator/humidity sensor, but they are far from perfect.
They use the i2c bus (or a weird custom protocol) , the accuracy is far from good and they are not so cheap (2$).
Then i realised : I'm using a bluepill with a fairly good ADC converter (as seen on the DSO shell series), let's directly use a NTC resistor.
Good thing i had a broken hotend printer head from the i3, so i extracted the thermistor named '3950/100k'
After looking around, here is what i've found :
* The "3950" part is the beta coefficient , actually it is -3950 as it is a NTC
* The 100k is the resistance at 25 degrees C
The formula is
Beta= TxTref x ln (Rref/R) / (T-Tref)
which can be inverted as
alpha= -beta / ln( Rref/R)
Temp = alpha *(K+25)/(K+25+alpha) -K
with K=273.15
So we have beta = -3950, Rref=100k, Tref=25
How do we measure R ?
Simple we use a resistor divider with a known value , for example 200k
The Adc will measure value V at PB1 and the resistance value is
R= 200 * V/(4095-V)
You can use other resistance value, you just have to know the value accurately
Since it is a relative value, we don't care about the actual Vcc.
And the result ?
Good ! Only one resistor, fairly accurate (+- 0.5 degree) and dirt cheap
So overall, much better than the original DHT1x sensor. The only thing we lose is humidity.
NB : Price = ~ 1$ for 5 NTC thermistor on ebay, Ebay link
Comments
Post a Comment