---
title: "UART-over-Ethernet-v2"
url: "https://maker.wiznet.io/lawrence/projects/uart-over-ethernet-v2/"
markdown_url: "https://maker.wiznet.io/lawrence/projects/uart-over-ethernet-v2/md"
type: "UCC: User Created Content"
author: "Justin Widen"
author_url: "https://github.com/jwidess/UART-over-Ethernet-v2"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Justin Widen"
original_url: "https://github.com/jwidess/UART-over-Ethernet-v2"
published: "2026-04-19"
language: "en"
tags: ["Arduino", "Arduino Ethernet Shield"]
hardware: ["Arduino Mega 2560", "Arduino Ethernet Shield"]
likes: 0
views: 327
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# UART-over-Ethernet-v2

> Arduino Mega + W5500 create a transparent serial-to-Ethernet bridge with heartbeat, CLI setup, and EEPROM storage—ideal for retro-fitting legacy RS-232 gear.

Original author: Justin Widen (source: https://github.com/jwidess/UART-over-Ethernet-v2)

## Components

- **Arduino Mega 2560** x 1 ([docs](https://www.farnell.com/datasheets/1674878.pdf?_ga=2.12759806.871556650.1519619484-654667508.1508905608&_gac=1.209399078.1518779130.EAIaIQobChMI97my66Sq2QIV77ftCh01kgA_EAMYASAAEgKPyvD_BwE))
- **Arduino Ethernet Shield** x 1 ([docs](https://docs.arduino.cc/retired/shields/arduino-ethernet-shield-without-poe-module))

## Article

## DESCRIPTION

### Project Overview

The project converts raw UART streams into TCP/IP packets and vice-versa, enabling **legacy serial devices to communicate over modern Ethernet networks** without altering their native protocols. A pair of nodes can replace a long serial cable, or a single node can expose a serial port as a TCP server.

### Key Features

- **Transparent serial bridge** up to 115.2 kbps

- **Auto-reconnect & heartbeat** watchdog for field reliability

- **USB CLI configuration** of IP, baud rate, and server/client role, persisted in EEPROM

- **Status query socket** and RGB LED activity indicator

### Why W5100?

| Feature | Benefit to This Project |
| --- | --- |
| **32 KB Tx/Rx buffer** | Prevents packet loss when MCU is busy |
| **30 MHz SPI** | Handles high-baud UART bursts without back-pressure |
| **8 hardware sockets** | Separate data, status, and future OTA channels |
| **Low power (~80 mA)** | Suits industrial 5 V rails |

![Example Image of Boards](https://github.com/jwidess/UART-over-Ethernet-v2/raw/main/example_boards.jpg)

### Hardware Setup

```plaintext
[Serial Device] ⇄ (RS-232 or TTL) ⇄ Arduino Mega ─SPI→ W5100 ─TCP/IP→ LAN
```

Set one unit to **SERVER** (listens on port 3000) and the peer to **CLIENT** (connects to the server’s IP).

### Software Implementation (snippet)

```c
#include <Ethernet2.h>

byte mac[] = {0xDE,0xAD,0xBE,0xEF,0x55,0x00};
IPAddress ip(192,168,1,100);
EthernetServer server(3000);

void setup() {
  Serial.begin(115200);        // USB CLI
  Serial1.begin(cfg.baud);     // UART bridge
  Ethernet.init(10);           // CS pin
  Ethernet.begin(mac, ip);
  server.begin();
}
```

`loop()` moves bytes between `Serial1` and the active Ethernet socket while running heartbeat and reconnection timers.

### Network Architecture

```plaintext
UART Device ←→ Node A (W5100) ≈TCP≈ Node B (W5100) ←→ UART Device
```

Extra sockets let you add WebSocket dashboards or pipe data into MQTT brokers.

### Performance Results

- Continuous 9,600 bps stream: &lt; 50 % RX buffer usage

- Automatic reconnection in ~2.3 s after cable pull, zero data loss in lab tests

- 115.2 kbps burst: &lt; 6 ms latency, no overrun on 1 KB UART buffer

### Lessons Learned

- W5500’s large buffer compensates for MCU stalls

- Field CLI cuts maintenance time versus hard-coded parameters

### Future Improvements

- DHCP and optional light-weight XOR encryption

- 1-to-N multicast mode for multi-logger setups

- ESP32-P4-ETH + W5500 combo for Wi-Fi fail-over and OTA firmware

### Challenges & Solutions

| Challenge | Resolution |
| --- | --- |
| SPI bandwidth limit on older W5100 | Upgraded to **W5500 (80 MHz)** |
| Data loss during link drops | 1 KB UART buffer + exponential back-off reconnect |
| On-site parameter changes | USB CLI + EEPROM persistence |

## Typical Applications

- **Remote PLC / sensor integration** for SCADA systems

- **Robotics & drone telemetry** where Ethernet replaces long UART runs

- **IoT gateways** bridging serial environmental sensors to MQTT/HTTP

- **Educational labs** for protocol analysis and networked serial experiments

### Q&A for the **“Transparent UART-over-Ethernet Bridge with WIZnet W5100”**

1. What does this project do?

**It converts UART (serial) data into TCP/IP packets and back again, creating a transparent Serial-to-Ethernet bridge.**
Two W5500-equipped Arduino Mega nodes can replace a long serial cable or expose a single serial port as a network socket.

2. Which hardware is used?

**The bridge pairs an Arduino Mega 2560 with a WIZnet W5100 Ethernet Shield.**
Optional MAX3232 level shifters support true RS-232 voltage levels.

3. Why choose the WIZnet W5500 instead of other Ethernet chips?

**W5100 offers an 30 MHz SPI bus, 32 KB on-chip buffer, and eight hardware sockets—ideal for high-baud, low-latency serial tunneling.**
Lower power draw (~80 mA) and a proven TCP/IP off-load engine boost reliability in industrial settings.

4. What baud rates are supported?

**The firmware is tested up to 115 200 bps without data loss.**
Lower or custom baud rates can be selected via the USB CLI.

---

Source: https://maker.wiznet.io/lawrence/projects/uart-over-ethernet-v2/
