Generic ESP8266¶
All ESP8266-based devices are supported by ESPHome. Simply select ESP8266
when
the ESPHome wizard asks you for your platform and choose a board type
from this link when the wizard
asks you for the board type.
# Example configuration entry
esphome:
name: livingroom
esp8266:
board: <BOARD_TYPE>
Many boards have a pin numbering for the exposed pins that is different from the internally used
ones. ESPHome tries to map the silk-screen pin numbers into the internal pin numbers with a few
boards, but for generic ESP8266 boards it is often required to just use the internal pin numbers.
To do this, just prefix all pins with GPIO
, for example GPIO0
for the pin with the internal pin
number 0.
Some notes on the pins:
GPIO6
-GPIO11
,GPIO0
,GPIO2
andGPIO15
are often already used by the internal flash interface and boot mode detection. So it’s best to avoid using these pins.GPIO17
additionally has an ADC connected to it. See the Analog To Digital Sensor to read voltages (in the range from 0 to 1.0V) on this pin.
# Example configuration entry
esphome:
name: livingroom
esp8266:
board: nodemcuv2
binary_sensor:
- platform: gpio
name: "Pin GPIO17"
pin: GPIO17
Special Pins¶
|
Controls Boot Mode |
|
UART TX pin |
|
Controls Boot Mode |
|
UART RX pin |
|
SDIO/Flash CLK pin |
|
SDIO/Flash Data 0 pin |
|
SDIO/Flash Data 1 pin |
|
SDIO/Flash Data 2 pin (qio/qout only) |
|
SDIO/Flash Data 3 pin (qio/qout only) |
|
SDIO/Flash CMD pin |
|
Attached to Hardware SPI controller MISO |
|
Attached to Hardware SPI controller MOSI |
|
Attached to Hardware SPI controller CLK |
|
Controls Boot Mode; Attached to Hardware SPI controller CS |
|
Special pin that can be accessed from RTC, and is Deep-Sleep wakeup pin |
TOUT aka |
ADC pin for measuring voltages, can only be used as analog input pin |
This means effectively only the following pins can be used as general purpose GPIO:
Pin |
Restrictions |
State after Reset |
|
If HIGH on boot |
Weak Pull Up |
|
If HIGH on boot |
Weak Pull Up |
|
High Impedance |
|
|
High Impedance |
|
|
Weak Pull Up |
|
|
Weak Pull Up |
|
|
Weak Pull Up |
|
|
Weak Pull Up |
|
|
If LOW on boot |
Weak Pull Up |
|
Has pull-down (but no pull-up) resistor |
Weak Pull Down |
Boot Modes¶
On each boot, the ESP8266 will check three pins to determine in which boot mode to enter. There are three boot modes:
Mode |
|
|
|
|
Boot from Flash (normal) |
HIGH |
HIGH |
LOW |
3 |
Download Code from UART |
LOW |
HIGH |
LOW |
1 |
Boot from SD-Card |
ANY |
ANY |
HIGH |
4-7 |
You can identify these on boot-up by looking at the UART output, the first number
in the boot mode:
line tells you what mode was selected
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
The first lines when viewing the UART logs might have unrecognized characters. This is because the effective baudrate of the ESP8266 bootloader is 74800, whereas the program uses 115200.
Reset Causes¶
Additionally, the first line also contains the reset cause. These reset causes are documented:
0 |
Undefined |
1 |
Power On Reboot |
2 |
External reset or deep-sleep wakeup |
4 |
Hardware WDT reset |
After a software reset, the reset cause will not change.
Electrical Characteristics¶
Parameter |
Min. |
Typical |
Max. |
Unit |
Operating Temperature |
-40 |
125 |
°C |
|
Working Voltage |
2.5 |
3.3 |
3.6 |
V |
|
-0.3 |
0.25*V_IO |
V |
|
|
0.75*V_IO |
3.6 |
V |
|
|
0.1*V_IO |
V |
||
|
0.8*V_IO |
V |
||
|
12 |
mA |
||
Power Consumption in Deep Sleep |
20 |
µA |
||
Power Consumption in Active Mode |
120 |
mA |
Source: ESP8266EX datasheet
The internal pull up/down resistors have values of 30kΩ to 100kΩ (source).