How to Make a Thermometer and LCD Work Together?

The aim of this tutorial is to show you how to use a DHT11 Thermometer which will display the temperature and humidity on a 16 x 2 LCD screen.

Step 1: What Is a Arduino?

Arduino is an open-source hardware and software company, project and user community that designs and manufactures single-board micro controllers and micro controller kits for building digital devices and interactive objects that can sense and control objects in the physical and digital world.

Step 2: What Is a Arduino Connecter Wire?

The arduino connector wire is a cable that allows us to send programming from a computer into a arduino micro controller, the wire is also used as a power supply for the micro controller.

Step 3: What Is a Thermometer

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacities humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using our library, sensor readings can be up to 2 seconds old.

Step 4: What Is a 16 X 2 LCD?

An LCD is an electronic display module which uses liquid crystal to produce a visible image. The 16×2 LCD display is a very basic module commonly used in DIYs and circuits. The 16×2 translates o a display 16 characters per line in 2 such lines

Step 5: What Is a Jump Wire?

A jump wire (also known as jumper wire, or jumper) is an electrical wire, or group of them in a cable, with a connector or pin at each end (or sometimes without them – simply "tinned"), which is normally used to interconnect the components of a breadboard or other prototype or to test a circuit.

Step 6: What Is a Potentiometer?

an instrument for measuring an electromotive force by balancing it against the potential difference produced by passing a known current through a known variable resistance.

Step 7: What Is the Arduino App?

The arduino app is a application which is used to send code from a computer to any of the arduino mini controllers, it can be downloaded at https://www.arduino.cc/en/Main/Software

Step 8: How to Program the LCD

An LCD screen has many different types of ports as seen above, there are many different types of pins but here are the ones that we will be using-

Rs pin- This pin is mainly used to control the memory of the LCD, meaning basically that it controls what goes on the screen and when it goes on the screen

R/W pin- This controls whether the LCD is being used for reading or writing

E pin- This pin corresponds directly to the Rs pin, as it is used to enable writing on the directory

The 8 Data Pins (0-7)- These data pins are used to read or write any things that may be one the registry

There are also many different types of pins remaining that power the LCD for example the 5v and the Gnd pins which are used to as stated earlier to power the LCD

Here are the types of pins and where the mins connect to and there is the diagram above if you need to see the board in a visual way.

"LCD RS pin to digital pin 12

LCD Enable pin to digital pin 11

LCD D4 pin to digital pin 5

LCD D5 pin to digital pin 4

LCD D6 pin to digital pin 3

LCD D7 pin to digital pin 2"

To allow the screen to work you need to include liquid crystal

I have posted the code below for you to copy and paste, just make sure that in the const int rs and the rest of the pins are correct

#include <LiquidCrystal.h>
<p>const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;</p><p>LiquidCrystal lcdrs, en, d4, d5, d6, d7);</p><p>void setup() {</p><p>lcd.begin(16, 2);</p><p>lcd.print("hello, world!");</p><p>}</p><p>void loop() {</p><p>lcd.setCursor(0, 1);</p><p>lcd.print(millis() / 1000);</p><p>}</p>

Step 9: How to Use the Thermometer With the LCD

The thermometer that we will be using is a thermometer that measures humidity as well as temperature, this is very useful for us as it is a 2 in 1 package, the dht11 Thermometer is also a very simple and easy thermometer to use.

To use the thermometer you will have to open your arduino app and download the libraries DHT.h ,DHT simple and liquid.crystal, after having installed these libraries you will need to make the circuit shown above while also having the LCD circuit that we did in the previous step also on the breadboard.

After having the Thermometer and the LCD hooked up to the circuit you will have to open the arduino app and enter the following code-

//We'll start by adding our libraries
#include

#include

//Declaring digital pin no 6 as the dht11 data pin

int pinDHT11 = 6; SimpleDHT11 dht11;

//Declaring the lcd pins

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() { // Don't forget to choose 9600 at the port screen Serial.begin(9600); //Telling our lcd to start up lcd.begin(16, 2); }

void loop() {

//These serial codes are for getting readings on the port screen aswell as the LCD display, since they'll offer us a more detailed interface Serial.println("================================="); Serial.println("DHT11 readings..."); byte temperature = 0; byte humidity = 0; int err = SimpleDHTErrSuccess;

//This bit will tell our Arduino what to do if there is some sort of an error at getting readings from our sensor if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL)) != SimpleDHTErrSuccess) { Serial.print("No reading , err="); Serial.println(err);delay(1000); return; } Serial.print("Readings: "); Serial.print((int)temperature); Serial.print(" Celcius, "); Serial.print((int)humidity); Serial.println(" %"); //Telling our lcd to refresh itself every 0.75 seconds lcd.clear(); //Choosing the first line and row lcd.setCursor(0,0); //Typing Temp: to the first line starting from the first row lcd.print("Temp: "); //Typing the temperature readings after "Temp: " lcd.print((int)temperature); //Choosing the second line and first row lcd.setCursor(0,1); //Typing Humidity(%): to the second line starting from the first row lcd.print("Humidity(%): "); //Typing the humidity readings after "Humidity(%): " lcd.print((int)humidity); delay(750); }

Step 10: Ending

Thank you all for reading this tutorial

If you guys have any more questions that you would like answered please do not hesitate to email me at bmustafa1@abaoman.org

Thank you

Share

    Recommendations

    • First Time Author

      First Time Author
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • PCB Contest

      PCB Contest

    Discussions