当前位置:网站首页>2021-11-17 esp32 pin reference
2021-11-17 esp32 pin reference
2022-07-19 06:03:00 【The thought of the sea】
ESP32 Pin reference
ESP32 Chip equipped 48 A pin with multiple functions . Not all pins are exposed to all ESP32 In the development board , Some pins cannot be used .
On how to use ESP32 GPIO There are many problems . What should you use pin? What should be avoided in the project pin? This article aims to become a for ESP32 Of GPIO Provide a simple and easy to understand Reference Guide .
Be careful : Not all GPIO Can be accessed in all development boards , But every particular GPIO All work in the same way , No matter what development board you use .
EN Pin , Of the board EN yes 3.3V Enable pin of regulator . It was pulled up , So connect to GND To disable 3.3V Regulator . for example , This means that you can use this pin connected to the button to restart your ESP32.
ESP32 Peripherals
ESP32 Peripherals include :
18 An analog-to-digital converter (ADC) passageway
3 individual SPI Interface
3 individual UART Interface
2 individual I2C Interface
16 A pulse width modulation output channel
2 A / D converter (DAC)
2 individual I2S Interface
10 A capacitive sensor GPIO
ADC( A / D converter ) and DAC( A / D converter ) Functions are assigned to specific static pins . however , You can decide which pins are UART、I2C、SPI、PWM etc. , You just need to allocate them in the code . It's possible , because ESP32 The multiplexing function of the chip .

Each board is slightly different , For example, this one I bought recently is like this , It's also good , Wide voltage power supply, maximum support 18 v , Um. very XX.

Only input pins
GPIO34 To 39 yes GPIs– Only input pins . These pins have no internal pull-up or pull-down resistors . They cannot be used as output , Therefore, these pins can only be used as input :
GPIO 34
GPIO 35
GPIO 36
GPIO 39
Integrated into the ESP-WROOM-32 Upper SPI Flash memory
GPIO 6 To GPIO 11 In some ESP32 The development board is open . however , These pins are connected to ESP-WROOM-32 Integration on chip SPI Flash memory , Not recommended for other purposes . therefore , Do not use these pins in the project :
GPIO 6(SCK/CLK)
GPIO 7(SDO/SD0)
GPIO 8(SDI/SD1)
GPIO 9(SHD/SD2)
GPIO 10(SWP/SD3)
GPIO 11(CSC/CMD)
Capacitive touch GPIO
ESP32 Yes 10 An internal capacitive touch sensor . They can sense any change in charged matter , Like human skin . therefore , They can detect when touching with their fingers gpio Changes caused by . These pins can be easily integrated into the capacitor pad , And replace mechanical buttons . Capacitive contacts can also be used to wake up ESP32 Deep sleep .
These internal touch sensors are connected to these sensors GPIO:
T0 (GPIO 4)
T1 (GPIO 0)
T2 (GPIO 2)
T3 (GPIO 15)
T4 (GPIO 13)
T5 (GPIO 12)
T6 (GPIO 14)
T7 (GPIO 27)
T8 (GPIO 33)
T9 (GPIO 32)
A / D converter (ADC)
ESP32 Yes 18 x 12 position ADC Input channel ( and ESP8266 Only 1 x 10 position ADC). These can be used as ADC And the corresponding channel GPIO:
ADC1_CH0 (GPIO 36)
ADC1_CH1 (GPIO 37)
ADC1_CH2 (GPIO 38)
ADC1_CH3 (GPIO 39)
ADC1_CH4 (GPIO 32)
ADC1_CH5 (GPIO 33)
ADC1_CH6 (GPIO 34)
ADC1_CH7 (GPIO 35)
ADC2_CH0 (GPIO 4)
ADC2_CH1 (GPIO 0)
ADC2_CH2 (GPIO 2)
ADC2_CH3 (GPIO 15)
ADC2_CH4 (GPIO 13)
ADC2_CH5 (GPIO 12)
ADC2_CH6 (GPIO 14)
ADC2_CH7 (GPIO 27)
ADC2_CH8 (GPIO 25)
ADC2_CH9 (GPIO 26)
Be careful : Use Wi-Fi Can not be used when ADC2 Pin . therefore , If you use Wi-Fi, And can't get from ADC2 GPIO Get value , You can consider using ADC1 GPIO, This should solve your problem .
ADC The input channel has 12 Bit resolution . This means you can get 0 To 4095 Analog reading between , among 0 Corresponding to 0V,4095 Corresponding to 3.3V. You can also set the resolution of the channel and ADC Range .
ESP32 ADC Pins have no linear behavior . You may not be able to distinguish 0 and 0.1V, or 3.2 and 3.3V. In the use of ADC Pin time , You need to keep this in mind .
A / D converter (DAC)
ESP32 There are 2 x 8 position DAC passageway , It is used to convert digital signal into analog voltage signal output . These are DAC passageway :
DAC1 (GPIO25)
DAC2 (GPIO26)
RTC GPIOs
ESP32 Support RTC GPIO. When ESP32 When in deep sleep , You can use routing to RTC Low power consumption subsystem GPIO. these RTC gpio It can be used in ultra-low power consumption (ULP) The coprocessor runtime will ESP32 Wake up from deep sleep . following GPIO It can be used as an external wake-up source .
RTC_GPIO0 (GPIO36)
RTC_GPIO3 (GPIO39)
RTC_GPIO4 (GPIO34)
RTC_GPIO5 (GPIO35)
RTC_GPIO6 (GPIO25)
RTC_GPIO7 (GPIO26)
RTC_GPIO8 (GPIO33)
RTC_GPIO9 (GPIO32)
RTC_GPIO10 (GPIO4)
RTC_GPIO11 (GPIO0)
RTC_GPIO12 (GPIO2)
RTC_GPIO13 (GPIO15)
RTC_GPIO14 (GPIO13)
RTC_GPIO15 (GPIO12)
RTC_GPIO16 (GPIO14)
RTC_GPIO17 (GPIO27)
Pulse width modulation
ESP32 LED PWM The controller has 16 A separate channel , Generate features that can be configured differently PWM The signal . All pins that can be used as outputs can be used as PWM Pin (GPIOs 34 To 39 Can't produce PWM).
To set the pulse width modulation signal , These parameters need to be defined in the code :
signal frequency ;
Duty cycle ;
PWM channel ;
To output a signal GPIO.
I2C
ESP32 There are two I2C passageway , Any pin can be set to SDA or SCL. take ESP32 And Arduino IDE When used together , Default I2C Pin for :
GPIO 21(SDA)
GPIO 22(SCL)
If you want to use other pins , When using wire Library , Just call :
Wire.begin(SDA, SCL);
SPI By default ,SPI Of pin It maps to :

interrupt
all GPIO Can be configured to interrupt .
Strapping pins Note here : Some of these pins affect startup , It's better not to send a signal when connecting external equipment to start .
ESP32 The chip has the following Strapping pins:
GPIO 0
GPIO 2
GPIO 4
GPIO 5( Must be high during startup )
GPIO 12( Must be low during start-up )
Please note that ESP32 Of IO12, This IO The level when the port is powered on will determine the external flash( The one that stores the program ) Working voltage of , When the foot is high when powered on, it is considered flash Work in 1.8V, If it is low, it means flash Work in 3.3V. Commonly used like Wroom-32 This pin of the series module has been pulled down , namely flash Is working in 3.3V Of , If the external circuit is strongly connected and pulled up, the module may work abnormally .
GPIO 15( Must be high during startup )
These are used to put ESP32 Put in boot loader or burn mode . In most built-in USB/Serial On the development board of , You don't need to worry about the status of these pins . The circuit board puts the pins in the correct burn or start mode . of ESP32 More information about boot mode selection , See here .
however , If you have peripherals connected to these pins , You may have difficulties , Trying to upload a new code , Burn with new firmware ESP32 Or reset the board . If you have some peripherals connected to Strapping pins, And you are uploading code or burning ESP32 We have problems , It may be that these peripherals prevent ESP32 Enter the correct mode . Please read the guidance mode selection document to guide you in the right direction . Reset 、 After burning or starting , These pins work as expected .
Pins HIGH at Boot
some GPIO Change its state to high or output at startup or reset PWM The signal . It means , If the output is connected to these gpio, It's in ESP32 Unexpected results may be obtained when resetting or booting .
GPIO 1
GPIO 3
GPIO 5
GPIO 6 to GPIO 11 (connected to the ESP32 integrated SPI flash memory – not recommended to use).
GPIO 14
GPIO 15
Enable (EN)
Enable (EN) yes 3.3V Enable pin of regulator . It was pulled up , So grounding makes 3.3V The regulator fails . for example , This means that you can use this pin connected to the button to restart ESP32.
GPIO Current consumption
according to ESP32 In the data sheet “ Recommended operating conditions ” part , Every GPIO The absolute maximum current of is 40 Ma .
ESP32 Built in Hall effect sensor
ESP32 It also has a built-in Hall effect sensor , It can detect the change of surrounding magnetic field .
边栏推荐
- NAND NOR FLASH闪存产品概述
- 宽电压输入高电压输出 电压控制型
- Go language introduction and application scenario analysis
- Conversion, isolation and transmission of international standard signals 0-5v/0-10v/1-5v, 0-10ma/0-20ma/4-20ma, etc
- 2021-11-10 micropyton tb6600 step drive class
- [detailed tutorial installation] [configuration] auxiliary plug-ins about eslint in vscode
- 索引库中的文档的操作
- Wide voltage input high voltage output voltage control type
- Rs-485/232 to 4-20ma/0-10v isolated d/a converter
- 最长括号匹配 (线性DP)
猜你喜欢

自动补全 & (自定义)拼音分词器 & 搜索时注意事项
![[simple and fast] after startup, the desktop is normal, and the taskbar below is unresponsive / the mouse keeps turning](/img/65/fbb975491d4abd5d1babdf000513e2.png)
[simple and fast] after startup, the desktop is normal, and the taskbar below is unresponsive / the mouse keeps turning

4-20ma转4-20ma 0-5v转0-5v 模拟信号隔离变送器

设置索引库结构,给用户添加可自动补全的suggestion,并将一些字段变成集合放到suggestion里面去

0-10V,4-20mA电流电压转PWM隔离转换器 质料以及应用电路图

Thermal resistance PT100 cu50 isolation converter to 4-20mA analog output temperature transmitter 0-10V

升高压模块隔离模块HRA2460D-2W

分享CS品牌贴片式T卡在打猎相机领域的运用案例

数字信号隔离模块 ADUM1401ARWZ 亚德诺 库存现货
![MySQL workbench basically uses [create a data table]](/img/cf/00818451ef0e8bcd5cc1d12f00d27c.png)
MySQL workbench basically uses [create a data table]
随机推荐
[BJOI2019] 排兵布阵(分组背包)
单片机的好搭档-CS创世SD NAND FLASH
QTSS回调例程
低功耗LDO线性稳压IC
4-20mA to 0-5khz, 5V pulse converter
Introduction to goroutine, a high concurrency feature of golang
ES聚合分析报错:“reason“ : “Text fields are not optimised for operations
[详细教程安装][配置] VsCode中关于Eslint的辅助插件
Lithium battery charging management chip
QTSS常数
软考初、中、高级考试全体验
[USACO06DEC]The Fewest Coins G(混合背包)
make menuconfig缺少ncurses
2021-09-15
锂电池充电管理芯片
LTH7五脚芯片的完整方案图FS4054充电电路原理
minio安装部署及简单使用
golang高并发特性goroutine介绍
busybox 指定日期修改 暂时不需要clock -w 写入硬件
Antd is not defined