Surilli
Published © LGPL

Interfacing 16x2 LCD with DHT11 and Surilli Basic M0

Temperature and Humidity monitoring using DHT11 and a 16x2 liquid crystal display (LCD).

BeginnerFull instructions provided1 hour912
Interfacing 16x2 LCD with DHT11 and Surilli Basic M0

Things used in this project

Hardware components

Surilli Basic
Surilli Basic
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Interfacing 16x2 LCD with DHT11 and Surilli Basic M0

Code

16x2_LCD_with_DHT11

C/C++
#include <LiquidCrystal.h>
#include <dht.h>
#define dht_apin 13 // Analog Pin sensor is connected to 
dht DHT;
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = A0 , en = A1, d4 = 9, d5 = 10, d6 = 11, d7 = 12;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
 SerialUSB.begin(9600);
 // set up the LCD's number of columns and rows:
 lcd.begin(16, 2);
 // Print a message to the LCD.
}
void loop() {
 DHT.read11(dht_apin);
 int h = DHT.humidity;
 int t = DHT.temperature;
 if (t < 100 && h < 100) {
   lcd.setCursor(0, 0);
   String T = "Temperature=" + String(t) + "C";
   lcd.print(T);
   lcd.setCursor(0, 1);
   String H = "Humidity=" + String(h) + "%";
   lcd.print(H);
 }
 delay(1000);
} 

Credits

Surilli
196 projects • 65 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.

Comments