Amarantowy
Published © GPL3+

Temperature and Humidity Sensor

Easy to build temperature and humidity sensor with a cheap 2x16 LCD.

BeginnerProtip35,961
Temperature and Humidity Sensor

Things used in this project

Hardware components

Arduino Leonardo
Arduino Leonardo
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Story

Read more

Schematics

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Simple temperature and humidity sensor with LCD

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Code

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Arduino
Easy temperature and humidity sensor on DHT11 with LCD
// DHT11 sensor

#include <DHT.h>
#define DHTPIN 7 // what digital pin we're connected to
#define DHTTYPE DHT11  //DHT 11

// LCD display

#include <LiquidCrystal.h>;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

DHT dht (DHTPIN, DHTTYPE); //Initialize DHT sensor.


void setup() {
  // put your setup code here, to run once:


// Serial.begin(9600);
dht.begin();

}

void loop() {
 delay(10000); // Waiting time between measurements
 
float t = dht.readTemperature(); // Read temperature in *C (default)
float h = dht.readHumidity(); // Read humidity %

float hic = dht.computeHeatIndex(t, h);


/*Serial.print("Temerature: ");
Serial.print(t);
Serial.print("*C\t");
Serial.print("Humidity: ");
Serial.print(h);
Serial.print("%\t");
Serial.print("Heat index: ");
Serial.println(hic);
*/



// LCD display

lcd.begin(16, 2); // display diamensions
lcd.setCursor(0,0);
lcd.print("T=");
lcd.setCursor(2,0);
lcd.print(t);
lcd.setCursor(4,0);
lcd.print("*C ");
lcd.setCursor(0,1);
lcd.print("H=");
lcd.setCursor(2,1);
lcd.print(h);
lcd.setCursor(4,1);
lcd.print("%  ");
lcd.setCursor(8,1);
lcd.print("HI=");
lcd.print(hic);

}

Credits

Amarantowy
1 project • 6 followers

Comments