Since I had an Arduino ethernet shield I was eager to try it out. I thought that this was going to be a very difficult thing to get working, since I had bought the ethernet shield without knowing much about it. I was very pleased to find out that the shield was based on the Wiznet 5100 chip, this chip is supported by the ethernet library in the Arduino ide. So I had a look in the examples folder of this library and found the webserver sketch. I changed the IP address and added some code to get the reading of a DHT22 sensor. All pretty straightforward, 30 minutes later I had a working webserver giving me the temperature and humidity values of the DHT22 sensor.
Here is the sketch I used:
/*
http://www.bajdi.com
Web Server showing the values from a DHT22 sensor
*/
#include <SPI.h>
#include <Ethernet.h>
#include <dht.h>
dht DHT;
#define DHTTYPE DHT22 // Sensor type
#define DHT22_PIN 4 // Data pin of DHT22 sensor
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 10 };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
}
void loop()
{
int chk = DHT.read22(DHT22_PIN);
// listen for incoming clients
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
// output the value of the DHT22 sensor
client.print("Arduino powered webserver");
client.println("<br />");
client.print("Serving temperature and humidity values from a DHT22 sensor");
client.println("<br />");
client.print("Temperature (oC): ");
client.print(DHT.temperature);
client.println("<br />");
client.print("Humidity (%): ");
client.print(DHT.humidity);
client.println("<br />");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}

Hi, I tried your example , but my DHT22 gives out:
Arduino powered webserver
Serving temperature and humidity values from a DHT22 sensor
Temperature (oC): -999.00
Humidity (%): -999.00
I try to verify this sketches but eror because i havent library of dht.h. where can I get that library? please help me to solving my problem mr/ms.
You can download it from the Arduino website: http://playground.arduino.cc/Main/DHTLib