Introduction: DISPLAY HUMIDITY AND TEMPERATURE ON LCD WITH ARDUINO NANO
The following Instructable deals with making a simple lcd interface with arduino nano.
Step 1: Requirements:
Requirements
- DTH11 Humidity and Temperature Sensor
- Arduino Nano
- 16*2 LCD display
- I2C module
- Connecting wires
And
- Arduino IDE
- Arduino libraries
I2c library(LiquidCrystal_I2C)
DHT library(DHT.h)
Step 2: Connect Components to Nano
Connect components to nano as the screen shot,
DTH11 To Arduino Nano
Vcc --> 3.3V
GND --> GND
Out --> D4 I2C
Lcd to Nano
GND -->GnD
SDA --> A4
SCL --> A5
Vcc -->5V
Step 3: Include Libraries
Download and include Below libraries,
DHT sensor library(DHT.h)
I2c library(LiquidCrystal_I2C.h)
Include as above image.
Go to ketch--> Include Library --> Add Zip File and then browse the folder,
Close the IDE and open it again,
You can download libraries from below links also,
Step 4: Scan the I2C and Find the Address
Download the I2C scanner and find your i2c address and then enter it to the code;
You can find the scanner code from here also.
Attachments
Step 5: The CODE
//Compile and upload the code to arduino nano
#include "DHT.h"
#define SensorPin 4 // connect the out pin of dht sensor to D4 pin of arduino nano
#define Dht DHT11
DHT dht(SensorPin, Dht);
#include
#include
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //set I2C Address as 0x3F
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
Serial.println("Temperature and Humidity Inteface");
dht.begin();
}
void loop() {
int hum = dht.readHumidity();
int temp = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print("%");
Serial.print("\nCurrent Temperature: ");
Serial.print(temp);
Serial.print("C");
Serial.print("\nCurrent Humidity: ");
Serial.print(hum);
Serial.print("%");
delay(2500);
}
Results are shown with above photos.
Thanks,
Dush.
2 Comments
5 years ago
Great Arduino project. You should enter this into the Microcontroller contest that is currently running.
Reply 5 years ago
OK.. Thank you