#363 Which ESP32 pins are safe to use?

Andreas Spiess
29 Nov 202011:52

Summary

TLDRThis video offers an in-depth look at the ESP32 microcontroller, focusing on its pins and their specific functions. It provides a detailed overview of the 40 GPIO pins, highlighting which ones to use or avoid for various projects. The video also covers the importance of consulting the datasheet, handling strapping pins, and using pins for specific interfaces like I2C, SPI, and PWM. Additionally, it discusses advanced features like ADC inputs, DAC outputs, interrupts, and touch sensors. The host shares practical tips for pin selection to optimize project design and performance.

Takeaways

  • 😀 The ESP32 has 40 GPIO (General Purpose Input Output) pins, but not all are truly general purpose.
  • 🔍 GPIO pins 34 through 39 are actually GPI (General Purpose Input) pins and should not be used as output pins.
  • ⚠️ GPIO 34 and 35 are particularly dangerous if used for output without proper precautions.
  • 🔌 GPIO 6 to 11 are connected to an external flash memory chip and should be avoided unless you know what you are doing.
  • 🔄 GPIO 36 and 39 are typically labeled as sensor VP and sensor VN and have special functions.
  • 🚫 Strapping pins like GPIO0 and GPIO2 have functions during boot up and should be handled carefully to prevent boot issues.
  • 🔌 RX/TX pins (GPIO1 and 3) are commonly used for flashing and debugging and should not be altered.
  • 🔄 The ESP32 has two I2C interfaces, typically using GPIO21 and 22, which can be reconfigured to other pins if needed.
  • 🔄 Two SPI interfaces are available, with the third SPI bus used for the flash memory chip.
  • 🔌 GPIO 12 to 15 should be reserved for debugging purposes if using the inline debugger of PlatformIO.
  • 🔋 GPIO 34 through 39 can be used as ADC (Analog to Digital Converter) input pins, though the quality of the ADC results may not be excellent.
  • 🎵 The ESP32 has two 8-bit DAC (Digital to Analog Converter) outputs on GPIO 25 and 26, which are simple to program.

Q & A

  • What is the primary focus of the video script about the ESP32?

    -The primary focus of the video script is to explore the ESP32's pins, create a priority pin list, and provide insights on how to effectively use the ESP32's various pins for projects.

  • How many GPIO pins does the ESP32 have according to the datasheet?

    -According to the datasheet, the ESP32 has 40 GPIO pins numbered from GPIO0 to GPIO39.

  • Why are GPIO 34 through 39 not considered general purpose input output pins?

    -GPIO 34 through 39 should be called GPI pins because they cannot be used as output pins, and using them for output without caution can lead to confusion and wasted troubleshooting time.

  • What special function do GPIO 36 and 39 have in the ESP32?

    -GPIO 36 and 39 are usually labeled as sensor VP and sensor VN, indicating they have a special function, but the exact purpose is not detailed in the script.

  • Why are GPIO 6 to 11 not recommended for general use in ESP32 modules like the Vroom or the Vrover?

    -GPIO 6 to 11 are connected to an external flash memory chip used for data storage, making them 'forbidden' for general use unless the user knows exactly what they are doing.

  • What is the purpose of the strapping pins in the ESP32 during boot up?

    -Strapping pins have a function during boot up, and if wrongly connected, they can prevent the ESP32 from booting properly.

  • Why should GPIO0 and GPIO2 not be used for projects without a specific need?

    -GPIO0 and GPIO2 have hidden functions that are important during the boot process and firmware flashing. Using them without a specific need can lead to complications and difficulty in troubleshooting.

  • What are the standard pins used for the ESP32's I²C interface?

    -The standard pins used for the ESP32's I²C interface are GPIO21 and GPIO22, but they can be changed to most other GPIO pins using specific commands.

  • How many SPI interfaces does the ESP32 have, and which pins are used for them?

    -The ESP32 has two usable SPI interfaces that use different sets of pins. The standard libraries use the VSPI pins as shown in the SPI example sketch.

  • What is the purpose of the ADC pins on the ESP32, and are there any limitations when using them with Wi-Fi?

    -The ADC pins on the ESP32 are used for analog-to-digital conversion. However, all pins starting with ADC2 cannot be used if Wi-Fi is enabled, limiting the available ADC pins for use.

  • How can the ESP32's GPIO pins be used for PWM, and what is unique about its implementation compared to Arduino?

    -The ESP32 can use all GPIOs for PWM to control devices like servos or dim LEDs. Unlike Arduino, which uses 'analogWrite', the ESP32 requires defining the frequency and resolution of a channel before attaching it to a pin and writing to the channel.

  • What is the purpose of interrupts in the ESP32, and how flexible are they in terms of pin usage?

    -Interrupts allow an external signal to interrupt any running sketch, simplifying some projects. The ESP32 is flexible with interrupts, allowing the use of all pins for this purpose, although it is not very fast in handling interrupts.

  • What are the exotic usages of pins discussed in the script, and how many pins can be used for touch sensors?

    -The script discusses touch sensors and hall sensors as exotic usages of pins. Out of the 10 pins that can be used for touch sensors, 8 can be considered after excluding special pins.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
ESP32MicrocontrollersGPIO PinsProgrammingSensorsEmbedded SystemsElectronicsDIY ProjectsTech TipsYouTube