I would like to connect sensors with digital signals to ESP32. But I do not know how many pins can be used on ESP32 board for sensors. How many pins are there in ESP32 which can be used for connecting sensors?

  • 1
    you get about 20 that work without complications, and about 30 with some planning. not all boards break out all GPIOs, so shop around. – dandavis Aug 24 '18 at 19:04
  • 4
    I'm voting to close this question as off-topic because this probably belongs on electronics.stackexchange.com – hardillb Aug 26 '18 at 6:34
  • 1
    It doesn't actually belong on EESE (it would be rejected as the question fails to be specific about interface, and because the information is readily available from the data sheet), but it is off-topic here, as it's a fundamental question about the processor, rather than a question about IoT. – Chris Stratton Aug 26 '18 at 21:57

There are some details about this on the tutorial (https://medium.com/coinmonks/espressif-esp32-tutorial-getting-started-3d1916362738):

ESP32 has 34 GPIO pins which can be assigned various functions by programming the appropriate registers. There are several kinds of GPIOs: digital-only, analog-enabled, capacitive-touch-enabled, etc.

Analog-enabled GPIOs and Capacitive-touch-enabled GPIOs can be configured as digital GPIOs. Most of the digital GPIOs can be configured as internal pull-up or pull-down, or set to high impedance. When configured as an input, the input value can be read through the register. The input can also be set to edge-trigger or level-trigger to generate CPU interrupts. For low-power operations, the GPIOs can be set to hold their states.

The ESP32 integrates 12-bit SAR ADCs and supports measurements on 18 channels (analog-enabled pins). Some of these pins can be used to build a programmable gain amplifier which is used for the measurement of small analog signals.

The ULP-coprocessor (Ultra Low Power) in ESP32 is also designed to measure voltage, while operating in the sleep mode, which enables low-power consumption. With the appropriate setting, the ADCs and the amplifier can be configured to measure voltage on 18 pins maximum.

The ESP32 has 10 capacitive-sensing GPIOs, which detect variations induced by touching or approaching the GPIOs with a finger or other objects. The low-noise nature of the design and the high sensitivity of the circuit allow relatively small pads to be used.
34 x GPIO:

3 x UARTs, including hardware flow control
3 x SPI
2 x I2S
18 x ADC input channels
2 x DAC
2 x I2C
Infrared Remote Control
PWM/timer input/output available on every GPIO pin
OpenOCD debug interface with 32 kB TRAX buffer
SDIO master/slave 50 MHz
Supports external SPI flash up to 16 MB
SD-card interface support

For more details you can check out their datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf

  • Hi @Shubhendu, I edited your post to add quote formatting to the text taken from the datasheet. Be sure to make it clear which bits of your post are your original work and which text is quoted from elsewhere (you can use quote formatting as I did here, and explicitly say that the text is taken from the datasheet). Take a look at our referencing guide for more information. – Aurora0001 Aug 25 '18 at 13:26
  • Hey! @Aurora0001 actually the details above are from tutorial and i attached the link to documentation so that if he wants to dig more he can go through the sheet. – user4904 Aug 25 '18 at 13:27
  • Ah, okay, in that case you need to link directly to the tutorial that the text is copied from as explained in the referencing guide above. If you don't cite the sources of your quotes, it could be seen as plagiarism which isn't allowed here. In this case it looks like the tutorial you were reading actually copied from the datasheet's text anyway, but you should still link to the original source as you found it. – Aurora0001 Aug 25 '18 at 13:32
  • 1
    Yeah I added the tutorial. – user4904 Aug 25 '18 at 13:55

Name No. Type Function Analog VDDA 1 P Analog power supply (2.3 V ~ 3.6 V) LNA_IN 2 I/O RF input and output VDD3P3 3 P Analog power supply (2.3 V ~ 3.6 V) VDD3P3 4 P Analog power supply (2.3 V ~ 3.6 V) VDD3P3_RTC SENSOR_VP 5 I GPIO36, ADC1_CH0, RTC_GPIO0 SENSOR_CAPP 6 I GPIO37, ADC1_CH1, RTC_GPIO1 SENSOR_CAPN 7 I GPIO38, ADC1_CH2, RTC_GPIO2 SENSOR_VN 8 I GPIO39, ADC1_CH3, RTC_GPIO3 Espressif Systems 7 ESP32 Datasheet V2.5 2. Pin Definitions Name No. Type Function CHIP_PU 9 I High: On; enables the chip Low: Off; resets the chip Note: Do not leave the CHIP_PU pin floating. VDET_1 10 I GPIO34, ADC1_CH6, RTC_GPIO4 VDET_2 11 I GPIO35, ADC1_CH7, RTC_GPIO5 32K_XP 12 I/O GPIO32, 32K_XP (32.768 kHz crystal oscillator input), ADC1_CH4, TOUCH9, RTC_GPIO9 32K_XN 13 I/O GPIO33, 32K_XN (32.768 kHz crystal oscillator output), ADC1_CH5, TOUCH8, RTC_GPIO8 GPIO25 14 I/O GPIO25, DAC_1, ADC2_CH8, RTC_GPIO6, EMAC_RXD0 GPIO26 15 I/O GPIO26, DAC_2, ADC2_CH9, RTC_GPIO7, EMAC_RXD1 GPIO27 16 I/O GPIO27, ADC2_CH7, TOUCH7, RTC_GPIO17, EMAC_RX_DV MTMS 17 I/O GPIO14, ADC2_CH6, TOUCH6, RTC_GPIO16, MTMS, HSPICLK, HS2_CLK, SD_CLK, EMAC_TXD2 MTDI 18 I/O GPIO12, ADC2_CH5, TOUCH5, RTC_GPIO15, MTDI, HSPIQ, HS2_DATA2, SD_DATA2, EMAC_TXD3 VDD3P3_RTC 19 P Input power supply for RTC IO (2.3 V ~ 3.6 V) MTCK 20 I/O GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER MTDO 21 I/O GPIO15, ADC2_CH3, TOUCH3, RTC_GPIO13, MTDO, HSPICS0, HS2_CMD, SD_CMD, EMAC_RXD3 GPIO2 22 I/O GPIO2, ADC2_CH2, TOUCH2, RTC_GPIO12, HSPIWP, HS2_DATA0, SD_DATA0 GPIO0 23 I/O GPIO0, ADC2_CH1, TOUCH1, RTC_GPIO11, CLK_OUT1, EMAC_TX_CLK GPIO4 24 I/O GPIO4, ADC2_CH0, TOUCH0, RTC_GPIO10, HSPIHD, HS2_DATA1, SD_DATA1, EMAC_TX_ER VDD_SDIO GPIO16 25 I/O GPIO16, HS1_DATA4, U2RXD, EMAC_CLK_OUT VDD_SDIO 26 P Output power supply: 1.8 V or the same voltage as VDD3P3_RTC GPIO17 27 I/O GPIO17, HS1_DATA5, U2TXD, EMAC_CLK_OUT_180 SD_DATA_2 28 I/O GPIO9, SD_DATA2, SPIHD, HS1_DATA2, U1RXD SD_DATA_3 29 I/O GPIO10, SD_DATA3, SPIWP, HS1_DATA3, U1TXD SD_CMD 30 I/O GPIO11, SD_CMD, SPICS0, HS1_CMD, U1RTS SD_CLK 31 I/O GPIO6, SD_CLK, SPICLK, HS1_CLK, U1CTS SD_DATA_0 32 I/O GPIO7, SD_DATA0, SPIQ, HS1_DATA0, U2RTS SD_DATA_1 33 I/O GPIO8, SD_DATA1, SPID, HS1_DATA1, U2CTS VDD3P3_CPU GPIO5 34 I/O GPIO5, VSPICS0, HS1_DATA6, EMAC_RX_CLK GPIO18 35 I/O GPIO18, VSPICLK, HS1_DATA7 GPIO23 36 I/O GPIO23, VSPID, HS1_STROBE VDD3P3_CPU 37 P Input power supply for CPU IO (1.8 V ~ 3.6 V) GPIO19 38 I/O GPIO19, VSPIQ, U0CTS, EMAC_TXD0 GPIO22 39 I/O GPIO22, VSPIWP, U0RTS, EMAC_TXD1 Espressif Systems 8 ESP32 Datasheet V2.5 2. Pin Definitions Name No. Type Function U0RXD 40 I/O GPIO3, U0RXD, CLK_OUT2 U0TXD 41 I/O GPIO1, U0TXD, CLK_OUT3, EMAC_RXD2 GPIO21 42 I/O GPIO21, VSPIHD, EMAC_TX_EN Analog VDDA 43 P Analog power supply (2.3 V ~ 3.6 V) XTAL_N 44 O External crystal output XTAL_P 45 I External crystal input VDDA 46 P Analog power supply (2.3 V ~ 3.6 V) CAP2 47 I Connects to a 3 nF capacitor and 20 kΩ resistor in parallel to CAP1 CAP1 48 I Connects to a 10 nF series capacitor to ground GND 49 P Ground These are the pin configuration of ESP32. Pl refer the datasheet you will get all answer over their.

Not the answer you're looking for? Browse other questions tagged or ask your own question.