ESPEasy has some centralized hardware configuration settings, shown in this page, and divided in sections.
Wifi Status LED¶
To display the Wifi acitivity, a pin can be configured to light up a LED when data is transfered via Wifi. Optionally, the LED signal can be ‘inverted’.
As many ESP boards have an onboard LED connected to GPIO-2 and inverted, it is shown as a note how to configure that.
To provide a possible escape from a malfunctioning ESP module, a factory-reset button/feature can be configured by setting up a GPIO-pin for this.
When connecting this pin to ground for ca. 10 seconds the unit will be completely reset, and all settings/configuration irretrievably deleted!
This feature can be useful in a development/laboratory environment, for when the configuration gets corrupted in some way.
When using devices that use the I2C bus (Inter-integrated circuit, also known as IIC, and mostly compatible with SM Bus) (Wikipedia: I2C) some pins have to be configured, and initialized during boot, for the SDA and SCL connections. This can be any unused pair of pins on the ESP board.
The pins can be configured here, and will have default values initially (ESP8266: SDA: GPIO-4 (D2), SCL: GPIO-5 (D3), ESP32: SDA: GPIO-22, SCL: GPIO-23). When I2C is not used, these can be set to - None -, so the pins are available for other purposes.
When having an I2C Priority task configured, the I2C GPIO pins can no longer be changed, as that could disable the hardware, thus blocking the device. The configured GPIO pins will be display-only.
The default bus clock speed can also be set here. If only devices supporting 100 kHz are connected (Old/Slow devices), then the value can be set to 100 kHz, by default 400 kHz is configured, that is supported by newer devices, though there are many devices supporting higher frequencies. ESP8266 is able to achieve ca. 400 kHz, while ESP32 allows much higher speeds.
ESPEasy has a separate setting for Slow I2C devices, and per I2C device this slow clock speed can be selected in the Device edit page. This value is by default set to 100 kHz, but can be set lower or higher if desired.
Device specific Force Slow I2C speed selection:
Since build 20110, there is the option of using an I2C multiplexer. This option is not available in all builds, because of the size of the code. It is usually available in the normal, testing and custom builds, but ommitted from minimal, IR and hardware-specific builds.
Possible use-cases for an I2C multiplexer are:
Connect multiple devices that have fixed or limited I2C addresses (For example, some OLED devices have a single fixed address but you need to connect 2 or more, or connect more than 3 TLS2561 devices, that support only 3 different addresses).
Connect different devices that have the same I2C address (For example connecting a TSL2561 light/lux sensor and an APDS9960 proximity sensor).
Connect slow and fast devices, where the speed of the fast device prohibits proper working of the slow device.
If devices with conflicting I2C addresses are to be used, then none of them can be connected to the ESP main I2C bus, but they should each be connected to a separate channel of the multiplexer.
Devices that do not conflict with other devices can be connected to the ESP main I2C bus, this might improve the performance/responsiveness of these devices.
When using an I2C Multiplexer, make sure there is no address conflict with any of the devices you intend to connect, f.e. when connecting BME280 sensors, don’t set the address of the multiplexer to 0x76 or 0x77.
There are a couple of I2C multiplexer chips available, currently there is support for:
TCA9548a (8 channels, multiple channel-connections, 8 I2C addresses, with reset)
TCA9546a (4 channels, multiple channel-connections, 8 I2C addresses, with reset, also TCA9545a can be used, but no support for the Interrupt function though)
TCA9543a (2 channels, multiple channel-connections, 4 I2C addresses, with reset)
PCA9540 (2 channels, fixed I2C address, no reset, experimental support)
The TCA9548a, TCA9546a and TCA9543a support connecting multiple channels to the main I2C channel. This can be configured on the Device edit page for I2C devices, once the I2C Multiplexer configuration is enabled by selecting a multiplexer type and an I2C address for the multiplexer.
Also, the TCA9548a, TCA9546a and TCA9543a chips have a connection for a reset signal available. This allows the chip to be reset if it gets stuck by some ‘less compatible’ or ‘badly behaving’ devices. Once connected and configured, the multiplexer can be reset from the software, if desired or required. This feature is not yet used in any I2C device plugin.
A TCA9543a board has the advantage of being quite a bit smaller than either TCA9546a or TCA9548a, while being digitally compatible. (But with less channels and only 4 I2C addresses).
All these chips/boards can be found at Adafruit, Aliexpress, Banggood, EBay, etc.
Available multiplexer types:
Select the I2C Address for the multiplexer:
If an I2C multiplexer is configured, every Device edit page for I2C devices will show extra options to select the channel the device is connected on.
There is the default option of Single channel, or, when a TCA9548a, TCA9546a or TCA9543a is configured, Multiple channels.
Example: A multiplexer is configured, but the device is connected directly on the ESP board I2C channel:
Configure a (single) multiplexer channel the device is connected on:
NB: Only acceptable channels (0-7/0-3/0-1) will be available in the dropdown list, depending on the Multiplexer type configured.
Select Single channel or Multiple channels:
Configure multiple channels for a device, 8 channel multiplexer configured
Above configuration results in channels 0, 4, 5, 6 and 7 being connected to the ESP board I2C bus when this sensor is active via I2C.
NB: Only acceptable channel checkboxes (0-7/0-3/0-1) will be shown, depending on the Multiplexer type configured.
When using devices that are connected via the SPI interface (Wikipedia: SPI), the interface must be initialized during boot. This can be enabled here. For ESP32 there is the option to select the HSPI (often called Hardware SPI) interface, the VSPI (often called Virtual SPI) interface, or select User-defined GPIO pins for the
The common SPI pins are shown here.
Other SPI pins to be used are device specific, and need to be configured from the corresponding Device edit page.
For ESP32, disabled:
For ESP32, select the desired configuration:
NB: When using the VSPI configuration and also the I2C interface is used, another pin has to be selected for I2C GPIO -> SCL, as its configuration is fixed for the VSPI setting.
When selecting the User-defined options, 3 extra input fields are displayed, where the
MOSI GPIO pins have to be selected. Nearly all pins can be used, but for the output signals
MOSI no input-only pins should be selected!
When changing the setting for Init SPI, or changing any of the User-defined GPIO pins, the ESP32 unit needs a hardware reset. This can be achieved by pressing the reset button (when available, sometimes labelled
RST), or by completely removing the power for ~30 seconds. Also take into account here that units with a backup battery (f.e. some LilyGo and Waveshare ESP32 models) may keep power on the unit, so specific measures may have to be taken!
NB: When selecting the User-defined option, all 3 GPIO pins should be set, or an error message will be displayed when the page is saved, and the SPI interface will not be enabled at the next boot.
When the compile-time option for SD-card support is enabled, the
CS pin for the SD-card interface can be configured here. For the SD-card interface to work, Init SPI should also be enabled.
On builds including
_eth in their build name, it is also possible to use ethernet instead of WiFi.
Currently this is only present for ESP32 builds and no plans currently exist to support it for ESP82xx.
N.B. This is still in testing phase, so not all kinds of network communications work right now.
Preferred network medium¶
Allows to switch between:
To activate a new configuration, a reboot is needed.
Ethernet PHY type¶
Select the used PHY controller type:
LAN8710 (LAN8720 is also supported, but none of the newer features are supported)
RTL8201 (since ESP32 IDF 4.4)
DP83848 (since ESP32 IDF 4.4)
DM9051 (since ESP32 IDF 4.4)
The LAN8710 and LAN8720 are also available with an “A” suffix. These are the same chips, only produced after the brand SMSC was taken over by Microchip Technology.
Ethernet PHY Address¶
The PHY address depends on the hardware and the PHY configuration. On some chips, like the LAN8720, the board designer may set this address by pulling some pins either high or low at power on. In theory, one could use multiple PHY adapters on the same RMII bus, but this is not supported by ESPEasy.
Espressif’s Ethernet board with TLK110 PHY use PHY address 31.
Common Waveshare LAN8720 PHY breakout board (and clones) use PHY address 1.
Olimex ESP32 EVB REV B IoT LAN8710 PHY Board with CAN use PHY address 0.
Other LAN8720 breakouts often use PHY address 0.
If the PHY address is incorrect then the EMAC will initialise but all attempts to read/write configuration registers on the PHY will fail.
N.B. There is support for an auto detect of this PHY address, by setting it to -1, but at least on the LAN8720 this does not seem to work.
RMII PHY SMI Wiring¶
Most PHY boards have documented their RMII PHY SMI Wiring pins:
MDC Output to PHY, usually pin 23
MDIO Bidirectional, usually pin 18
The PHY and the ESP need to keep a clock in sync. This can either be done via an external crystal, which is connected to a GPIO pin. Another option is to let the ESP provide the clock to the PHY.
External crystal oscillator
50MHz APLL Output on GPIO0
50MHz APLL Output on GPIO16
50MHz APLL Inverted Output on GPIO17
When using an external crystal oscillator, this is connected to GPIO-0. Make sure this crystal is not active, or connected to GPIO-0, during boot or else the ESP32 may boot into flash mode.
On almost all PHY boards, or ESP boards equiped with an ethernet PHY, it is possible to turn the PHY on or off. Either to save energy, or to make sure the external clock is not affecting the ESP boot mode when it restarts.
For example the Olimex ESP32-EVB does have the external crystal oscillator connected to GPIO-0, which could boot the ESP32 randomly into UART flash mode. Most boards use a specific GPIO pin to control the power to the PHY. The Olimex ESP32-EVB does have a specific delay circuit to only allow power to the PHY after boot and therefore does not need to control the PHY power.
For other boards, the default is often GPIO-17, but this may change per board.
If the power pin is defined, ESPEasy will toggle the ethernet module off and on at boot. Some Ethernet modules, like the LAN8720, may sometimes get stuck and need to be reset to get it to work again.
RMII PHY Wiring¶
Apart from these GPIO pins, there is a number of other pins reserved on the ESP32 for RMII PHY Wiring.
Since these GPIO pin assignments cannot be changed, it is also not needed to configure them. However, they also cannot be used when RMII PHY is used.
The following PHY connections are required for RMII PHY data connections:
ESP32 EMAC Function
See desciption about the clock
See ESP32 datasheet
Ethernet with PoE¶
Some ethernet boards support Power over Ethernet (PoE), so only a single (ethernet) cable to the ESP is needed, and the ESP (and any sensors) will be powered via an onboard converter.
For Olimex boards in the ESP32-POE range, the supplier has documented this warning:
Important notice: Olimex ESP32-PoE has no galvano isolation from Ethernet’s power supply, when you program the board via the micro USB connector the Ethernet cable should be disconnected (if you have power over the Ethernet cable)!
Consider using Olimex USB-ISO to protect your computer and board from accidental short circuit. Also consider instead using Olimex ESP32-PoE-ISO board, which is insulated.
Most likely, this warning is applicable to other brands as well.
GPIO boot states¶
For some GPIO pins, the boot state (initial configuration after startup) can be configured.
Some differences exist between ESP8266 and ESP32:
ESP8266 can’t initialize GPIO’s 6, 7, 8, 9 and 11 (used for flash-chip by ESP8266 chip).
ESP8285 can’t initialize GPIO’s 6, 7, 8 and 11 (used by flash of ESP8285 chip).
ESP32 / ESP32-S2 can’t initialize all GPIO’s, only GPIO pins that are actually available for use are shown.
ESP8266 GPIO boot states:
ESP32 GPIO boot states:
(Besides the serial pins, also I2C and SPI are configured)
If the board supports PSRAM, it has these differences:
Overview of the GPIO pin mapping of ESP32 (link to Espressif documentation): ESP32 DevKitC
ESP32-S2 GPIO boot states:
(Only the serial port logging is enabled on this unit, no SPI or I2C)
If the board supports PSRAM, it hides GPIO-26
(GPIO-26 is missing from the range, as it can not be used if PSRAM is present)
Overview of the GPIO pin mapping of ESP32-S2 (link to Espressif documentation): ESP32-S2 Saola1