描述
技術規格
1.訊號傳輸型式: 數位 (Digital)
2.電壓範圍:3.0V ~ 5.5V。
3.測溫範圍:-55℃ ~ +125℃
4.不銹鋼外殼 (6*50mm),引線長度100cm
5.9~12位可調分辨率
6.輸出引線:紅色(VCC),藍色(DATA),黑色(GND)
商品內容
- DS18B20 專用感測轉接板 1個
- DS18B20感測棒 1條
- RJ11 6P4C 25cm 信號線 1條
程式範例
在此範例配合S4A IO Board 做簡單實驗, 顯示此模組感測溫度。
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println(“Dallas Temperature IC Control Library Demo”);
// Start up the library
sensors.begin();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print(“Requesting temperatures…”);
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println(“DONE”);
Serial.print(“Temperature for the device 1 (index 0) is: “);
Serial.println(sensors.getTempCByIndex(0));
}
接線範例
接線方式如果搭配S4A IO Board或 S4A Sensor Board只要把電話接頭(RJ11)接到標示D2D3孔位即可完成連接。