

The line temperature = 223 means adding the degree symbol (°).Previously, we published how to interface and run 1602A blue backlight 16×2 LCD and also some projects with that display.

The number 48 is used to convert decimal numbers to AscII because the LCD works with AscII format.

For example if the temperature value is 42 => 42 / 10 = 4 and 42 % 10 = 2. Temperature = Temp % 10 + 48 (Temp%10 equals to the remainder of Temp/10)Īnd this line means the 8th character of the array is equal to the ones of temperature value. This line means the 7th character of the array is equal to the tens of temperature value For example the temperature value is copied to the array temperature as follows: Humidity and temperature values are copied to the previous arrays before displaying it. The values of the humidity and temperature needs to be displayed on the LCD after the reading, and for that I used two character arrays named: temperature (char temperature = “Temp = 00.0 C “ ) and humidity (char humidity = “RH = 00.0 % “ ). Since the DHT11 sensor resolution is 1, the values of the humidity and temperature are stored in two variables with type byte (8-bit unsigned), I named them RH (for the humidity) and Temp (for the temperature). This library initiates the DHT11 sensor and reads the values of the humidity and temperature. In this interfacing I used DHT sensors library (DHT11, DHT21 and DHT22) from Adafruit. The 10K variable resistor is used to control the contrast of the LCD screen and the 330 ohm resistor supplies the LCD backlight LED. A pull-up resistor should be added to the data pin with a value between 4.7K and 10K. Our interfacing circuit diagram is shown below.Īs show in the circuit schematic the DHT11 sensor has 4 pins: VCC (+5V), Data, NC(not connected pin) and GND (from left to right). This topic shows how to interface Arduino UNO board with DHT11 digital humidity and temperature sensor where the measure humidity and temperature are displayed on 1602 LCD screen.Īrduino + DHT11 + LCD connection circuit:
