Very simple and high accuracy temperature measurement with the SMT 172 / FORTH / Prop2
Hi folks,
even if this FORTH forum is quite dead, a small peace of code for extreme simple temperature measurement. For about 40 years there is the SMT 172 (former SMT 160) temperature sensor around.
Its output is not analog nor I2C but a PWM modulated signal. The sensor accuracy is better then ±0.06°C (range +10°C to +40°C) and the power consumption about 60 µA.
The total temperature range is -45°C to +130°C.
The data sheet you may find at:
https://sensorsandpower.angst-pfister.com/fileadmin/products/datasheets/276/SMT172_1650-21914-0013-E-0224.pdf
You need only one pin aside the power supply (3.3V and GND) and you can easily connect 16 of the sensors to the Propeller 2 w/o any add. hardware or interfaces. it gives the temperature between -45°C and + 130°C With our (loved and hated) TAQOZ 2.8 the software is incredible simple.
Here an example, the sensor is connected to pin 30. The integration time is 0.1 s. It prints the temperature with 7 decimal places. For faster measurements juts reduce the number in the word SMT.
Still missing the output in Fahrenheit, Kelvin or whatever ... should be not sooo difficult.
Disadvantage: the price of the sensor is about 6 ... 8 €/$
P.S. I am in no relation to the manufacturer, just a user.
( 30 := SMTPIN \ f. SMT 172 3.3 V green, GND = bn, signal = white )
pub SMTINIT ( -- )
SMTPIN PIN
;
\ there are 2 methods to claculate the temperature from the PWM
\ the linear calculation SMTLIN (linear calculation) and the slightly more accurate
\ SMTQUAD with a second order equation
\ the measurment length in us gives a kind of integration time.
\ as longer the time, as more stable the temperature signal.
pub SMTLIN ( meas_length_us -- temp 10_7 )
RAWFREQ? ( clocks states periods )
DROP
\ duty = states * 100_000 / clocks
SWAP 100_000 SWAP
*/ DUP
\ CRLF ." Duty = " 2 .DP ." %" CRLF ( clocks periods )
\ T = 212,77 * DC - 68,085
21277 *
\ Erg : 919_166_400 = 91,91
680_850_000 -
\ 68,085 -
." Temp = " 2 .DP ." C" CRLF
;
pub SMTQUAD ( meas_length_us -- temp 10_7 )
RAWFREQ? ( clocks states periods )
DROP
\ duty = states * 100_000 / clocks
SWAP 100_000 SWAP
\ CRLF ." SWAP 100_000 SWAP " CRLF
*/ DUP
\ CRLF ." Duty = " 2 .DP ." %" CRLF ( clocks periods )
\ T = 212,77 * DC - 68,085
DUP DUP *
100000 /
-143 *
SWAP
21456 * +
\ Erg : 919_166_400 = 91,91
686_000_000 -
\ 68,6 -
." SMT:TEMP:+ " 2 .DP ." ;" CRLF
;
\ measure the temperature with the second order equation.
\ the printout is the temperature in Clesius with 2.7 digits
pub SMT ( -- )
!SP
SMTINIT
100000 SMTQUAD
;


Comments
Thanks!
)))
((( While I have not posted in this part of the forum, I was rather busy using Forth. And I don't understand why Taqoz should be hated, as it is a very nice, useful and powerful contribution to the P2 community.
Cheers Christof
FORTH forum dead ? Not really. Just sits tight. I am yet to know a single Taqoz user, who hates it.
Thanks for posting about this sensor. I can't see it available at the usual (big) vendors. Where can I get one to play with ?
Hi Friends,
there is no synonym in English I guess for the German word Hassliebe (hate-love-relation). So its more like "why have I been so stupid to love this exotic beast TAQOZ, why not simply SPIN or C ....???"
Regarding the sensor in the USA: I have seen it on Amazon USA, as Chinese clone (?), I fear.
Digikey is offering it in different housings but for 10$ add. handling fee + 8 days extra delivery time:
https://www.digikey.com/en/products/detail/angst-pfister-sensors-and-power-ag/SMT172-TO92/17827919
The manufacturer has an office in the US:
info.apus@angst-pfister.com
Tel. +1 (440) 375-5212
...seems to be such an exotic European thing, I fear...
Markus