Measuring Temperature Using the Onboard Sensor
Scamp1 (Rev C) and Scamp2 computers have a footprint for an optional onboard PCT2075 temperature sensor (not included), which can be fitted by the user. Scamp3 computers have a STLM75 sensor included. The datasheet for the Scamp2 sensor can be found here: https://www.nxp.com/docs/en/data-sheet/PCT2075.pdf.
The datasheet for the Scamp3 sensor can be found here: www.st.com/resource/en/datasheet/stlm75.pdf Both sensors are software compatible with each other. Dictionary support for this sensor is included in the Scamp's BSP. |
The sensor is mapped to I2C address $48 on a Scamp3.
|
The sensor is compatible with the common LM75 temperature sensors, but with increased accuracy. Note that the sensor measures the temperature of the PCB to which it is attached, which may not be exactly the same as local ambient weather conditions.
The word:
The word:
temp
reads the sensor over the I2C bus and returns two values to the stack. The values are the (integer) temperature in degrees Celsius, and the fractional temperature in milli degrees Celsius.
For example, if temp returned 25 750, then the temperature reading is 25.750°C.
For example, if temp returned 25 750, then the temperature reading is 25.750°C.
The absolute accuracy of the sensor is ±1°C over -25°C to +100°C range, so for most applications it makes sense to just drop the fractional component. To read the absolute temperature:
temp drop
The fractional part of the temperature reading is useful if you're interested in small differential changes over a short time, rather than an absolute reading.