The ESP32 WT32-ETH01
The WT32-ETH01 is a board with an Ethernet LAN interface. It can be programmed with an USB-TTL adapter and the Arduino IDE.
The Board
The microcontroller is a WT32-S1 from Espressif Systems and can be programmed with the Arduino IDE. You have to install the ESP32 Core and then you can use the board settings of the "WT32-ETH01 Ethernet Module" for the upload.
When you connect power - a red LED will come up.
The module provides two hardware Serial (IO1/IO3, IO5/IO17), 8 GPIOs and 3 additional ports which can be used as inputs only.
IO17 (TX2) and IO5 (RX2) are connected to green LEDs (LOW active).
WiFi works very similar to the ESP32 familiy. Ethernet works fine with the current examples (ESP32 Core 2.0.14) but you will need a separate library to make the WebServer working. I will cover this topic later on that page.
The Standard Software on the WT32-ETH01
The WT32-S1 comes pre programmed. It fetches an IP via DHCP. I didn't play around a lot with the OEM software. This page focuses on flashing YOUR OWN SOFTWARE on the WT32-ETH01.
How to program the WT32-ETH01
The board can be programmed when you connect a USB-TTL adapter to the respective pins. Connect the RX0/TX0/GND to the TX/RX/GND of your USB-TTL device. I have set the level to 3V3 but I'm sourcing the 5V from the USB-Adapter.
To bring the WT32-EHT01 in program mode I follow this sequence:
- disconnect VCC
- connect EN with GND
- connect VCC
- disconnect EN from GND
You should see a following n the serial monitor:
ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)) waiting for download
Now you can compile and upload the sketch to the WT32-ETH01. I'm using following settings in the Arduino IDE:
When the Upload has finished you will need a reset. Either do a power cycle or tip EN with GND.
WiFi
I started with a common ESP32 WIFI Sketch and it works as intended.
OTA
To avoid the manual handling of the upload sequence, I propose to add OTA to your sketches. Uploaded once a Sketch with OTA, you can upload new sketches without the serial interface. To get OTA working I needed to change the partition Scheme to "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) - see the screenshot above.
Getting the Ethernet Working
I recommend you start with the Ethernet/ETH_LAN8720 sketch from the library. The module will receive the IP settings via DNS from your router. The Link LED and the Speed LED on the RJ45 connecter will light up accordingly. The sketch will start to request the Google start page.
Implement a WebServer with Ethernet
On ESPs you should use the WebServer (not the WifiServer). It took me quite a while to get the WebServer working with the Ethernet. For the WT32-ETH01 you need to install the library WebServer_WT32_ETH01 by khoih-prog. The library is available in the Library Manager of the Arduino IDE.
I have put together a demo sketch. It is a simple WebServer and includes the OTA for easier upload of a new sketch.
A More Advanced WebServer
At the end of the page you will find a download to a generic - but more advanced - WebServer:
The start page will show 4 buttons and two sliders:
Page 1.htm offer simple toggle buttons to switch the relay and the separate LED.
Page9.htm is just for debugging. It shows the input and output states of all pins:
You could use one of the LEDs to indicate WiFi activity. If not needed, leave the value for this constant to 255.
const uint8_t wifiActivityPin = 255; // set to 255 if activity LED is not needed
Before the upload you must chose the variant to compile and set your WiFi settings in the maintab.
For WiFi use the example configuration 35:
#define USE_BOARD 35
For Ethernet use the example configuration 36:
#define USE_BOARD 36
Note: This generic webserver sketch is compatible for ESP8266 and the ESP32, hence the precompiler defines to differentiate the boards based on your upload settings. If you want to read more about the generic ESP webserver sketch - see this page: Genereic ESP webserver.
Summary for the WT32-ETH01 ESP32 Module
The WT32-ETH01 is a compact solution to get a ESP32 working with a wired Ethernet. The module costs about 12 EUR.