Introduction: Portable Arduino Uno Temperature and Humidity Sensor With LCD Screen

Picture of Portable Arduino Uno Temperature and Humidity Sensor With LCD Screen

Hey everybody. I have gotten a lot of great ideas from instructables over the years. As this is my first 'ible, I figure I would share something I made as well. I am entering this into the Full Spectrum Laser Contest 2016. If I were to win, I would be able to 3d print a case for this project and use the laser engraver to etch an awesome design into the case. If you enjoy this 'ible, please vote for me.

In this Instructable, I am going to show you how I made a temp and humidity sensor with an Arduino Uno. My end goal is to make one with an Attiny84 and etch a PCB for it. While I do have the parts and pieces to do this, the weather outside is not cooperating. It is hard to etch a board in my garage at less than 10 degrees Fahrenheit. That will be a different instructable for a later date.

Without further delay, here is my instructable. Thanks again for taking time to read my project.

Step 1: Parts BOM

Picture of Parts BOM

To start out, the following is required for this project:

All parts can be purchased at sparkfun or adafruit. Or you can do as I do and salvage as much as you can from old devices.

  • Arduino (I used an UNO R3, but 5V any will work)
  • Breadboard
  • DHT11 temperature and humidity sensor
  • 10k ohm potentiometer
  • 16x2 LCD screen
  • tactile button
  • USB A-B cable
  • Power Bank
  • Jumper Wires

Step 2: Building the Circuit

Picture of Building the Circuit

Now it is time to attach all the wires to the devices. Please refer to the Fritzing schematic (please note I do not have jumper wires between the two power rails on the breadboard. you will need them if you use both):

The LCD display I am using was recovered from an old fire alarm annunciator panel. Pins 15 & 16 are located before Pin 1 and instead of Pin 16 being Gnd, it is actually 5v and Pin 15 is Gnd. Please double check your own display and make sure your pins are correct. As my display pinout is most likely different from almost everybody else, I have made the Fritzing schematic with the "standard" display instead of my exact pinout.


Gnd --> negative rail on breadboard

5v --> positive rail on breadboard


Pin1 --> 5v and 10k ohm resistor

Pin2 --> Arduino Pin8 and 10k ohm resistor

Pin3 --> no connection

Pin4 --> Gnd

16x2 LCD Screen

Pin1 --> Gnd

Pin2 --> 5v

Pin3 --> 10k ohm potentiometer wiper pin ( middle pin. the other two pins on the POT go to 5v and Gnd)

Pin4 --> Arduino Pin12

Pin5 --> Gnd

Pin6 --> Arduino Pin11

Pin7 --> no connection

Pin8 --> no connection

Pin9 --> no connection

Pin10 --> no connection

Pin11 --> Arduino Pin5

Pin12 --> Arduino Pin4

Pin13 --> Arduino Pin3

Pin14 --> Arduino Pin2

Pin15 --> 5v

Pin16 --> Tactile button (other side of tack button goes to Gnd)

Step 3: The Code

Below is the code:

I used the DHT library from Adafruit.


// include the library code:
#include "DHT.h"

// set the DHT Pin #define DHTPIN 8

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define DHTTYPE DHT11


void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);


// Print a message to the LCD.

lcd.print("Temp: Humidity:"); }

void loop() {


// set the cursor to column 0, line 1

// (note: line 1 is the second row, since counting begins with 0):

lcd.setCursor(0, 1);

// read humidity

float h = dht.readHumidity();

//read temperature in Fahrenheit

float f = dht.readTemperature(true);

if (isnan(h) || isnan(f)) {







lcd.print(" F");






Step 4: Finished!

Picture of Finished!

After all of the wiring, plug your power bank to the Arduino.

Your LCD display and DHT11 should start up. Press the tact button and your LCD backlight should light up.

Now you have a portable temperature and humidity sensor with a real time display.

This has helped me determine my draftiest windows in my house and how best to set my house ventilation.

Thanks again for taking the time to read my first instructable.


Thanks to Waggabob, the LCD display has been updated to display the degree symbol. I also added the % symbol to the humidity. (see last picture for updated display)


Mousepotato01 (author)2017-08-08

when I try to verify then upload I get this message please help I am very new to this stuff.

( C:\Users\Dans\Desktop\ARDUINO STARTERKITS\code\DHT11_interface_with_arduino_and_lcd\DHT11_interface_with_arduino_and_lcd.ino:46:19: fatal error: DHT11.h: No such file or directory

#include <DHT11.h>


compilation terminated.

exit status 1

Error compiling for board Arduino/Genuino Uno.)

ThothLoki (author)Mousepotato012017-08-08

recheck step 3. you need to download and install the DHT library from Adafruit

NickM51 (author)2016-12-24

when I try to download it, I get the error

exit status 1

'LiquidCrystal' does not name a type.

StefanS96 made it! (author)2016-07-04

Great project. Something weird happened, though. At first the display started giving gobbledygook (see blue-hued image). Then, after trying a bunch of things, I tried putting the DHT11 VCC pin and the Data pin on separate resisters. The schematic shows them sharing the same resistor.

Now it seems to work (see red-hued image, it no longer gives gobbledygook). Not sure how putting them on two separate resistors would make a difference?

Now, though, the temp and humidity will only read as "0". Perhaps my sensor isn't working properly. I've just ordered a new DHT11 (and a DHT22) component. I'll see what happens when they arrive.

ThothLoki (author)StefanS962016-07-04

Hey StefanS96. Thanks for checking my ible out. Honestly, that resistor should have no bearing on the LCD. Most schematics I see, there is not even a resistor but I put that in to fix something that went wrong during my build. I don't know if two make a difference, it is hard to see how they are hooked up on yours.

As for the DHT. First thing I would check is power. I did not see your DHT led on (if it has one). It could be a bad sensor, but without more detail, it will be hard to help.

StefanS96 (author)ThothLoki2016-07-18

Got a different sensor and it works!

ThothLoki (author)StefanS962016-07-18

Awesome! Glad to hear.

MarkoM3 made it! (author)2016-05-11

I made it, but it does not work. It shows 0. why??
In the code I #define DHTTYPE DHT11 replace with #define DHTTYPE DHT22 but still not working

ThothLoki (author)MarkoM32016-05-11

Hey MarkoM3! Thanks for checking out my project.
First, I would check your power. I don't know, but from the picture, it looks like the DHT22 is plugged into the power rails but there is no power going to the power rails from the Arduino.

MarkoM3 (author)ThothLoki2016-05-12

No, it is not plugged into the power rails. It plugged same as on your schematic on j 1234

MarkoM3 (author)MarkoM32016-05-12

I solve the problem! But, how to display temp in celsius?

ThothLoki (author)MarkoM32016-05-12

Do you mind sharing what the problem was?

MarkoM3 (author)ThothLoki2016-05-12

I am not connected one side to the other(+ and -) like that

ThothLoki (author)MarkoM32016-05-12

Awesome!! Glad it all works!

ThothLoki (author)MarkoM32016-05-12

I am not near my computer but this version of the dht library, all you should have to do is change
float f = dht.readTemperature(true);
To this
float f = dht.readTemperature(false);

Let me know if that works for you. I will try and check out when I get back to my workbench

MarkoM3 (author)ThothLoki2016-05-12

it is working. thanks

muhammet resule (author)2016-04-05

The code doesnt work. Here is the error code

LCD_DHT11:11: error: 'DHT' does not name a type



/Users/masteruser/Downloads/LCD_DHT11/LCD_DHT11.ino: In function 'void setup()':

LCD_DHT11:16: error: expected unqualified-id before '.' token



/Users/masteruser/Downloads/LCD_DHT11/LCD_DHT11.ino: In function 'void loop()':

LCD_DHT11:28: error: expected primary-expression before '.' token

int h = dht.readHumidity();


LCD_DHT11:30: error: expected primary-expression before '.' token

int f = dht.readTemperature(true);


exit status 1

'DHT' does not name a type

Hey muhammet resule. Thanks for checking out my 'ible.

Did you install Adafruit's DHT library? That is what I used and the only one I could make work. Make sure you have the DHT library installed and everything should work well.

yes i already installed the library, this is the error code after i install the library...

Ok. First, where did you install your library? If using windows, there usually ends up being a library folder in the C:\Arduino\ path and the ~Documents\Arduino path. Make sure it is installed correctly. I am on a mac now and have only one location but also have a Win 10 pc that always gives me a twist when installing a library.

Second, did you copy the code from the page or download the .ino file?

Can you post your code?

zoligarden (author)2016-03-19

cool, thanks

kooth (author)2016-02-13

Very nice Instructable! Thanks for sharing!

WaggaBob (author)2016-02-11

These projects are a great way to start with Arduinos! Can I make 2 suggestions. Firstly if you can get a DHT22 sensor they have better accuracy for not much more cost. Second, you can include the "degrees" symbol like this:


That makes it look nicer on the screen.

ThothLoki (author)WaggaBob2016-02-11

Thanks WaggaBob. I made the changes and it looks a lot better. I did update the instructable. I agree with the DHT22. I am using a DHT11 because I was gifted 10 of them. For what I have been using this for, 1-2 degrees is rounding error.

tomatoskins (author)2016-02-11

This is great! Thanks for sharing you project! Welcome to the community!

About This Instructable




Bio: Guy in his 30's who has always had an interest in building things since a kid. I build hardware durning the summer and software ... More »
More by ThothLoki:Spinner 8Play Video With Python and GPIOPortable Arduino Uno Temperature and Humidity Sensor with LCD Screen
Add instructable to: