Home Code Chipkit Uno and DHT11 sensor example

Chipkit Uno and DHT11 sensor example

by shedboy71

The DHT11 digital temperature and humidity sensor is a composite Sensor contains a calibrated digital signal output of the temperature and humidity. Application of a dedicated digital modules collection technology and the temperature and humidity sensing technology, to ensure that the product has high reliability and excellent long term stability. The sensor includes a resistive sense of wet components and an NTC temperature measurement devices, and connected with a high performance 8 bit microcontroller.
Temperature Resolution: 16Bit

Electrical Characteristics
Power supply: DC 3.5 ~ 5.5V
Supply Current: measurement 0.3mA standby 60µA
Sampling period: more than 2 seconds

Pin Description
1, VDD power supply 3.5 ~ 5.5V DC
2, DATA serial data, a single bus
3, NC, empty pin
4, GND ground, the negative power

We will connect one of these sensors to our Chipkit Uno and output via the serial monitor. The sensor I used was part of a little module with the resistor already fitted, here is an example of a commonly found module that is used on many Arduino projects

dht11 module

dht11 module

 

Schematics and Layout

Here is a layout and schematic

Chipkit and dht11

Chipkit and dht11

Chipkit and dht11 schematic

Chipkit and dht11 schematic

Code

Copy the dht11 library into the library location – here is the library : dht11

This simple code example will output the temperature and humidity via the serial monitor

[codesyntax lang=”cpp”]

 #include "dht11.h"
 
 #define DHT11PIN 3 
 
 dht11 DHT11; 
 
 void setup() 
 { 
 Serial.begin(9600); 
 }
 
 void loop() 
 { 
 int chk = DHT11.read(DHT11PIN); 
 Serial.print("Humidity : ");
 Serial.println(DHT11.humidity); 
 Serial.print("Temperature : ");
 Serial.println(DHT11.temperature); 
 delay(1000); 
 }

[/codesyntax]

Results

If you open the serial monitor you should results like the following

Chipkit and DH11 serial outputChipkit and DH11 serial output

Chipkit and DH11 serial output

Links
New Temperature and Relative Humidity Sensor DHT11 Module with Cable E1Xc

Share

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More