Technical specifications
- Temperature range: −55 to +125 °C
- Accuracy: ±0.5 °C (from −10 to +85 °C)
- Conversion time: 750 ms
- Supply voltage: 3–5.5 V
- Current in standby: 750 nA
- Current during measurement: 1 mA
Description
The sensor measures the temperature of air, liquids, and other objects over a wide range, from −55 to +125 °C, with an accuracy of ±0.5 °C between −10 and +85 °C. The module is based on a digital DS18B20 sensor, sealed inside a stainless-steel probe.
Use
Connection
The sensor uses a standard 3-pin connector and can be connected to any IN port on the Trackduino controller.
Programming
The sensor communicates with the microcontroller over the 1-Wire protocol and uses the OneWire library. The temperature(int port) function calls the library internally, so you do not need to include it manually when using Trackduino.
The required block is called “temperature” and is in the “Sensors” block group.
| Block and generated function | Description |
|---|---|
![]() int temperature(int port) | Returns the current temperature rounded to the nearest whole number. Argument: int port — the port the sensor is connected to.Important: Each temperature() call takes about 700 ms. Account for this delay when writing programs. |
Project example
Autonomous weather station
The controller measures the temperature once an hour and saves the readings to temp_log.txt on an SD card.
Generated code:
// Include libraries for SD card access
#include <SPI.h>
#include <SD.h>
void setup()
{
const int chipSelect = SD_CS;
SD.begin(chipSelect);
File datafile = SD.open("temp_log.txt", FILE_WRITE);
if(datafile){
datafile.print( "Temp=" );
datafile.print(" ");
datafile.print( temperature(IN1) );
datafile.print(" ");
datafile.println("");
datafile.close();
}
delay( 3600000 );
}
void loop()
{
}

