久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3011|回復(fù): 2
打印 上一主題 下一主題
收起左側(cè)

Electric thermometer by using DHT11 sensor module

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
Electric thermometer by using DHT11 sensor module

As you may know, Geeetech is located in Shenzhen, a southern city of China. The weather there all year long is almost hot and humid. Getting to used it is no easy, especially when you come from a northern part of this country. March in Shenzhen is getting warmer and damper. However after days of rain recently, the temperature begins to fall again. Making an electric thermometer which can measure current temperature and humidity with LCD readout using our Arduino is a good idea.
All we need is:
  • Arduino Uno or compatible
  • DHT11 temperature and humidity sensor module
  • 16×2 character LCD module
  • 10k ohm potentiometer
  • a breadboard and a bundle of jumper wires
We could build it step by step if you have no previous experience of using DHT11 sensor and 16×2 LCD display module.
First of all, we shall take a in-depth look at DHT11 temperature and humidity sensor. This sensor includes a humidity measurement component and an NTC temperature measurement component, and connects to a high-performance 8-bit microcontroller.DHT11′s power supply is 3-5.5V DC.
The interesting thing in this module is the protocol that uses to transfer data between MCU and DHT11 sensor. All the sensor readings are sent by using a single wire bus which reduces the cost and extends the distance. One communication process is about 4ms.Data consists of decimal and integral parts. A complete data transmission is 40bit, and the sensor sends higher data bit first.
Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data + 8bit check sum.
More details related to DH11 sensor module please visit our Wiki.
Because of the original code to read DHT11 sensor module is so “obscure”, we can import a DHT sensor library to make it work more obvious and more user-friendly. You can download DHT library here, then drag the DHT folder into Arduino/libraries/ folder and restart IDE.It’s fairly easy to connect up DHT11 module to Arduino, pin S is for data output.
Now load up Examples-DHT-DHTtester sketch. Since the DHT sensor library is not only for DHT11 sensor module, but also for other types of DHT sensor, such as DHT12,DHT22. Therefore, the code need to change a bit for fitting your sensor module, or else, it doesn’t work properly.
In following step we need a 16×2 character LCD module that IC controller is HD44780 or compatible, these is usually be the common found in retail stores. There are many ways to interface this LCD to Arduino board,4-bit, 8-bit parallel and so on. Here we choose the easiest method 4-bit parallel interface.
There are 16 pins on the LCD module, pin label details please visit our wiki. The pin labels of different type may have a little change, but in general it’s almost the same. Now we can connect 16×2 LCD screen to Arduino board using the diagram below.
The 10k ohm potentiometer should be connected to pin3 for adjusting the display contrast.Likewise, for convenience, we could use the LiquidCrystal library which should pre-installed in the Arduino IDE. We can load up the Examples-LiquidCrystal-Helloworld to inspect if the Lcd sreeen is working normally.
What we do on next step is more easier, just connect the DHT11 sensor module to Arduino board.Schematic is following.
Current temperature and humidity in Shenzhen, China.

Relating code
#include "DHT.h"#include #define DHTPIN 8   #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE);LiquidCrystal lcd(12, 11, 5, 4, 3, 2);void setup() {Serial.begin(9600);lcd.begin(16, 2);dht.begin();}void loop() {float h = dht.readHumidity();float t = dht.readTemperature();if (isnan(t) || isnan(h)) {  Serial.println("Failed to read from DHT");  }else {  lcd.setCursor(0,0);  lcd.print("Temp=");  lcd.print(t);  lcd.print(" *C");  lcd.setCursor(0,1);  lcd.print("Humidity=");  lcd.print(h);  lcd.print("% ");  delay(500); }}


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:203082 發(fā)表于 2017-5-21 10:39 | 只看該作者
拜托,很急 我需要5黑幣  不然這門課要掛啦!!!!
回復(fù)

使用道具 舉報(bào)

板凳
ID:68692 發(fā)表于 2017-5-25 13:20 | 只看該作者
請(qǐng)問  DHT 庫文件在哪里有下載??
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 久久国产视频播放 | 国产欧美视频一区二区三区 | 中文在线视频观看 | 色婷婷av一区二区三区软件 | 亚洲精品第一国产综合野 | 欧美一区二区视频 | 男人天堂手机在线视频 | 免费成人国产 | 欧美激情久久久久久 | 欧美日韩免费一区二区三区 | 欧美日韩国产一区二区三区 | 国产日韩精品在线 | 天堂在线中文字幕 | 日韩一级黄色毛片 | 欧美日一区 | 欧美日韩综合一区 | aaa国产大片 | 又爽又黄axxx片免费观看 | 久久草视频 | 国产精品一区视频 | 精品三区 | 欧美成人h版在线观看 | 99久久夜色精品国产亚洲96 | 日韩欧美三区 | 午夜国产在线 | 亚洲 中文 欧美 日韩 在线观看 | 美女一级毛片 | 色综合99| 日韩av成人在线观看 | 欧美综合网 | 在线精品亚洲欧美日韩国产 | 国产一区视频在线 | 久久福利 | 国产成人综合网 | 欧美成人免费电影 | 欧美成人一区二区三区 | 国产我和子的乱视频网站 | 91精品国产一区二区三区动漫 | 91在线观看网址 | 日韩一区精品 | 草久在线 |