Arduino W5500 Ethernet Web Server: Wiring, Code and Simulator
To build this Arduino W5500 Ethernet Web Server project you need an Arduino Uno and a W5500 ethernet module and a potentiometer. An EthernetServer on port 80 answers each visitor with the reading on A0. Make the 9 connections in the wiring table, upload the Arduino C++ code, and open the page from the Modules tab’s LAN browser, turn the knob and reload.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | W5500 Ethernet module | Wired Ethernet on SPI: VCC 3.3 V, GND, CS to pin 10, SCK/MOSI/MISO to the board’s SPI pins. Ethernet.begin(mac) gets an address from the lab router by DHCP; EthernetClient fetches web pages, and an EthernetServer’s page opens from the Modules tab. |
| 1 | Potentiometer | VCC to 5V, GND to GND, SIG to an analog pin. Drag the knob; analogRead gives 0–1023. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 3.3V | W5500 Ethernet module VCC |
| 2 | Arduino Uno GND | W5500 Ethernet module GND |
| 3 | Arduino Uno pin 10 | W5500 Ethernet module CS |
| 4 | Arduino Uno pin 13 | W5500 Ethernet module SCK |
| 5 | Arduino Uno pin 11 | W5500 Ethernet module MOSI |
| 6 | Arduino Uno pin 12 | W5500 Ethernet module MISO |
| 7 | Arduino Uno A0 | Potentiometer SIG |
| 8 | Arduino Uno 5V | Potentiometer VCC |
| 9 | Arduino Uno GND | Potentiometer GND |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a W5500 ethernet module and a potentiometer from the parts palette.
- Wire 1. Connect Arduino Uno 3.3V to W5500 Ethernet module VCC.
- Wire 2. Connect Arduino Uno GND to W5500 Ethernet module GND.
- Wire 3. Connect Arduino Uno pin 10 to W5500 Ethernet module CS.
- Wire 4. Connect Arduino Uno pin 13 to W5500 Ethernet module SCK.
- Wire 5. Connect Arduino Uno pin 11 to W5500 Ethernet module MOSI.
- Wire 6. Connect Arduino Uno pin 12 to W5500 Ethernet module MISO.
- Wire 7. Connect Arduino Uno A0 to Potentiometer SIG.
- Wire 8. Connect Arduino Uno 5V to Potentiometer VCC.
- Wire 9. Connect Arduino Uno GND to Potentiometer GND.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Open the page from the Modules tab’s LAN browser, turn the knob and reload.
Arduino C++ code
// W5500 web server: a page with the reading on A0. Open it from the Modules tab's LAN browser.
// CS -> 10, SCK -> 13, MOSI -> 11, MISO -> 12, VCC 3.3V, GND. A potentiometer on A0.
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 };
EthernetServer server(80);
void setup() {
Serial.begin(115200);
Ethernet.init(10);
if (Ethernet.begin(mac) == 0) { Serial.println(F("DHCP failed")); while (true) {} }
server.begin();
Serial.print(F("Server at http://"));
Serial.println(Ethernet.localIP());
}
void loop() {
EthernetClient client = server.available();
if (!client) return;
Serial.println(F("New visitor"));
bool blank = true;
while (client.connected()) {
if (!client.available()) continue;
char c = client.read();
Serial.write(c);
// The request ends with an empty line: answer it.
if (c == '\n' && blank) {
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));
client.println(F("Connection: close"));
client.println();
client.print(F("<h1>Uno + W5500</h1><p>A0 reads <b>"));
client.print(analogRead(A0));
client.print(F("</b> after "));
client.print(millis() / 1000);
client.println(F(" s.</p>"));
break;
}
if (c == '\n') blank = true;
else if (c != '\r') blank = false;
}
delay(1);
client.stop();
Serial.println(F("Visitor served"));
}
What to try
Open the page from the Modules tab’s LAN browser, turn the knob and reload.
Frequently asked questions
How do I wire the W5500 Ethernet Web Server project on an Arduino Uno?
Make 9 connections: Arduino Uno 3.3V to W5500 Ethernet module VCC; Arduino Uno GND to W5500 Ethernet module GND; Arduino Uno pin 10 to W5500 Ethernet module CS; Arduino Uno pin 13 to W5500 Ethernet module SCK; Arduino Uno pin 11 to W5500 Ethernet module MOSI; Arduino Uno pin 12 to W5500 Ethernet module MISO; Arduino Uno A0 to Potentiometer SIG; Arduino Uno 5V to Potentiometer VCC; Arduino Uno GND to Potentiometer GND.
What parts do I need for this Arduino project?
An Arduino Uno and a W5500 ethernet module and a potentiometer.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
An EthernetServer on port 80 answers each visitor with the reading on A0.
How do I open my Arduino Ethernet web server?
Print Ethernet.localIP() and type that address into a browser on the same network. In the simulator, open it from the LAN browser in the Modules tab.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator