Issue with i2c display and DHT11 sensor

I'm new to Arduino, but a fairly able programmer and the project I'm working on is going to use these two components...

I have the display working no problem, and the basis for my testing is here:

However, the issue I have is that only the sensor or the display work... i.e if I comment out the


(actually changed to 16,2 for my display)

Then the serial monitor shows me the readings coming in no problem... However as soon as I allow that line to execute, the serial monitor reports "Read sensor: Time out error", or the loop fails to execute at all and I get a dark display and only a power cycle will kick it back into life

If I disconnect the DHT-11 and reset, the LCD initialises, I get the first line of text, but obviously no readings...

Any clues???

I think you are using the same pin for the DHT11 and the LCD display.

Which LCD display are you using ? How is it connected ? Do you use that sensor shield ?

The only shared pins are 5V & GND.

The signal leg of the DHT11 is connected to D2, and the display is connected to SCL & SDA.

I'm not using the sensor shield, it's all connected through a breadboard as a precursor to a PCB.

Can you add a pull-up resistor of 4k7 or 10k from the signal wire of the DHT11 to +5V ? That might do the trick.

Do you use a special library for the DHT11 with special bugs in it ? It should not be very complicated. This is a normal library:

If you power everything with a weak usb power, the display backlight might need too much current, causing a voltage drop for the DHT11. You can test it by using a power supply to the DC jack plug of the Arduino board.

A breadboard can have bad contacts, maybe you can move the components to another location. The ATmega328p microcontroller itself is not on the breadboard I hope ? If that is the case, please upload a photo of it.

I'm waiting for some 10k resistors to be delivered, so will certainly try that...

In the meantime though; That is indeed the library I am using, and as I say the DHT11 works fine in isolation, as does the LCD, just not together.

I am however, using the USB port on my Mac to power the Arduino, so will dig out a 5v PSU to try as I have observed odd backlight behaviour.

Have tried moving components around already, so I don't think that's the issue.

Don't worry! Using an Arduino Leonardo, the breadboard is just to prototype the circuit ;)

Do they have the same I2c address, see I2C scanner sketch

// --------------------------------------
// i2c_scanner
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.

#include <Wire.h>

void setup()

  Serial.println("\nI2C Scanner");

void loop()
  byte error, address;
  int nDevices;


  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    error = Wire.endTransmission();

    if (error == 0)
      Serial.print("I2C device found at address 0x");
      if (address<16) 
      Serial.println("  !");

    else if (error==4) 
      Serial.print("Unknow error at address 0x");
      if (address<16) 
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");

  delay(5000);           // wait 5 seconds for next scan