Now that we have install and assemble the controller here is a little project. we are going to build a thermometer.

Parts list

1. Arduino

1. I2C LCD

1. DHT11 Temp Sensor

1. 1k Resistor

7. Jumper wires


Step 1:

Connecting the LCD is very simple

LCD                 Arduino

5VCD               5VCD

GND                 GND

SDA                  PIN 20 (SDA on MEGA)

SCL                   PIN 21 (SCL on Mega)

Now the DHT11

DHT 11              Arduino

PIN 1                 5VCD

PIN2                  PIN 2

PIN 3                 N/A ( not used)

PIN 4                 GND

note: you can use a pull up resitor on PIN 2, but not necessary. Also you will need to install the library for the DHT11.

Step 2: THe Code

I am a beginner at this, so my programing  is not that great but it works.
It is very very basic and very simple.  

#include <Wire.h>                        //libraries needed
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <dht11.h>

//I2C Controller
#define I2C_ADDR    0x20  // Define I2C Address for controller
#define BACKLIGHT_PIN  7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3
#define  LED_OFF  0
#define  LED_ON  1

#define DHT11PIN 2

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
dht11 DHT11;

void setup()
    lcd.begin (16,2);
    // Switch on the backlight

void loop() 
  int chk = DHT11.read(DHT11PIN);
  lcd.print("Humy (%): ");
  lcd.print((float)DHT11.humidity, 2);
  lcd.print("Temp (oF): ");
  lcd.print(Fahrenheit(DHT11.temperature), 2);


//temp conversion
double Fahrenheit(double celsius)
        return 1.8 * celsius + 32;
<p>i test code manytime and have alltime different error, dht.h lcd.h not found, liguidcrystal.h not work. but i no found all libraries anywere. were have LCD and DHT11 and goow liguidcrystal_i2c, because i test many liguidc.h and any not working. my lcd addres i cahnge and work only test &quot;hello world&quot; 0x3F addres and this code(under) not working me alltiem error lcd.h, dht11.h and liguidcrustal.h i has load many different library but any not working :( i tes arduino ide 1.6.5 r2 1.6.7 1.6.11 and last not working anythink ecample code. what have proplem whit libraries ? i no understand.</p>
<p>Had to modify it for my LCD: </p><p>//I2C Controller</p><p>#define I2C_ADDR 0x3F // Define I2C Address for controller</p><p>#define BACKLIGHT_PIN 3</p><p>#define En_pin 2</p><p>#define Rw_pin 1</p><p>#define Rs_pin 0</p><p>#define D4_pin 4</p><p>#define D5_pin 5</p><p>#define D6_pin 6</p><p>#define D7_pin 7</p><p>#define LED_OFF 1</p><p>#define LED_ON 0</p>
<p>I couldn't make the library works, any help please? </p>
<p>this should help https://arduino-info.wikispaces.com/LCD-Blue-I2C</p>
<p>very thanks works after change somethings but it's works and i understand a little more how wire sensors </p>
<p>Very nice work. Thank you for taking the time to put this Ible together.</p>
<p>use </p><p>lcd.print((char)223); //degree sign<br> lcd.print(&quot;F&quot;); instead of &quot;oF&quot; for degree F ;)</p>

About This Instructable




Bio: Master Diesel Tech, in California. I love electronics and everything science .
More by verdelj:LED Video Array (the Easy Way) How to write a library the easy way Bootloading ATmega328 with Arduino Mega2560 
Add instructable to: