Project in progress
Two Temperatures and Humidity to Both Terminal and LCD

Two Temperatures and Humidity to Both Terminal and LCD © GPL3+

Simple project to measure temperature (with two sensors) and humidity, and send them to the terminal (monitor) and also to a LCD display.

  • 3,738 views
  • 11 comments
  • 35 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
I used the Elgoo Starter kit
×1
41vjwzaib4l  sx425  iprkdeou4l
DHT11 Temperature & Humidity Sensor (3 pins)
Also the four-pin DH11 works, just one pin is not used.
×1
Thermistor
It might be something like this
×1
09939 01
Rotary potentiometer (generic)
×1
398 09
Adafruit RGB Backlight LCD - 16x2
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Multicolored Dupont Wire
×1

About this project

I had the need to monitor the temperature in two different places and the humidity of only one place, also one of the temperature readings had to be more precise, the other not so much. For this I selected the DH11 sensor for rough temperature and humidity and the thermistor for more accurate readings. Also I like to have the output both to the terminal and an LCD display.

The output to the terminal displays the temperature from both sensors, in celsius and Fahrenheit, and the humidity in percentage. But this can easily be changed by editing the code. By the way, the code might need to be polished, but it works as is. After all, this is my first project.

In the LCD display, the temperature from the Thermistor (Therm) is displayed in the first line and the temperature and humidity from the DH11 sensor.

TODO

Add a SD card reader to save also the results.

Code

DHTArduino
Library for the DH11 sensor
No preview (download only).
Liquid Crystal libraryArduino
Library for the LCD panel
No preview (download only).
ThDH11Arduino
Simple cade to measure temperature with a Thermistor and also temperature and humidity with the DH11 sensor, the output is displayed to the terminal and to an LCD display.
// Measurement with the DH11 and thermistor
//Printout to terminal and to the LCD display

#include <dht_nonblocking.h> // DH11
#define DHT_SENSOR_TYPE DHT_TYPE_11 // DH11
#include <LiquidCrystal.h> // LCD display

static const int DHT_SENSOR_PIN = 2; //DH11
DHT_nonblocking dht_sensor( DHT_SENSOR_PIN, DHT_SENSOR_TYPE ); //DH11

int tempPin = 0; // Thermistor

//                BS E D4  D5  D6  D7
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// setup
void setup()
{
  Serial.begin(9600);
  
  lcd.begin(16, 2);
}

static bool measure_environment( float *temperature, float *humidity ) // DH11
{
  static unsigned long measurement_timestamp = millis( );

  /* Measure once every x seconds. */
  if( millis( ) - measurement_timestamp > 10000ul )
  {
    if( dht_sensor.measure( temperature, humidity ) == true )
    {
      measurement_timestamp = millis( );
      return( true );
    }
  }

  return( false );
}

void loop()
{
  // Thermistor
    int tempReading = analogRead(tempPin);
    double tempK = log(10000.0 * ((1024.0 / tempReading - 1)));
    tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK ); // Temp Kelvin
    float tempC = tempK - 273.15;            // Convert Kelvin to Celcius
    float tempF = (tempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
    
  // DH11
    float temperature;
    float humidity;
    if( measure_environment( &temperature, &humidity ) == true )
    
    {
  // Print a terminal
    Serial.print( "DH11 " );
    Serial.print( temperature, 1 );
    Serial.print(" C, " );
    Serial.print( humidity, 1 );
    Serial.print(" %; Therm ");
    Serial.print(tempC);
    Serial.print(" C, ");
    Serial.print(tempF);
    Serial.print(" F\n");
    

  // Display in the LCD
    // Display Temperature from the Thermistor
    lcd.setCursor(0, 0);
    lcd.print("Therm        C  ");
    lcd.setCursor(7, 0);
    lcd.print(tempC);

    // Display Temperature from the DH11
    lcd.setCursor(0, 2);
    lcd.print("DH11     C     %");
    lcd.setCursor(5, 2);
    lcd.print(temperature,1);

    // Display Humidity from the DH11
    lcd.setCursor(11, 2);
    lcd.print(humidity,1);
    
    delay(500);
    }
}
// This is the end.

Schematics

Circuit
Themhd11 r12xwmhfpv

Comments

Similar projects you might like

Temperature + Humidity on LCD

Project showcase by interpeo

  • 19,969 views
  • 11 comments
  • 49 respects

Arduino Temperature - Humidity - Rain Sensor

Project showcase by Rick_Findus

  • 10,434 views
  • 6 comments
  • 17 respects

Portable Arduino Temp/Humidity Sensor with LCD

Project tutorial by ThothLoki

  • 171,331 views
  • 120 comments
  • 211 respects

Arduino DTH22 Humidity Temperature With LCD I2C 16x2 Display

Project tutorial by Team GiftedMedia

  • 34,386 views
  • 15 comments
  • 43 respects

DHT11 Humidity + Temperature Sensor with 16x2 LCD display

Project showcase by onatto22

  • 11,087 views
  • 3 comments
  • 25 respects

Using 16x2 LCD with Arduino

by Techmirtz

  • 20,334 views
  • 6 comments
  • 35 respects
Add projectSign up / Login