Ethernet + DHT11

I have a sketch connected to a breadboard with an Ethernet shield, LCD, pots for the LCD, LED, and a DHT11 (temperature) sensor. I'm using an uno.

The temperature sensor is what was added last and I get read failures when trying to read temperatures using the DHT library.

I finally narrowed it down to the Ethernet.begin call
{
/* Ethernet.begin(MAC_ADDR, MY_IP);
delay(1000); */
}

If I comment this out the DHT11 works fine.
It doesn't matter whether I have the DHT11 connected to 3.3 or 5V
Any ideas ?

failures when trying to read temperatures using the DHT library.

There does not exist THE DHT11 library as there are several slightly different.

Please post your complete code, and a link to the library used.
Furthermore the schematic is important.

It was easier to take the public sketch and add the ethernet stuff to it - same result, it won't work without ethernet.begin commented out.

You were right about the library, it's DHT; not DHT11

The pics should show how it's connected but there are comments in the code as well.

#include <stdio.h>
#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>

#include "DHT.h"
#define DHTPIN 12 // what pin we're connected to

#define DHTTYPE DHT11 // DHT 11

// gnd = ground
// ucc = 5v or 3.3 v
// dat = an available aruino pin

DHT dht(DHTPIN, DHTTYPE);

// Wired Ethernet
EthernetClient client;

byte MAC_ADDR[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; // MAC of Arduino Ethernet Shield
IPAddress MY_IP(192, 168, 1, 177); // ip addrress of Ethernet Shield

void setup() {
Serial.begin(9600);
Serial.println("DHTxx test!");
Ethernet.begin(MAC_ADDR, MY_IP);
delay(1000);

dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
delay(5000);

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();
// Read temperature as Fahrenheit
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

// Compute heat index
// Must send in temp in Fahrenheit!
float hi = dht.computeHeatIndex(f, h);

Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hi);
Serial.println(" *F");
}

I have a sketch connected to a breadboard

I'd like to see how you managed THAT.

Get rid of the serial print in the setup and try another pin, not pin 10.

pins 8 and 9 work, anything higher than 9 has the same problem UNLESS I get rid of the ethernet.begin.

I know those pins work, they're not dead.
Thanks for the help but do you have any idea what the real issue is?

Mike505:
pins 8 and 9 work, anything higher than 9 has the same problem UNLESS I get rid of the ethernet.begin.

I know those pins work, they're not dead.
Thanks for the help but do you have any idea what the real issue is?

he did identify the real issue...

your Ethernet shield uses SPI, which is busy with pins 10-12.

when you comment out the ethernet.begin(), you are 'turning off' SPI and the pins behave as you expect.

Yup, read up on your shield. They will use pins you can't interfere with. Pin 4 is used for the sd card for future reference.

Thanks Mistergreen,
As indicated I'm new at this and was not aware of that restriction.
My assumption was that any pins on the shield that should be avoided would not by made available as a pass thru down to the uno below.

My assumption was that any pins on the shield that should be avoided would not by made available as a pass thru down to the uno below.

How the heck do you expect the shield to communicate with the Arduino, then? Mind-reading?