---
title: "Arduino Webserver with W5500 Shield"
url: "https://maker.wiznet.io/junlee0615/projects/arduino-webserver-with-w5500-shield/"
markdown_url: "https://maker.wiznet.io/junlee0615/projects/arduino-webserver-with-w5500-shield/md"
type: "UCC: User Created Content"
author: "E"
author_url: "https://arduinodiy.wordpress.com/2024/04/29/arduino-webserver-with-w5500-shield/"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "E"
original_url: "https://arduinodiy.wordpress.com/2024/04/29/arduino-webserver-with-w5500-shield/"
published: "2025-08-28"
language: "en"
tags: ["Arduino", "W5500", "Ethernet", "Webserver", "DS18B20"]
hardware: ["Arduino Ethernet Shield 2", "Arduino UNO", "DFRobot Gravity: DS18B20 Temperature Sensor (Arduino Compatible)"]
likes: 0
views: 3349
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Arduino Webserver with W5500 Shield

> Build a nostalgic Arduino webserver using the WIZnet W5500 shield and a DS18B20 sensor to serve live temperature over HTTP.

Original author: E (source: https://arduinodiy.wordpress.com/2024/04/29/arduino-webserver-with-w5500-shield/)

## Components

- **Arduino Ethernet Shield 2** x 1 ([docs](https://docs.arduino.cc/hardware/ethernet-shield-rev2))
- **Arduino UNO** x 1 ([docs](https://www.farnell.com/datasheets/1682209.pdf))
- **DFRobot Gravity: DS18B20 Temperature Sensor (Arduino Compatible)** x 1 ([docs](https://www.dfrobot.com/wiki/index.php/Gravity:_DS18B20_Temperature_Sensor_%28Arduino_Compatible%29_V2_SKU:_DFR0024))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))

## Article

Arduino W5500 Webserver with DS18B20 — Simple Hardware TCP/IP Temperature Page

## Introduction

This project revives a classic: an Arduino webserver that displays live temperature readings in a browser. Using the **WIZnet W5500** Ethernet shield for hardware TCP/IP and a **DS18B20** temperature sensor on the OneWire bus, we serve a minimal HTML page that anyone on the local network can view.

## WIZnet Product Integration

The **W5500** handles TCP/IP and Ethernet packet processing in hardware, minimizing MCU overhead. The shield connects to Arduino over **SPI** (ICSP header), letting the sketch focus on sensor reading and string formatting. A simple **EthernetServer** on port **80** responds to HTTP requests and prints the current temperature.

## Technical Implementation

### Wiring

**DS18B20 → ArduinoDQ (data)** → **D2** (OneWire bus)

**VDD** → **5V** (or 3.3V per sensor spec)

**GND** → **GNDPull‑up**: 4.7 kΩ between **DQ** and **VDDW5500 Shield**

Stacked on Arduino; uses **SPI via ICSP**.

Default chip‑selects (for reference): **D10** for Ethernet, **D4** for SD (SD unused here).

![Generated image](https://sdmntprwestus2.oaiusercontent.com/files/00000000-ff1c-61f8-b123-f18b5108d0e8/raw?se=2025-08-27T23%3A25%3A27Z&sp=r&sv=2024-08-04&sr=b&scid=d0bcf911-bbc8-5579-8f34-00d4e0a45bcc&skoid=5c72dd08-68ae-4091-b4e1-40ccec0693ae&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-08-27T20%3A19%3A13Z&ske=2025-08-28T20%3A19%3A13Z&sks=b&skv=2024-08-04&sig=M4gL3A5YiCPy54oZvNyKYmLOheOOJXNymvcv7FXvEq0%3D)

### Network Setup

**Static IP** (in sketch): `Ethernet.begin(mac, ip);`

Optional **DHCP**: replace with `Ethernet.begin(mac);` to obtain an address from your router.

Access from a browser at `http://<board_ip>/`.

### Sketch (Complete)

#include &lt;Ethernet.h> // Library for W5500-based Ethernet shield

Serial.begin(9600); // Start the serial communication for debugging

// Set up the Ethernet shield with a fixed MAC address and IP address

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC address

IPAddress ip(192, 168, 1, 177); // Local IP address (adjust as needed for your network)

// Start the Ethernet and the server

Ethernet.begin(mac, ip);

server.begin();

Serial.print("Server is at ");

Serial.println(Ethernet.localIP());

// Start the temperature sensor

sensors.begin();

}

void loop() {

// Check for incoming client connections

EthernetClient client = server.available();

if (client) {

Serial.println("New client connected");

boolean currentLineIsBlank = true;

while (client.connected()) {

if (client.available()) {

char c = client.read();

// If the request is complete (double newline), send the response

if (c == '\n' && currentLineIsBlank) {

sensors.requestTemperatures(); // Request temperature

float temperature = sensors.getTempCByIndex(0); // Get temperature in Celsius

// Send the HTTP response headers

client.println("HTTP/1.1 200 OK");

client.println("Content-Type: text/html");

client.println("Connection: close"); // Connection will close after this response

client.println();

// Send the HTML content with temperature

client.println("&lt;!DOCTYPE HTML>");

client.println("&lt;html>");

client.println("&lt;h1>Temperature Monitor&lt;/h1>");

client.print("&lt;p>Temperature: ");

client.print(temperature);

client.println(" °C&lt;/p>");

client.println("&lt;/html>");

break;

}

if (c == '\n') {

currentLineIsBlank = true;

} else if (c != '\r') {

currentLineIsBlank = false;

}

}

}

// Close the connection with the client

client.stop();

Serial.println("Client disconnected");

}

}

## Core Features and Behavior

**Static IP webserver** on port **80** serving a minimal HTML page.

**Live temperature** read from DS18B20 on each HTTP request.

Connection is **closed** after responding, keeping the server simple and robust.

## Code Analysis

`EthernetServer server(80)` creates the TCP listener; `server.available()` yields a client when connected.

A double newline (`\r\n\r\n`) marks the end of the HTTP request headers; the code checks for a blank line using `currentLineIsBlank`.

Before responding, `sensors.requestTemperatures()` triggers a OneWire conversion; `getTempCByIndex(0)` fetches the first sensor’s reading.

Response includes essential HTTP headers and a minimal HTML body.

## Applications and Use Cases

Lab dashboards and classroom demos.

Local environment monitoring on wired networks.

Embedding into larger projects as a simple status page.

## Troubleshooting & Tips

**IP/Subnet**: Ensure the static IP matches your LAN subnet and isn’t already in use.

**DHCP**: If preferred, switch to DHCP (router must support it) and print the assigned IP via `Ethernet.localIP()`.

**Sensor wiring**: DS18B20 requires a **4.7 kΩ** pull‑up on DQ; noisy/long cables may need careful routing.

**Mega compatibility**: When using Arduino Mega, keep **pin 53** as **OUTPUT** for SPI to work.

**SD coexistence**: If the shield’s SD is unused, keep CS (D4) **HIGH**. If used, only one device on SPI may be active at a time.

## Conclusion

Using the **WIZnet W5500** Ethernet shield and a **DS18B20** sensor, this project demonstrates a clean, nostalgic Arduino webserver pattern. With hardware TCP/IP offload and a tiny HTML page, it’s a perfect starting point for wired IoT dashboards, status pages, or classroom exercises.

---

Source: https://maker.wiznet.io/junlee0615/projects/arduino-webserver-with-w5500-shield/
