DHT11 interferes with 4 digit 7 segment display on multifunction shield

Hello,

I try to use Multi-function shield (multi function shield examples) together with DHT11 temparature and humidity sensor (https://arduino-info.wikispaces.com/DHT11-Humidity-TempSensor).

Both shield and sensor are working fine separately, but when I connect both of them - during reading data from DHT11 first 3 digits go blank, only last one (4th) stays lit. I can see it lights up values for a few miliseconds. I expect that display will be constantly on, two digits showing temperature, and two - humidity. Serial monitor shows values right.

I’m using Arduino Uno and multi-function shield mentioned above. DHT11 is connected to shield’s connectors (gnd, +5V, D5), but same happens, if I use D6 or D9 for data. I’m using DHT sensor library, same result with SimpleDHT library.

My code:

#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 5
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

/* Define shift register pins used for seven segment display */
#define LATCH_DIO 4
#define CLK_DIO 7
#define DATA_DIO 8

void setup(void)
{
  Serial.begin(9600);
  dht.begin();

  /* Set LCD DIO pins to outputs */
  pinMode(LATCH_DIO, OUTPUT);
  pinMode(CLK_DIO, OUTPUT);
  pinMode(DATA_DIO, OUTPUT);
}

void loop(void)
{
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT");
  }

  WriteNumberToSegment(0 , round(temperature) / 10);
  WriteNumberToSegment(1 , round(temperature) % 10);
  WriteNumberToSegment(2 , round(humidity) / 10);
  WriteNumberToSegment(3 , round(humidity) % 10);

  Serial.print(" Temp: ");
  Serial.print(temperature);
  Serial.print(" Humidity: ");
  Serial.print(humidity);
  Serial.println();

  delay(2000);
}

/* Multifunctional shield */
/* Write a decimal number between 0 and 9 to one of the 4 digits of the display */
void WriteNumberToSegment(byte Segment, byte Value)
{
  /* Segment byte maps for numbers 0 to 9 */
  const byte SEGMENT_MAP[] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0X80, 0X90};
  /* Byte maps to select digit 1 to 4 */
  const byte SEGMENT_SELECT[] = {0xF1, 0xF2, 0xF4, 0xF8};

  digitalWrite(LATCH_DIO, LOW);
  shiftOut(DATA_DIO, CLK_DIO, MSBFIRST, SEGMENT_MAP[Value]);
  shiftOut(DATA_DIO, CLK_DIO, MSBFIRST, SEGMENT_SELECT[Segment] );
  digitalWrite(LATCH_DIO, HIGH);
}

Maybe someone encountered and solved same problem?

Regards,
Marius

Why do you need the multi-function shield?

ieee488:
Why do you need the multi-function shield?

For my project I need display and buttons anyway and those three digital pins are handy to me to use dupont jumper cables.
This is much convenient, than solder everything on prototype shields manually as long as I'm ok with "hard-wired" digital pins.