Introduction

About this project: In this lesson, we will show how to use W5100 Ethernet Shield and Arduino UNO board to work as Web Server to get remote temperature/humidity from DHT11 sensor and control LED throw browser(or mobile APP).

Preparation

Hardware: Software:

Connection

Arduino board DHT11
3.3v or 5v VCC
D7 S(data)
GND GND
Arduino board LED
D8 LED long pin
GND LED short pin through resistance

Upload Sketch

Connect the Arduino UNO board to computer via USB cable,download sketch from http://www.osoyoo.com/driver/w5100webserver.ino and load it into Arduino IDE(Version1.6.4+), Make sure DHT library library has been installed in Arduino IDE. If you have not installed these library, read Lesson 1 and DHT library installation guide: After do that,choose the corresponding board type and port type as below Now you might need to change the IP address of the sketch code line 8 and make sure it is in the same network of your router. For example, If your router gate ip address is 192.168.1.1, you should set your UNO board IP as 192.168.1.xxx (xxx can be any number from 1 to 255, but can not conflict with other device IP existing in your LAN). In my case, my router gateway IP is 192.168.0.1, so I select 192.168.0.166 as device IP which will not conflict with other device IP in same network. thus, line 8 in my sketch read as following:
byte ip[] = { 192, 168, 0, 166 };
Now you can upload the sketch code to Arduino UNO by click UPLOAD button(press Ctrl+U key)

Running Result

When the code is running  in Arduino board, open the Serial Monitor(set baud rate to 9600in lower right corner), you will see no result at this moment, open your browser and visit your device IP matches sketch line 8(in my case, I type http://192.168.0.166) , you will following page: You can see the temperature and humidity data in browser which are collected by DHT11 sensor which is connected to D8 pin. Now in your Arduino IDE serial monitor, you will see something like GET /...... , this is the message comes from remote browser. When you click Turn on LED button in this page, the LED connected to D7 will turn on.  The serial monitor will shows GET /?LEDON HTTP/1.1 , this is the message from browser which told Arduino to turn on LED. Now When you click Turn off LED button in browser page, the LED connected to D7 will turn off.  The serial monitor will shows GET /?LEDOFF HTTP/1.1 , this is the message from browser which told Arduino to turn off LED. .