The device is one of the Arduino temperature sensor DHT11 temperature/humidity sensor and an LCD powered by a battery.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp

If you buy something from a this link, myelectricsparks Media may earn a commission. See our Read More.

Arduino temperature sensor DHT11

The DHT11 temperature and humidity sensor include humidity and temperature information in your DIY electronics projects. It’s ideal to use for weather station remotes, indoor environmental control systems, and garden or farm monitoring systems.

In this guide, I’ll start by giving the basics of humidity. I’ll then explain how the DHT11 determines humidity. Then I’ll explain the best way to link your DHT11 with an Arduino and show you an example of how you can utilize the DHT11 to build the projects you create.

DHT11 Sensor

Its model DHT11 is simple and ultra-low-cost moisture and temperature sensor. It utilizes a capacitive humidity sensor and a thermistor to detect the air around it and then outputs an analogue signal to one of the data ports (no digital input pins are required). It’s pretty easy to use; however, it requires careful timing to collect information. The only downside to this sensor is that you only collect information every two seconds. As a result, the readings from the sensor can be two seconds older.

Compared to the DHT22, this sensor is less precise, less accurate, and works in a smaller range of temperature/humidity, but it is smaller and less expensive.

Technical Details

  • Low cost
  • Power from 3-5V, and I/O
  • 2.5mA max current use during conversion (while requesting data)
  • Ideal for 20 to 80% humidity readings, with 5-per cent accuracy
  • Great for temperature readings from 0 to 50degC. +2degC accuracy
  • Limit to 1 sampling rate of 1 Hz (once each second)
  • Body size 15.5mm x 12mm x 5.5mm
  • Four pins, with 0.1″ spacing

What is Relative Humidity?

The DHT11 analyzes absolute humidity. The relative humidity measures the quantity of water vapour present in the air. The point of saturation for water vapour in the air. The water vapour begins to condense and build upon the surfaces to form dew at saturation.

The saturation level changes with the temperature of the air. The colder air holds less water vapour until it is saturated, while hot air will retain more water vapour until it gets saturated.

The formula for calculating relative humidity follows:

ABOUT THIS PROJECT

I will demonstrate how I created the temperature and humidity sensor using An Arduino Uno. My ultimate goal is to build one using an ATTINY84 and then etch a PCB. Although I have the necessary components to make this happen, the weather outside isn’t working. It’s hard to make etch marks on a board in my garage with less than 10°F. This will be an additional instructable to be posted at a later time.
Thank you so much for taking the time to read about my project.

All components can be bought from adafruit or Sparkfun. You can also do what I do and get all you can from old gadgets.

  • Arduino (I employed a UNO R3; however, 5V will work)
  • Breadboard
  • DHT11 sensors for temperature, humidity and temp.
  • 10k ohm potentiometer
  • 16×2 LCD screen
  • tactile button
  • USB A-B cable
  • Power Bank
  • Jumper Wires

It’s time to connect all cables to your devices. Again, you can refer to the Fritzing diagram (please be aware that I don’t have jumper wires connecting both power lines on my breadboard. you’ll need these if you are using both):

The LCD I’m using was found in the old alarm panel. Pins 15 and 16 are located before Pin 1 and Pin 16 as And it is 5V while Pin 15 corresponds to Gnd. Check your display and ensure your pins are in order. Since my display’s pinout will likely be different from most people’s, I’ve created the Fritzing diagram using my “standard” display instead of my actual pinout.

Uno

  • Gnd -Negative rail on the breadboard
  • 5v + the positive rail of the breadboard

DTH11

  • Pin1 -to 5v and 10k Ohm resistor
  • Pin2 – Arduino 8 pin and 10k Ohm resistor
  • Pin3 –> no connection
  • Pin4 –> Gnd
  • 16×2 LCD Screen
  • Pin1 –> Gnd
  • Pin2 –> 5v
  • 3 Pin-> 10k Ohm the potentiometer’s wiper pin ( middle pin. The other two pins of the potentiometer go through 5V and Gnd)
  • Pin4 –> Arduino Pin12
  • Pin5 –> Gnd
  • Pin6 –> Arduino Pin11
  • Pin7 –> no connection
  • Pin8 –> no connection
  • Pin9 –> no connection
  • Pin10 –> no connection
  • Pin11 –> Arduino Pin5
  • Pin12 –> Arduino Pin4
  • Pin13 –> Arduino Pin3
  • Pin14 –> Arduino Pin2
  • Pin15 –> 5v
  • Pin16 -> Touch button (another part of the tack button connects to Gnd)

CODE

The code is attached:

I employed the DHT library by Adafruit.

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

After all of the wiring, plug your power bank to the Arduino.

Your LCD display and DHT11 should start up. Press the tact button and your LCD backlight should light up.

Now you have a portable temperature and humidity sensor with a real time display.

This has helped me determine my draftiest windows in my house and how best to set my house ventilation.

Thanks again for taking the time to read my first project.

Code:

				
					// include the library code:
#include <LiquidCrystal.h>
#include "DHT.h"

// set the DHT Pin
#define DHTPIN 8

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  dht.begin();
  
  // Print a message to the LCD.
  lcd.print("Temp:  Humidity:");
}

void loop() {
  delay(500);
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // read humidity
  float h = dht.readHumidity();
  //read temperature in Fahrenheit
  float f = dht.readTemperature(true);

  if (isnan(h) || isnan(f)) {
    lcd.print("ERROR");
    return;
  }

  lcd.print(f);
  lcd.setCursor(7,1);
  lcd.print(h);  
}
				
			

Circuit Diagram