2019-01-06 18:56:14 +01:00
Ethernet Component
==================
.. seo ::
2019-02-16 23:25:23 +01:00
:description: Instructions for setting up the Ethernet configuration for your ESP32 node in ESPHome.
2021-11-16 03:19:33 +01:00
:image: ethernet.svg
2019-01-06 18:56:14 +01:00
:keywords: Ethernet, ESP32
2022-08-31 03:45:35 +02:00
This ESPHome component enables *wired* Ethernet connections for ESP32s.
2019-01-06 18:56:14 +01:00
Ethernet for ESP8266 is not supported.
2022-08-31 03:45:35 +02:00
This component and the Wi-Fi component may **not** be used simultaneously, even if both are physically available.
2019-01-06 18:56:14 +01:00
.. code-block :: yaml
2024-03-01 01:46:12 +01:00
# Example configuration entry for RMII chips
2019-01-06 18:56:14 +01:00
ethernet:
type: LAN8720
2024-05-07 07:40:12 +02:00
mdc_pin: GPIOXX
mdio_pin: GPIOXX
2019-01-06 18:56:14 +01:00
clk_mode: GPIO0_IN
phy_addr: 0
# Optional manual IP
manual_ip:
static_ip: 10.0.0.42
gateway: 10.0.0.1
subnet: 255.255.255.0
2024-03-01 01:46:12 +01:00
.. code-block :: yaml
# Example configuration entry for SPI chips
ethernet:
type: W5500
2024-05-07 07:40:12 +02:00
clk_pin: GPIOXX
mosi_pin: GPIOXX
miso_pin: GPIOXX
cs_pin: GPIOXX
interrupt_pin: GPIOXX
reset_pin: GPIOXX
2024-03-01 01:46:12 +01:00
2019-01-06 18:56:14 +01:00
Configuration variables:
------------------------
2023-02-07 00:55:01 +01:00
- **type** (**Required** , string): The type of LAN chipset/phy.
Supported chipsets are:
2024-03-01 01:46:12 +01:00
- `` LAN8720 `` (RMII)
- `` RTL8201 `` (RMII)
- `` DP83848 `` (RMII)
- `` IP101 `` (RMII)
- `` JL1101 `` (RMII)
- `` KSZ8081 `` (RMII)
- `` KSZ8081RNA `` (RMII)
- `` W5500 `` (SPI)
RMII configuration variables:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-02-07 00:55:01 +01:00
2019-01-06 18:56:14 +01:00
- **mdc_pin** (**Required** , :ref: `config-pin` ): The MDC pin of the board.
Usually this is `` GPIO23 `` .
- **mdio_pin** (**Required** , :ref: `config-pin` ): The MDIO pin of the board.
Usually this is `` GPIO18 `` .
2022-08-31 03:45:35 +02:00
- **clk_mode** (*Optional* , string): The clock mode of the data lines. See your board's
datasheet for more details. Must be one of the following values:
2019-01-06 18:56:14 +01:00
- `` GPIO0_IN `` (Default) - External clock
- `` GPIO0_OUT `` - Internal clock
- `` GPIO16_OUT `` - Internal clock
- `` GPIO17_OUT `` - Internal clock
2022-08-31 03:45:35 +02:00
- **phy_addr** (*Optional* , int): The PHY addr type of the Ethernet controller. Defaults to 0.
- **power_pin** (*Optional* , :ref: `Pin Schema <config-pin_schema>` ): The pin controlling the
power/reset status of the Ethernet controller. Leave unspecified for no power pin (default).
2024-03-01 01:46:12 +01:00
SPI configuration variables:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- **clk_pin** (**Required** , :ref: `config-pin` ): The SPI clock pin.
- **mosi_pin** (**Required** , :ref: `config-pin` ): The SPI MOSI pin.
- **miso_pin** (**Required** , :ref: `config-pin` ): The SPI MISO pin.
- **cs_pin** (**Required** , :ref: `config-pin` ): The SPI chip select pin.
- **interrupt_pin** (*Optional* , :ref: `config-pin` ): The interrupt pin.
- **reset_pin** (*Optional* , :ref: `config-pin` ): The reset pin.
- **clock_speed** (*Optional* , float): The SPI clock speed.
Any frequency between `8Mhz` and `80Mhz` is allowed, but the nearest integer division
of `80Mhz` is used, i.e. `16Mhz` (`80Mhz` / 5) is used when `15Mhz` is configured.
Default: `26.67Mhz` .
Advanced common configuration variables:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2019-01-06 18:56:14 +01:00
- **manual_ip** (*Optional* ): Manually configure the static IP of the node.
2021-02-07 17:35:39 +01:00
- **static_ip** (**Required** , IPv4 address): The static IP of your node.
- **gateway** (**Required** , IPv4 address): The gateway of the local network.
- **subnet** (**Required** , IPv4 address): The subnet of the local network.
2019-01-06 18:56:14 +01:00
- **dns1** (*Optional* , IPv4 address): The main DNS server to use.
- **dns2** (*Optional* , IPv4 address): The backup DNS server to use.
2021-05-17 16:13:49 +02:00
- **use_address** (*Optional* , string): Manually override what address to use to connect
to the ESP. Defaults to auto-generated value. For example, if you have changed your
static IP and want to flash OTA to the previously configured IP address.
2019-01-06 18:56:14 +01:00
- **domain** (*Optional* , string): Set the domain of the node hostname used for uploading.
For example, if it's set to `` .local `` , all uploads will be sent to `` <HOSTNAME>.local `` .
Defaults to `` .local `` .
- **id** (*Optional* , :ref: `config-id` ): Manually specify the ID used for code generation.
2020-07-07 16:23:09 +02:00
.. note ::
2022-08-31 03:45:35 +02:00
If your Ethernet board is not designed with an ESP32 built in, it's common to attempt
to use flying leads, dupont wires, etc. to connect the Ethernet controller to the ESP32.
This approach is likely to fail, however, as the Ethernet interface uses a high frequency
clock signal that will not travel reliably over these types of connections. For more
2022-04-03 09:30:25 +02:00
information and wiring details refer to the link in the *See also* section.
2021-02-07 17:35:39 +01:00
2024-03-01 01:46:12 +01:00
.. note ::
SPI based chips do *not* use :doc: `spi` . This means that SPI pins can't be shared with other devices.
2022-12-14 17:46:09 +01:00
Configuration examples
----------------------
2022-12-15 09:16:16 +01:00
**Olimex ESP32-POE** :
2019-02-23 10:59:57 +01:00
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
power_pin: GPIO12
2020-12-21 01:55:44 +01:00
2024-01-27 16:21:35 +01:00
.. note ::
WROVER version of Olimex POE cards change CLK to ping GPIO0, configuration must be `clk_mode: GPIO0_OUT` .
2022-12-14 17:46:09 +01:00
2022-12-15 09:16:16 +01:00
**Olimex ESP32-EVB** :
2021-05-19 23:25:20 +02:00
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 0
2023-01-23 22:31:20 +01:00
**Olimex ESP32-GATEWAY** and **LILYGO TTGO T-Internet-POE ESP32-WROOM LAN8270A** :
2023-01-23 07:29:48 +01:00
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
2023-01-23 22:31:20 +01:00
clk_mode: GPIO17_OUT
2023-01-23 07:29:48 +01:00
phy_addr: 0
2023-01-23 22:31:20 +01:00
**LILYGO TTGO T-Internet ESP32-WROVER-E LAN8270** :
2022-07-05 12:35:52 +02:00
.. code-block :: yaml
2022-07-05 12:36:23 +02:00
2022-07-05 12:35:52 +02:00
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
2023-01-23 22:31:20 +01:00
clk_mode: GPIO0_OUT
2022-07-05 12:35:52 +02:00
phy_addr: 0
2023-01-23 22:31:20 +01:00
power_pin: GPIO04
2023-02-07 00:55:01 +01:00
2022-12-15 09:16:16 +01:00
**Wireless Tag WT32-ETH01** and **SMLIGHT SLZB-06 PoE Zigbee** :
2022-07-05 11:02:31 +02:00
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 1
power_pin: GPIO16
2022-12-15 09:16:16 +01:00
**M5Stack PoESP32** and **ESP32-Ethernet-Kit** :
2020-07-06 16:58:53 +02:00
.. code-block :: yaml
ethernet:
2022-12-14 17:46:09 +01:00
type: IP101
2020-07-06 16:58:53 +02:00
mdc_pin: GPIO23
mdio_pin: GPIO18
2022-12-14 17:46:09 +01:00
clk_mode: GPIO0_IN
2020-07-06 16:58:53 +02:00
phy_addr: 1
2022-12-14 17:46:09 +01:00
power_pin: GPIO5
2023-02-07 00:55:01 +01:00
2022-12-15 09:16:16 +01:00
**AiThinker ESP32-G Gateway** :
2022-12-14 17:46:09 +01:00
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 1
power_pin: GPIO5
2022-07-05 11:02:31 +02:00
2022-12-15 09:16:16 +01:00
**wESP32** :
2020-12-21 01:55:44 +01:00
.. code-block :: yaml
2022-12-14 17:46:09 +01:00
# for board up to rev.5
2020-12-21 01:55:44 +01:00
ethernet:
type: LAN8720
2022-07-05 11:02:31 +02:00
mdc_pin: GPIO16
mdio_pin: GPIO17
2020-12-21 01:55:44 +01:00
clk_mode: GPIO0_IN
2022-07-05 11:02:31 +02:00
phy_addr: 0
2022-12-14 17:46:09 +01:00
# for board rev.7 and up
ethernet:
type: RTL8201
mdc_pin: GPIO16
mdio_pin: GPIO17
clk_mode: GPIO0_IN
phy_addr: 0
2022-07-05 11:02:31 +02:00
.. note ::
2022-12-14 17:46:09 +01:00
Revision 5 and below of the wESP32 board use the LAN8720 Ethernet PHY. Revision 7 and newer of it use the RTL8201 Ethernet PHY. Support for RTL8201 is available from ESPHome version 2022.12 upwards.
2019-01-06 18:56:14 +01:00
2023-08-04 00:28:36 +02:00
2022-12-15 09:16:16 +01:00
**OpenHacks LAN8720** :
2022-08-31 03:45:35 +02:00
.. code-block :: yaml
ethernet:
2022-12-14 17:46:09 +01:00
type: LAN8720
2022-08-31 03:45:35 +02:00
mdc_pin: GPIO23
mdio_pin: GPIO18
phy_addr: 1
2022-11-11 01:22:03 +01:00
2022-12-14 17:46:09 +01:00
.. note ::
2022-11-11 01:22:03 +01:00
2022-12-14 17:46:09 +01:00
This board has an issue that might cause the ESP32 to boot in program mode. When testing, make sure
you are monitoring the serial output and reboot the device several times to see if it boots into the
program properly.
2022-11-11 01:22:03 +01:00
2023-08-04 00:28:36 +02:00
**Esp32-Stick-Eth** and **Esp32-Stick-PoE-P** and **Esp32-Stick-PoE-A** :
.. code-block :: yaml
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 1
2024-04-01 19:50:49 +02:00
**LILYGO T-ETH-Lite ESP32** :
2023-08-04 00:28:36 +02:00
2023-10-19 09:54:28 +02:00
.. code-block :: yaml
ethernet:
type: RTL8201
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 0
power_pin: GPIO12
2022-08-31 03:45:35 +02:00
2019-01-06 18:56:14 +01:00
See Also
--------
2022-01-25 10:00:09 +01:00
- :doc: `network`
2022-12-14 17:46:09 +01:00
- :doc: `text_sensor/ethernet_info`
2019-05-12 22:44:59 +02:00
- :apiref: `ethernet/ethernet_component.h`
2020-07-07 16:23:09 +02:00
- `ESP32 Ethernet PHY connection info <https://pcbartists.com/design/embedded/esp32-ethernet-phy-schematic-design/> `__
2019-02-07 13:54:45 +01:00
- :ghedit: `Edit`