/esp8266_ethernet

Ethernet example using Ethernet drivers for lwIP on esp8266

Primary LanguageC++

esp8266_ethernet

Example of using SPI Ethernet module with esp8266.
Arduino core for ESP8266 uses lwip for TCP/IP protocol stack.
The hierarchy of programs that use WiFi is as follows:

+----------------+
|  Application   |
+----------------+
| Network Object |
+----------------+
|      lwip      |
+----------------+
|   WiFi Driver  |
+----------------+ 

The latest Arduino core supports SPI external Ethernet as standard.
You don't need any libraries.
The hierarchy of programs that use Ethernet is as follows:

+----------------+
|  Application   |
+----------------+
| Network Object |
+----------------+
|      lwip      |
+----------------+
| Ethernet Driver|
+----------------+

Hardware requiment

SPI Ethernet module using this chip.

  • ENC28J60
  • W5100
  • W5500

Software requiment

  • Arduino core for ESP8266 V3.0.2 or later

    You can check the Core version using ESP.getFullVersion() or ESP.getCoreVersion().
    This is mine:
ESP.getFullVersion=SDK:2.2.2-dev(38a443e)/Core:3.0.2=30002000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:6105635
ESP.getCoreVersion=3.0.2

Wireing

SPI PHY --- ESP8266
SCK --- GPIO14
MISO --- GPIO12
MOSI --- GPIO13
CS --- GPIO16(*)
RST --- RESET

(*) You can change.

Selecting the Ethernet module

  • Using W5500:
#include <W5500lwIP.h>
Wiznet5500lwIP eth(CSPIN);

W5500

  • Using W5100:
#include <W5100lwIP.h>
Wiznet5100lwIP eth(CSPIN);

W5100

  • Using ENC28J60:
#include <ENC28J60lwIP.h>
ENC28J60lwIP eth(CSPIN);

ENC28J60

Limitations

UDP receive is currently not working.
This is probably not a driver issue, but a core library issue.