Humidity sensor using 8051

Humedity Sensor

This project is about a simple humidity sensor based on 8051 microcontroller. Humidity sensor is also called hygrometer. This circuit can sense relative humidity (RH)  from 20% to 95% at an accuracy of 5%. The humidity information is displayed on a 16×2 LCD display. A relay is also provided which is set to be active when the humidity crosses a certain trip point. The circuit is mains operated and it is very easy to install. DHT11 is the humidity sensor used here. The details and working of the DHT11 humidity sensor is given below.



The to and fro communication with DHT11 sensor is very easy. Pin 2 of the  DHT11 is connected to the port pin of the micrcontroller. The connection scheme is shown in the image below. The data pin (pin2) of the DHT11 requires an external 10K pull-up resistor.


The communication protocol is explained as follows. The MCU (microcontroller unit) first sends a low signal of width 18mS to the DHT11. After this signal, the MCU pulls up the communication line and waits for the response from DHT11. It make take up to 2. to 40uS. Then the DHT11 pulls down the communication line and keeps it low for 80uS. Then DHT11 pulls up the line and keeps it high for 80uS. Then the DHT pulls down the line for 50uS and the next high pulse will be the first bit of the data. The data is send in bursts of 8 bits. Each high pulse of the burst indicates a data signal. The 50uS low signals between the data bits are just spacers. The logic of the data bit is identified by measuring the width of it. A 26 to 28uS wide pulse indicates a “LOW” and 70uS wide pulse indicates a “HIGH”.  In simple words, an pulse narrower than 50uS can be taken as a “LOW”  and wider than 50us can be taken as a “HIGH”. The first 8 bits of the data burst represents the integral value of the relative humidity, second 8 bits represent the decimal value of the  relative humidity, third 8 bits represent the integral value of the temperature data, and the last 8 bits represent the decimal value of the temperature data, For DHT11 the decimal values are always zero and we are measuring the relative humidity only in this project. So we need to just concern about the first 8 bits of data, that is the integral part of the relative humidity data. Circuit diagram of the humidity sensor is shown in the image below.


For More Details: Humidity sensor using 8051

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top