เซนเซอร์วัดอุณหภูมิแบบ Digital 18B20 ESP8266
เซนเซอร์ 18B20 มีการเชื่อมต่อแบบ 1 wire bus โดยใช้สายไฟเพียง 1 เส้น สามารถต่อร่วมกันได้หลายตัวในสายไฟเส้นเดียวกัน การต่อใช้งานจะต้องมีตัวต้านทานค่า 4.7K - 10K ต่อระหว่างขา Data กับ Vcc เพื่อ pull up ป้องกันสัญญาณรบกวน ใช้ไฟเลี้ยง 3.0 - 5.5V
การต่อวงจร 18B20 ESP8266 NodeMCU 
การเขียนโปรแกรม Arduino ESP8266 18B20
- ลงไลบารี OneWire

- ลงไลบารี DallasTemperature

- ตัวอย่างโคด Arduino ESP8266 18B20
#include
#include
#define ONE_WIRE_BUS D2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
Serial.begin(9600);
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.print("Temperature for Device 1 is: ");
Serial.println(sensors.getTempCByIndex(0));
}
คลิปวีดีโอสอน Arduino ESP8266 18B20 Temperature : ESP8266 วัดอุณหภูมิด้วย 18B20