Previously, we published guide on how to setup LCD 1602A with Arduino, print Arduino Temperature Humidity Sensor reading on serial display. This guide, simply combining those two guides in the same way we combined two guides on our Arduino basic light meter guide. In This Guide, We Will create a Arduino Temperature & Humidity Sensor DHT 11 With LCD 1602A Following Few Steps. A the end of this guide, you’ll get the below photograph like thing :
We are using Arduino Web IDE for compilation and uploading code. You’ll also get the code, circuit diagram of this project on below URLs :
1 2 | https://create.arduino.cc/editor/abhishekghosh/73771c60-f926-4b22-8b71-310b81583e4a/preview https://gist.github.com/AbhishekGhosh/7574d7d47acc86318a286d6dbbfdbe52 |
Arduino Temperature & Humidity Sensor DHT 11 With LCD 1602A
Needed components :
---
- Arduino UNO or similar dev board
- Breadboard
- Jumpers
- 10K Ohm Potentiometer
- DHT 11 or similar sensor
Here is the circuit diagram :
Exactly like the previous guides, first setup the LCD. We will adjust the contrast with potentiometer – so that is an important thing.
Pin 1 on LCD (VSS) will connect to GND of Arduino
Pin 16 on LCD (K) will connect to GND of Arduino
Pin 2 on LCD (VDD) will connect to +5v of Arduino
Pin 15 on LCD (A) will connect to +5v of Arduino
With the above connection if you connect Arduino with computer, the LCD will light up. Next, disconnect from computer and add the potentiometer :
First pin of the potentiometer will go to GND of Arduino
Pin 3 of the LCD display (VO) will connect to the middle pin of the potentiometer
With the above connection, again connect your Arduino with computer, the LCD will light up. Adjust the potentiometer and you’ll be able to see from blank to white all units like [] [] [] []. That [] [] [] [] is full contrast and blank is minimum contrast.
Pin 4 of the LCD display (RS) will connect to Pin 7 of Arduino
Pin 5 of the LCD display (RW) will connect to GND of Arduino
Pin 6 of the LCD display (E) will connect to Pin 8 of Arduino
Pin 11 of the LCD display (D4) will connect to Pin 9 of Arduino
Pin 12 of the LCD display (D5) will connect to Pin 10 of Arduino
Pin 13 of the LCD display (D6) will connect to Pin 11 of Arduino
Pin 14 of the LCD display (D7) will connect to Pin 12 of Arduino
If you use 1, 2, 3, 4 numbers of breadboard, you’ll not get confused. With the above connection again connect Arduino with computer. Next step is connecting the DHT 11 sensor. That is easy.
VCC – connect to 5v of Arduino, first pole from extreme left from front-side
Data – to connect with A0 pin of Arduino, second pole from extreme left from front-side
NC – not needed to do anything
GND – to connect with GND of Arduino, last pole from extreme left from front-side
This is the code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <LiquidCrystal.h> #include <Adafruit_Sensor.h> #include <DHT.h> #include <DHT_U.h> #define DHTPIN A0 // Pin which is connected to the DHT sensor. // type the model of sensor in use, we are using DHT 11, if you are using DHT 21 or DHT 22 change it #define DHTTYPE DHT11 DHT_Unified dht(DHTPIN, DHTTYPE); LiquidCrystal lcd(7, 8, 9, 10, 11 , 12); void setup() { dht.begin(); lcd.begin(16,2); //16 by 2 character display sensor_t sensor; dht.temperature().getSensor(&sensor); } void loop() { delay(1000); //wait a sec (recommended for DHT11) sensors_event_t event; dht.temperature().getEvent(&event); lcd.clear(); lcd.setCursor(0,0); lcd.print("Temp= "); lcd.print(event.temperature); lcd.print(" *C"); lcd.setCursor(0,1); dht.humidity().getEvent(&event); lcd.print("Humidity= "); lcd.print(event.relative_humidity); lcd.print("%"); } |
The above is 100% working code tested on January 2018. The reason peoples face issues with DHT 11 is out of not properly using the needed libraries. From Arduino Web IDE, you’ll not need to install any libraries. What libraries to install on local computer’s Arduino IDE, that is discussed on the previous basic guides linked at the beginning of this article.
Tagged With Arduino Temp and humidity DHT11 CH1602 LCD , paperuri:(3b07b32b5c4b7fa2295bad2975c40688) , dht11 arduino display 1602a , Arduino temperature & humidity DHT11 CH1602 LCD , 1602a diagram , dht11 and display 1602 connection to arduino , print humididt and temp to 1602a arduino , dht11 lcd 1602 arduino скетч , arduino dht 11 und lcd 1602 deutsch , arduino 1602A temperature