DS18B20
รุ่นนี้เป็นแบบกันน้ำได้ พร้อมสายต่อใช้งาน
สาย ยาว 1 เมตร
เซนเซอร์ตรวจจับอุณหภูมิ DS1820 เป็น IC แบบดิจิตอล สามารถวัดอุณภูมิในช่วง -55°C ถึง 125°C มีความคลาดเคลื่อนต่ำสุด ±0.5°C เมื่อใช้งานอยู่ที่ -10°C ถึง 85°C ใช้สายเพียงเส้นเดียวในการส่งข้อมูล และราคาถูกเหมาะกับการใข้งาน
ข้อมูลเพิ่มเติม datasheet ds1820
วีดีโอตัวอย่างการต่อใช้งาน IC DSB1820 เพื่อปรยุกต์ใช้งาน
สำหรับ Source Code ตัวอย่างมีอยู่ใน Sample Code ของ โปรแกรม Arduino อยู่แล้วครับ
ตัวอย่างโค๊ด
-
#include <OneWire.h>
-
#include <DallasTemperature.h>
-
-
// Define the pin connected to the DS18B20 sensor
-
#define ONE_WIRE_BUS 2
-
-
// Setup a oneWire instance to communicate with any OneWire devices
-
OneWire oneWire(ONE_WIRE_BUS);
-
-
// Pass the oneWire reference to DallasTemperature library
-
DallasTemperature sensors(&oneWire);
-
-
void setup() {
-
// Start serial communication
-
Serial.begin(9600);
-
-
// Initialize the DS18B20 sensor
-
sensors.begin();
-
}
-
-
void loop() {
-
// Call sensors.requestTemperatures() to issue a global temperature
-
// request to all connected devices on the bus
-
sensors.requestTemperatures();
-
-
// Read the temperature from the DS18B20 sensor
-
float temperatureC = sensors.getTempCByIndex(0);
-
-
// Print the temperature to the serial monitor
-
Serial.print("Temperature: ");
-
Serial.print(temperatureC);
-
Serial.println("°C");
-
-
// Wait for a second before taking the next temperature reading
-
delay(1000);
-
}
-
Share
สินค้าที่เกี่ยวข้อง
ไม่มีสินค้าที่เกี่ยวข้องสำหรับสินค้านี้
เขียนความคิดเห็น
ชื่อ:
ความคิดเห็น: คำแนะนำ: HTML จะไม่ถูกแปลง!
ความนิยม: แย่ ดี
ป้อนรหัสในกล่องข้างล่างนี้:
ความคิดเห็น: คำแนะนำ: HTML จะไม่ถูกแปลง!
ความนิยม: แย่ ดี
ป้อนรหัสในกล่องข้างล่างนี้: