Skip to main content

Temperature and relative humidity meter using an inexpensive DHT11 sensor

Project Summary

Numerous studies have shown that the indoor temperature and relative humidity at workplace significantly impacts workers' comfort and productivity. The first step towards optimizing these two ambient parameters is their reliable measurement. This project describes an inexpensive technique of using the DHT11 sensor for measuring temperature and relative humidity in parallel. It uses the PIC16F628A microcontroller to read the sensor output and display the results on a 16x2 character LCD.

Project Description

DHT11 is the most inexpensive sensor currently available in the market that provides calibrated digital outputs for temperature and relative humidity. It is available in a single row 4-pin package and operates from 3.5 to 5.5V power supply. It can measure temperature from 0-50 °C with an accuracy of ±2°C and relative humidity ranging from 20-95% with an accuracy of ±5%, thus making it suitable for indoor applications. The sensor has got its own proprietary 1-wire protocol to communicate with a host microcontroller.





 The following timing diagram describes the protocol involved in the communication between a MCU and the DHT11 sensor.




The MCU initiates data transmission by issuing a “Start” signal. The MCU first pulls the data line low for at least 18 ms and then pulls it high for next 20-40 μs. When the line is released by the MCU the sensor responds to the “Start“ signal by pulling the line low for 80 μs followed by a logic high signal that also lasts for 80 μs. Remember that the MCU pin must be configured to input after finishing the “Start“ signal. Once detecting the response signal from the sensor, the MCU is ready to receive data from the sensor. The sensor then sends 5 bytes of data continuously in the data line with the most significant bit first for each byte. The 5 bytes of data consists of,
Data = Integer Byte of RH + Decimal Byte of RH + Integer Byte of Temp. + Decimal Byte of Temp. + Checksum Byte
For DHT11 sensor, the decimal bytes of temperature and humidity measurements are always zero. Therefore, the first and third bytes of received data actually give the numeric values of the measured relative humidity (%) and temperature (°C). The last byte is the checksum byte which is used to make sure that the data transfer has happened without any error. If all the five bytes are transferred successfully then the checksum byte must be equal to the last 8 bits of the sum of the first four bytes, i.e.,
Checksum = Last 8 bits of (Integer Byte of RH + Decimal Byte of RH + Integer Byte of Temp. + Decimal Byte of Temp.)
Now lets talk about the signal conditions used by DHT11 for transmitting data. In order to send a bit of data, the sensor first pulls the line low for 50 μs and then raises it to high for 26-28 μs (for sending “0″), or for 70 μs (for sending “1”). So the width of the positive pulse carries information about 1 and 0.
At the end of the last transmitted bit, the sensor pulls the data line low for 50 μs and then releases it. It is now ready to receive another start signal from the MCU.

Circuit diagram

Here is the circuit diagram of this project. The DHT11 sensor and a HD44780-based character LCD are both interfaced to the PIC16F628A microcontroller, which runs at 4.0 MHz clock using an external resonator connected between OSC1 (16) and OSC2 (15) pins. The use of 4.0 MHz clock makes the timing calculation easier as 1 machine cycle becomes 1 μs. The timing information will be used to calculate the width of the received data pulse from the sensor so that we could identify if it is carrying a 1 or 0.




Software

The firmware for this project is written in C and compiled with mikroC Pro for PIC compiler from mikroElektronika. The Timer2 module is used as a free running counter to measure the width of the received data pulse, which is required to differentiate 1 and 0. Since 1 machine cycle of PIC is 1 μs in this project, the value of Timer2 register gives the pulse width in μs, which makes timing calculation easier. When a low-to-high pulse is detected at the beginning of any data bit, Timer2 is cleared and turned ON. It is stopped whenever the data pulse is low again. The value of the TMR2 register then gives the width of the data pulse in μs. In this project, 40 μs is used as a threshold and therefore, if the received pulse width is greater than 40 μs it represents 1, otherwise it is 0. The checksum byte is verified before displaying the results on the LCD.

Comments

Popular posts from this blog

Build a Low Noise And Drift Composite Amp Circuit Diagram

How to Build a Low Noise And Drift Composite Amp Circuit Diagram. This circuit offers the best of both worlds. It can be combined with a low input offset voltage and drift without degrading the overall system`s dynamic performance. 
 Low Noise And Drift Composite Amp Circuit Diagram


Compared to a standalone FET input operational amplifier, the composite amplifier circuit exhibits a 20-fold improvement in voltage offset and drift. In this circuit arrangement, A1 is a highspeed FET input op amp with a closed-loop gain of 100 (the source impedance was arbitrarily chosen to be 100 kfl). A2 is a Super Beta bipolar input op amp. It has good dc characteristics, biFET-level input bias current, and low noise. A2 monitors the voltage at the input of A1 and injects current to Al`s null pins. This forces A1 to have the input properties of a bipolar amplifier while maintaining its bandwidth and low-input-bias-current noise.

High Power Output Amplifier TDA7294

The famous SGS-THOMSON ST Microelectronics has introduced a Hi-Fi DMOS high-power amplifier circuit TDA7294, its sound great taste bile, which due to its internal circuit from input to output are field-effect devices, rounded sound Mild, delicate Rounuan.  However, with its assembly amplifier, only TDA7294 single-output power is only 70 W, BTL access law is 100 W from top to bottom, do not feel that power cushion. The author several tests, used to promote TDA7294-level, direct-drive one to four pairs of high-power transistor parallel, the output of strong currents, the power output of 400 W (mono), and the circuit is simple and no need to debug that can reliably work Basically, the IC has maintained a sound and performance.  Ruzuo The figure below shows, R6 for the feedback resistor, the author of the value in debugging 22 k Ω more appropriate, R6 also decided this circuit gain, the gain value will increase.  Quiescent current depends on the power of R7, R8, when its value…

Full Power Mobile Phone Jammer Circuit Diagram

Full Power Mobile Phone Jammer Circuit Diagram.To day if we are talking about expert Cell phone Jammers we are conversing about this schematic underneath. First off all you should be very very cautious how to use this apparatus. Its completely illegal and so the reason. I post this Circuit is only for educational and testing causes. This type of apparatus is being utilised by security for VIPS, particularly at their limousines to avoid blasting device initiating while the vehicle passes from the goal cell phone-bomb. Off course there are those who use it to make a antic or to make the persons crazy in the rectangle block you are. 
The power of the jammer is currently sufficient to do your thing, but certainly you can place a 30W linear power amp at the RF output and impede a much wider locality. So, Be pleasant individual with that and recall that there are people who may need desperately to obtain or make a call and one of them could be you! And if you can't oppose of functioning …