ESP32 and Ethernet: Making the Connection Using Xedge32

The ESP32 is not limited to Wi-Fi; it also supports Ethernet. This is useful in places like factories where a stable connection is essential. With the Xedge32 solution, using the W5500 Ethernet chip with the ESP32 becomes much more straightforward, as Ethernet can be enabled with a basic Lua command.

This tutorial will show how to activate Ethernet using an Ethernet-enabled development board and outline the steps required to wire a W5500 chip to the ESP32.

We welcome your thoughts and discussions on this article. While our site does not host a comment section, please feel free to comment on LinkedIn: How to enable Ethernet using Xedge32.

Using an Ethernet-Enabled Development Board

The Lilygo's T-ETH-Lite is one of many boards equipped with a pre-wired W5500 chip. A common feature of these Ethernet-ready boards is the absence of USB. Consequently, to power the ESP32, a 5-volt power supply is required. A USB to TTL Serial Converter Adapter Module, like the FTD1232 adapter, is also necessary for the initial firmware flashing.

An old USB cable can be repurposed if you do not have a dedicated 5V power supply. As illustrated in Figure 1, cut the cable to reveal its internal wires. You'll want to focus on the non-insulated wire (ground) and the red wire (5V). For easier connectivity to a breadboard, we attached a black jumper wire to the non-insulated one and a red jumper wire to the red wire, as seen in Figure 1.

Figure 1: Breadboard, T-ETH-Lite, USB to TTL Converter, USB cables, and jumper wires.

T-ETH-Lite Power Test

Referring to Figure 1, the two leftmost pins of the ESP32-S3 are designated for 5V-in and ground. Connect the red jumper wire (from the USB's 5V) to the 5V-in pin and the black ground wire to the ESP32-S3's GND pin. Next, plug in an Ethernet cable and connect the USB power cable to your computer to turn on the board. If done correctly, the green Ethernet LED should illuminate. Unplug the USB power cable once you have confirmed the board is powered on.

Wiring the USB to TTL Converter

Follow these steps to correctly wire the USB to TTL Converter to the ESP32:

  1. Ground Connection: Connect the converter's ground pin to the ESP32's ground. Figure 1 shows two ground pins connected to the ESP32's second leftmost pin, one for the power and one for the converter.
  2. RX to TX Connection: Attach the converter's RX pin to the ESP32's third leftmost pin (TX).
  3. TX to RX Connection: Connect the converter's TX pin to the ESP32's fourth leftmost pin (RX).

The RX to TX and TX to RX crossover in serial communication ensures data flows correctly between devices. One device's "Transmit" (TX) pin connects to the other's "Receive" (RX) pin, and vice versa. This setup enables two-way communication, with each device both sending and receiving data.

Flashing the Xedge32 Firmware to ESP32

To flash the Xedge32 firmware onto the ETH-Lite board, follow these steps:

  1. Prepare the USB to TTL Serial Converter: Connect the converter's USB cable to your computer.
  2. Boot Mode Initiation:
    1. Press and hold the boot button on the T-ETH-Lite board.
    2. While still pressing the boot button, plug in the USB power cable to your computer.
    3. Release the boot button once the ESP32 powers on. The ESP32 will now be in boot mode.
  3. Firmware Installation:
    • Refer to the Xedge32 Getting Started Guide for detailed installation instructions.
    • Ensure you choose the xedge-s0.bin firmware file during the installation process.
  4. Post-Flashing Steps:
    1. Once the firmware is uploaded, connect a terminal emulator to the USB serial port.
    2. Reboot the ESP32 by pressing the RST button. This action will start Xedge32.
    3. Once booted, you should see the LuaShell32 prompt.
  5. Network Connection:
    1. At the LuaShell32 prompt, enter the command:
    2. The ESP32 will now attempt to connect to your network. Upon a successful connection, the assigned IP address should be displayed in LuaShell32.

How to Wire a W5500 Chip to the ESP32

We will show how to enable Ethernet on the FREENOVE ESP32-S3-WROOM CAM board; however, any ESP32 can easily be ethernet-enabled using a W5500 module. As highlighted in the tutorial Streaming CAM Images via MQTT, the camera's read operation generates significant noise, leading to a notable decline in Wi-Fi streaming capabilities. This issue is particularly pronounced for boards like the FREENOVE ESP32-S3 CAM, which lack provisions for attaching an external Wi-Fi antenna. CAM boards are, for this reason, good candidates for being Ethernet-enabled.

The W5500 wiring, as depicted in Figure 3, is straightforward, but note that CAM boards typically utilize numerous GPIO ports for both the CAM and the SD card. It's essential to select GPIO ports that are not in use. The GPIO ports chosen in this tutorial do not interfere with the CAM and SD card's existing configurations. For a comprehensive understanding of the occupied GPIOs, refer to the FREENOVE ESP32-S3 CAM Pinout Diagram.

You can activate the Ethernet in Xedge32 by calling esp32.netconnect() once the W5500 module is wired to the ESP32. Figure 2 shows the pin wiring. Wire the W5500 to the ESP32, as shown in this figure.

ESP32 pin

W5500 pin






Clock pin for SPI communication




MOSI (Master Out, Slave In) for SPI communication




MISO (Master In, Slave Out) for SPI communication




The chip select pin for SPI communication




Interrupt (Signal) the microcontroller when events occur



Power W5500 using 3.3 volt



Select any GND pin

Figure 2: Wiring and Lua configuration details.

The details for the Lua configuration table can be found in the third column in Figure 2. In addition to these settings, we also need to specify spi and freq. The complete configuration, which you can directly paste into LuaShell32, enables Ethernet connectivity for the CAM board:

esp32.netconnect("W5500", {spi = 1,clk = 14,mosi = 21,miso = 47,cs = 41,irq = 42,freq = 40000000})

Upon entering the above command into LuaShell32, the device should establish a connection to your network, and the allocated IP address will then be displayed in the console.

The following figure shows the complete wiring.

Figure 3: ESP32 W5500 Wiring.

Xedge32 Tutorials:

Continue your journey and expand your expertise with our comprehensive Xedge32 tutorials.

Complex Circuitry Got You Stumped?

Don't let networking, security, and device management hold you back! Let Real Time Logic help your business, development team, or customers save time and money by handling these complex tasks for you.

With a wealth of experience creating IoT solutions and embedded device interfaces, we're well-equipped to dramatically improve your products and how you build them. And if you prefer to tackle things on your own, check out our extensive list of embedded web server and IoT tutorials.

Whether you choose to work with us or take the DIY route, we're here to help you succeed. Let's team up and make your vision a reality!


OPC-UA Client & Server

An easy to use OPC UA stack that enables bridging of OPC-UA enabled industrial products with cloud services, IT, and HTML5 user interfaces.

Edge Controller

Edge Controller

Use our user programmable Edge-Controller as a tool to accelerate development of the next generation industrial edge products and to facilitate rapid IoT and IIoT development.

On-Premises IoT

On-Premises IoT Platform

Learn how to use the Barracuda App Server as your On-Premises IoT Foundation.

Embedded Web Server

Barracuda Embedded Web Server

The compact Web Server C library is included in the Barracuda App Server protocol suite but can also be used standalone.

WebSocket Server

Microcontroller Friendly

The tiny Minnow Server enables modern web server user interfaces to be used as the graphical front end for tiny microcontrollers. Make sure to check out the reference design and the Minnow Server design guide.

WebDAV Server

Network File System

Why use FTP when you can use your device as a secure network drive.

HTTP Client

Secure HTTP Client Library

PikeHTTP is a compact and secure HTTP client C library that greatly simplifies the design of HTTP/REST style apps in C or C++.

WebSocket Client

Microcontroller Friendly

The embedded WebSocket C library lets developers design tiny and secure IoT applications based on the WebSocket protocol.

SMTP Client

Secure Embedded SMTP Library

Send alarms and other notifications from any microcontroller powered product.

Crypto Library

RayCrypto C Library

The RayCrypto engine is an extremely small and fast embedded crypto library designed specifically for embedded resource-constrained devices.

Embedded PKI Service

Automatic SSL Certificate Management for Devices

Real Time Logic's SharkTrust™ service is an automatic Public Key Infrastructure (PKI) solution for products containing an Embedded Web Server.


Modbus TCP client

The Modbus client enables bridging of Modbus enabled industrial products with modern IoT devices and HTML5 powered HMIs.

Posted in Xedge32