Arduino การต อ sensor อ ณหภ ม ds

DHT11 และ DHT22 คือเซนเซอร์วัดความชื้นและอุณหภูมิในอากาศ สามารถนำไปประยุกต์ใช้งานได้หลากหลาย เช่น ตู้ฟักไข่ โรงเรือนปลูกผัก โรงเพาะเห็ด เป็นต้น นำไปใช้งานได้ง่าย รองรับแรงดันไฟฟ้า 3.3 และ 5V

DHT11

  • อุณหภูมิ 0 ถึง 50 °C ความผิดพลาด ±2 °C
  • ความชื้น 20 ถึง 80 % ความผิดพลาด ±5 %

DHT22

  • อุณหภูมิ -40 ถึง 80 °C ความผิดพลาด ±0.5 °C
  • ความชื้น 0 ถึง 100 % ความผิดพลาด ±5 %

เอกสารเพิ่มเติม

  • DHT22 Datasheet
  • DHT11 Datasheet

Library ที่ใช้งาน

  • https://github.com/adafruit/DHT-sensor-library

ตัวอย่างที่ 1

รายการอุปกรณ์

  • Aduino UNO R3
  • โมดูล DHT22 AM2302
  • สายจั้มเปอร์
  • Breadboard 400 holes
  • 5mm LED Pack (เขียว,เหลือง,แดง)
  • 330 Ohm

วิธีการต่อใช้งาน DHT22 AM2302 > Arduino UNO R3

  • VCC(แดง) > 5V
  • GND(ดำ) > GND
  • DATA(เหลือง) > 4

***หากเป็นตัวธรรมดาให้ต่อความต้านทาน 10K Ohm ระหว่าง ขา 5V และ data

LED1 > Arduino UNO R3

  • Anode(+) > 330R -> 2
  • Cathode(-) > Gnd

LED2 > Arduino UNO R3

  • Anode(+) > 330R -> 3
  • Cathode(-) > Gnd

Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds
Arduino การต อ sensor อ ณหภ ม ds

ตัวอย่างการใช้งาน

1.เปิด Serial monitor

Arduino การต อ sensor อ ณหภ ม ds

2.เมื่อเซนเซอร์วัดค่าอุณหภูมิได้ 30 องศา หรือมากกว่า 30 องศา LED สีส้มสว่าง

Arduino การต อ sensor อ ณหภ ม ds

3.เมื่อเซนเซอร์วัดค่าอุณหภูมิได้น้อยกว่า 30 องศา LED สีน้ำเงินสว่าง

Arduino การต อ sensor อ ณหภ ม ds

to adapt to a wider voltage range, the voltage range: 3.0 ~ 5.5V, parasitic power mode can be powered by the data line

  • the unique single-line interface, DS18B20 in connection with the microprocessor only need a mouth line to achieve the microprocessor and DS18B20 two-way communication
  • DS18B20 support multi-point networking, multiple DS18B20 can be connected in parallel on the only three lines, to achieve multi-point network temperature
  • DS18B20 in use does not require any external components, all the sensor components and conversion circuit integrated in a transistor like a transistor
  • temperature range -55 ℃ ~ +125 ℃, -10 ~ +85 ℃ when the accuracy of ± 0.5 ℃
  • programmable resolution of 9 to 12, the corresponding resolution of the temperature were 0.5 ℃, 0.25 ℃, 0.125 ℃ and 0.0625 ℃, can achieve high-precision temperature measurement
  • At 9-bit resolution up to 93.75ms when the temperature is converted to digital, 12-bit resolution up to 750ms within the temperature value into digital, faster
  • The measurement results directly output digital temperature signal to "line bus" serial transmission to the CPU, and can send CRC check code, with a strong anti-jamming error correction capability
  • negative pressure characteristics: power polarity reverse, the chip will not burn due to heat, but can not work properly.
  • Board size: 21 (mm) x10 (mm)

DS18B20 shape and internal structure

DS18B20 internal structure is mainly composed of four parts: 64-bit lithography ROM, temperature sensor, non-volatile temperature alarm trigger TH and TL, configuration register. The outline and pinout of the DS18B20 are shown in the following figure